From 4ed472e1277e1733e2df0ebaf31d57bfea2af8ea Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 15 Feb 2016 09:49:20 -0800 Subject: [PATCH] deps: update to http-parser 2.3.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/5241 Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Rod Vagg --- deps/http_parser/Makefile | 2 +- deps/http_parser/http_parser.c | 2 +- deps/http_parser/http_parser.h | 2 +- test/simple/test-http-header-obstext.js | 18 ++++++++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 test/simple/test-http-header-obstext.js diff --git a/deps/http_parser/Makefile b/deps/http_parser/Makefile index 55e81ef39ee3..4a5363aea2a5 100644 --- a/deps/http_parser/Makefile +++ b/deps/http_parser/Makefile @@ -19,7 +19,7 @@ # IN THE SOFTWARE. PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"') -SONAME ?= libhttp_parser.so.2.3.1 +SONAME ?= libhttp_parser.so.2.3.2 CC?=gcc AR?=ar diff --git a/deps/http_parser/http_parser.c b/deps/http_parser/http_parser.c index b8316cae33e3..dd1071595cd0 100644 --- a/deps/http_parser/http_parser.c +++ b/deps/http_parser/http_parser.c @@ -388,7 +388,7 @@ enum http_host_state * character or %x80-FF **/ #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 f4542a36e91f..f7ad8c76148b 100644 --- a/deps/http_parser/http_parser.h +++ b/deps/http_parser/http_parser.h @@ -27,7 +27,7 @@ extern "C" { /* Also update SONAME in the Makefile whenever you change these. */ #define HTTP_PARSER_VERSION_MAJOR 2 #define HTTP_PARSER_VERSION_MINOR 3 -#define HTTP_PARSER_VERSION_PATCH 1 +#define HTTP_PARSER_VERSION_PATCH 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 000000000000..4111a1e17240 --- /dev/null +++ b/test/simple/test-http-header-obstext.js @@ -0,0 +1,18 @@ +'use strict'; + +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