-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deps: update http-parser to version 1.1
includes parsing improvements to ensure closer HTTP spec conformance PR-URL: nodejs-private/node-private#22
- Loading branch information
Showing
12 changed files
with
393 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
test/simple/test-http-client-reject-chunked-with-content-length.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var common = require('../common'); | ||
var http = require('http'); | ||
var net = require('net'); | ||
var assert = require('assert'); | ||
|
||
var reqstr = 'HTTP/1.1 200 OK\r\n' + | ||
'Content-Length: 1\r\n' + | ||
'Transfer-Encoding: chunked\r\n\r\n'; | ||
|
||
var server = net.createServer(function(socket) { | ||
socket.write(reqstr); | ||
}); | ||
|
||
server.listen(common.PORT, function() { | ||
// The callback should not be called because the server is sending | ||
// both a Content-Length header and a Transfer-Encoding: chunked | ||
// header, which is a violation of the HTTP spec. | ||
var req = http.get({port:common.PORT}, function(res) { | ||
assert.fail(null, null, 'callback should not be called'); | ||
}); | ||
req.on('error', common.mustCall(function(err) { | ||
assert(/^Parse Error/.test(err.message)); | ||
assert.equal(err.code, 'HPE_UNEXPECTED_CONTENT_LENGTH'); | ||
server.close(); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var common = require('../common'); | ||
var http = require('http'); | ||
var net = require('net'); | ||
var assert = require('assert'); | ||
|
||
var reqstr = 'HTTP/1.1 200 OK\r\n' + | ||
'Foo: Bar\r' + | ||
'Content-Length: 1\r\n\r\n'; | ||
|
||
var server = net.createServer(function(socket) { | ||
socket.write(reqstr); | ||
}); | ||
|
||
server.listen(common.PORT, function() { | ||
// The callback should not be called because the server is sending a | ||
// header field that ends only in \r with no following \n | ||
var req = http.get({port:common.PORT}, function(res) { | ||
assert.fail(null, null, 'callback should not be called'); | ||
}); | ||
req.on('error', common.mustCall(function(err) { | ||
assert(/^Parse Error/.test(err.message)); | ||
assert.equal(err.code, 'HPE_LF_EXPECTED'); | ||
server.close(); | ||
})); | ||
}); |
Oops, something went wrong.