Skip to content

Commit

Permalink
Fixed handling of text files and fixed #62 about mispresenting the DO…
Browse files Browse the repository at this point in the history
…M as GZipped content.
  • Loading branch information
machawk1 committed Aug 13, 2014
1 parent 44f558f commit 7365589
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions js/warcGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,16 @@ function generateWarc(o_request, o_sender, f_callback){
//DUCTTAPE to fix bug #53
responseHeaders[initURI] = responseHeaders[initURI].replace("HTTP/1.1 304 Not Modified","HTTP/1.1 200 OK");

var warcResponse =


//DUCTTAPE to fix bug #62
// - fix the content length to be representative of the un-zipped text content
responseHeaders[initURI] = responseHeaders[initURI].replace(/Content-Length:.*\r\n/gi,"Content-Length: "+lengthInUtf8Bytes(o_request.docHtml)+"\n");

// - remove reference to GZip HTML (or text) body, as we're querying the DOM, not getting the raw feed
responseHeaders[initURI] = responseHeaders[initURI].replace(/Content-Encoding.*gzip\r\n/gi,"");

warcResponse =
responseHeaders[initURI]+
CRLF + o_request.docHtml + CRLF;

Expand Down Expand Up @@ -173,7 +182,7 @@ function generateWarc(o_request, o_sender, f_callback){
return xx;
}
//alert("Warc response length is "+warcResponse.length +" vs. "+lengthInUtf8Bytes(warcResponse));
var htmlLengthCorrection = warcResponse.length - lengthInUtf8Bytes(warcResponse); //html count shouldn't use the method in makeWarcresponseHeader, pass a negative correction value
//var htmlLengthCorrection = warcResponse.length - lengthInUtf8Bytes(warcResponse); //html count shouldn't use the method in makeWarcresponseHeader, pass a negative correction value
//above doesn't work and only messes up content length. No adjustment needed, 0 passed below

var warcResponseHeader = makeWarcResponseHeaderWith(initURI, now, warcConcurrentTo, warcResponse,0);//htmlLengthCorrection);
Expand Down

0 comments on commit 7365589

Please sign in to comment.