Bug 1221754 - Set bodySize to 0 in case of 304 responses; r=jryans

This commit is contained in:
Jan Odvarko 2015-11-11 14:41:05 +01:00
parent 9ea31c76e9
commit 91f91182b3

View File

@ -298,7 +298,15 @@ HarBuilder.prototype = {
response.redirectURL = findValue(headers, "Location");
response.headersSize = headersSize;
response.bodySize = file.transferredSize || -1;
// 'bodySize' is size of the received response body in bytes.
// Set to zero in case of responses coming from the cache (304).
// Set to -1 if the info is not available.
if (typeof file.transferredSize != "number") {
response.bodySize = (response.status == 304) ? 0 : -1;
} else {
response.bodySize = file.transferredSize;
}
return response;
},