http-parser-js
Advanced tools
Comparing version 0.4.8 to 0.4.9
@@ -282,2 +282,3 @@ /*jshint node:true */ | ||
var hasContentLength = false; | ||
var currentContentLengthValue; | ||
for (var i = 0; i < headers.length; i += 2) { | ||
@@ -289,7 +290,16 @@ switch (headers[i].toLowerCase()) { | ||
case 'content-length': | ||
currentContentLengthValue = +headers[i + 1]; | ||
if (hasContentLength) { | ||
throw parseErrorCode('HPE_UNEXPECTED_CONTENT_LENGTH'); | ||
// Fix duplicate Content-Length header with same values. | ||
// Throw error only if values are different. | ||
// Known issues: | ||
// https://github.com/request/request/issues/2091#issuecomment-328715113 | ||
// https://github.com/nodejs/node/issues/6517#issuecomment-216263771 | ||
if (currentContentLengthValue !== this.body_bytes) { | ||
throw parseErrorCode('HPE_UNEXPECTED_CONTENT_LENGTH'); | ||
} | ||
} else { | ||
hasContentLength = true; | ||
this.body_bytes = currentContentLengthValue; | ||
} | ||
hasContentLength = true; | ||
this.body_bytes = +headers[i + 1]; | ||
break; | ||
@@ -296,0 +306,0 @@ case 'connection': |
{ | ||
"name": "http-parser-js", | ||
"version": "0.4.8", | ||
"version": "0.4.9", | ||
"description": "A pure JS HTTP parser for node.", | ||
@@ -5,0 +5,0 @@ "main": "http-parser.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18985
395