-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WARC Parsing sometimes results in truncated records. #34
Comments
I'm trying to parse the contents as well (especially HTML) and most of the sites return the HTML truncated. |
I'm experiencing this also. Seems like the issue is warcRecord/builder.js .. the function consumeLine() ... basically you're using a solo CRLF as the boundary between WARC Records... seems to me that you should be ignoring this until you reach the WARC Record's Content-Length |
seems that commenting out the line inside the switch statement resolves this specific problem. Is there a specific protocol reason it's there, like trailers or something, or were you just trying to avoid trailing CRLFs? |
The aim of crlf content two was to skip the trailing CRLFs between records. If that fixes the issue for all cases feel free to open a PR. |
Also @ikreymer still waiting on that PR fixing this you said you had |
Hey, here is the fix that I have in builder.js: I could isolate that and make it into a PR, not 100% sure it fixes it, but think so.. I had a bunch of other changes on that branch though. |
@chichicuervo in case this helps you, I wanted to mention I've been working on a new WARC reader library focusing on streaming WARCs in the browser: https://github.com/ikreymer/warcio.js It's not as far along as this library and doesn't yet have support for writing WARCs, though. |
The WARC parsing sometimes results in records being truncated.
This might be due to the parser continuing to look for newlines/read one line at a time, even when parsing the content body, and might be happening if there is a \r\n\r\n encountered in the body of the record.
The issue can be seen by running:
With these example files:
test1.warc.gz
(last couple of bytes are cut-off)
test2.warc.gz
(most of the file is cut-off after initial comment)
For comparison, the warcio version prints the full record:
The text was updated successfully, but these errors were encountered: