diff options
author | James M Snell <jasnell@gmail.com> | 2016-02-03 17:28:48 -0800 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-02-09 09:22:03 -0800 |
commit | 4f4c8ab3b4cea246d2ece6ca006fe280241d84a4 (patch) | |
tree | 7fc892de896a4880b5ef4d97ec0817e9e6db30f0 /test/parallel/test-http-client-reject-cr-no-lf.js | |
parent | d387591bbb53991df8402cc9f0613e296e89929f (diff) | |
download | android-node-v8-4f4c8ab3b4cea246d2ece6ca006fe280241d84a4.tar.gz android-node-v8-4f4c8ab3b4cea246d2ece6ca006fe280241d84a4.tar.bz2 android-node-v8-4f4c8ab3b4cea246d2ece6ca006fe280241d84a4.zip |
deps: update http-parser to version 2.6.1
includes parsing improvements to ensure closer HTTP spec conformance
PR-URL: https://github.com/nodejs/node-private/pull/26
Reviewed-By: Rod Vagg <r@va.gg>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'test/parallel/test-http-client-reject-cr-no-lf.js')
-rw-r--r-- | test/parallel/test-http-client-reject-cr-no-lf.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/parallel/test-http-client-reject-cr-no-lf.js b/test/parallel/test-http-client-reject-cr-no-lf.js new file mode 100644 index 0000000000..b60220cbb6 --- /dev/null +++ b/test/parallel/test-http-client-reject-cr-no-lf.js @@ -0,0 +1,27 @@ +'use strict'; + +const common = require('../common'); +const http = require('http'); +const net = require('net'); +const assert = require('assert'); + +const reqstr = 'HTTP/1.1 200 OK\r\n' + + 'Foo: Bar\r' + + 'Content-Length: 1\r\n\r\n'; + +const server = net.createServer((socket) => { + socket.write(reqstr); +}); + +server.listen(common.PORT, () => { + // The callback should not be called because the server is sending a + // header field that ends only in \r with no following \n + const req = http.get({port:common.PORT}, (res) => { + assert.fail(null, null, 'callback should not be called'); + }); + req.on('error', common.mustCall((err) => { + assert(/^Parse Error/.test(err.message)); + assert.equal(err.code, 'HPE_LF_EXPECTED'); + server.close(); + })); +}); |