From 1e45a6111cab23143c39589dca14a46af50dd74c Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 15 Feb 2016 09:53:00 -0800 Subject: [PATCH] deps: update http-parser to version 1.2 Fixes http-parser regression with IS_HEADER_CHAR check Add test case for obstext characters (> 0x80) in header PR-URL: https://github.com/nodejs/node/pull/5242 Reviewed-By: Rod Vagg --- deps/http_parser/http_parser.c | 2 +- deps/http_parser/http_parser.h | 2 +- test/simple/test-http-header-obstext.js | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 test/simple/test-http-header-obstext.js diff --git a/deps/http_parser/http_parser.c b/deps/http_parser/http_parser.c index 0b2990970e87f3..77ad556584bd3d 100644 --- a/deps/http_parser/http_parser.c +++ b/deps/http_parser/http_parser.c @@ -388,7 +388,7 @@ enum http_host_state #endif #define IS_HEADER_CHAR(ch) \ - (ch == CR || ch == LF || ch == 9 || (ch > 31 && ch != 127)) + (ch == CR || ch == LF || ch == 9 || ((unsigned char)ch > 31 && ch != 127)) #define start_state (parser->type == HTTP_REQUEST ? s_start_req : s_start_res) diff --git a/deps/http_parser/http_parser.h b/deps/http_parser/http_parser.h index 7cb3b552573764..852d2ba129319a 100644 --- a/deps/http_parser/http_parser.h +++ b/deps/http_parser/http_parser.h @@ -25,7 +25,7 @@ extern "C" { #endif #define HTTP_PARSER_VERSION_MAJOR 1 -#define HTTP_PARSER_VERSION_MINOR 1 +#define HTTP_PARSER_VERSION_MINOR 2 #include #if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600) diff --git a/test/simple/test-http-header-obstext.js b/test/simple/test-http-header-obstext.js new file mode 100644 index 00000000000000..cd50b20bf76582 --- /dev/null +++ b/test/simple/test-http-header-obstext.js @@ -0,0 +1,16 @@ +var common = require('../common'); +var http = require('http'); +var assert = require('assert'); + +var server = http.createServer(common.mustCall(function(req, res) { + res.end('ok'); +})); +server.listen(common.PORT, function() { + http.get({ + port: common.PORT, + headers: {'Test': 'Düsseldorf'} + }, common.mustCall(function(res) { + assert.equal(res.statusCode, 200); + server.close(); + })); +}); \ No newline at end of file