Browse Source

deps: update to http-parser 2.6.2

Fixes http-parser regression with IS_HEADER_CHAR check
Add test case for obstext characters (> 0x80) is header

PR-URL: https://github.com/nodejs/node/pull/5237
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
process-exit-stdio-flushing
James M Snell 9 years ago
parent
commit
954a4b4b5b
  1. 4
      deps/http_parser/Makefile
  2. 2
      deps/http_parser/http_parser.c
  3. 2
      deps/http_parser/http_parser.h
  4. 2
      deps/http_parser/test.c
  5. 18
      test/parallel/test-http-header-obstext.js

4
deps/http_parser/Makefile

@ -22,14 +22,14 @@ PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
HELPER ?= HELPER ?=
BINEXT ?= BINEXT ?=
ifeq (darwin,$(PLATFORM)) ifeq (darwin,$(PLATFORM))
SONAME ?= libhttp_parser.2.6.1.dylib SONAME ?= libhttp_parser.2.6.2.dylib
SOEXT ?= dylib SOEXT ?= dylib
else ifeq (wine,$(PLATFORM)) else ifeq (wine,$(PLATFORM))
CC = winegcc CC = winegcc
BINEXT = .exe.so BINEXT = .exe.so
HELPER = wine HELPER = wine
else else
SONAME ?= libhttp_parser.so.2.6.1 SONAME ?= libhttp_parser.so.2.6.2
SOEXT ?= so SOEXT ?= so
endif endif

2
deps/http_parser/http_parser.c

@ -440,7 +440,7 @@ enum http_host_state
* character or %x80-FF * character or %x80-FF
**/ **/
#define IS_HEADER_CHAR(ch) \ #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) #define start_state (parser->type == HTTP_REQUEST ? s_start_req : s_start_res)

2
deps/http_parser/http_parser.h

@ -27,7 +27,7 @@ extern "C" {
/* Also update SONAME in the Makefile whenever you change these. */ /* Also update SONAME in the Makefile whenever you change these. */
#define HTTP_PARSER_VERSION_MAJOR 2 #define HTTP_PARSER_VERSION_MAJOR 2
#define HTTP_PARSER_VERSION_MINOR 6 #define HTTP_PARSER_VERSION_MINOR 6
#define HTTP_PARSER_VERSION_PATCH 1 #define HTTP_PARSER_VERSION_PATCH 2
#include <sys/types.h> #include <sys/types.h>
#if defined(_WIN32) && !defined(__MINGW32__) && \ #if defined(_WIN32) && !defined(__MINGW32__) && \

2
deps/http_parser/test.c

@ -3356,7 +3356,7 @@ test_double_content_length_error (int req)
parsed = http_parser_execute(&parser, &settings_null, buf, buflen); parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
if (parsed != buflen) { if (parsed != buflen) {
assert(HTTP_PARSER_ERRNO(&parser) == HPE_MULTIPLE_CONTENT_LENGTH); assert(HTTP_PARSER_ERRNO(&parser) == HPE_UNEXPECTED_CONTENT_LENGTH);
return; return;
} }

18
test/parallel/test-http-header-obstext.js

@ -0,0 +1,18 @@
'use strict';
const common = require('../common');
const http = require('http');
const assert = require('assert');
const server = http.createServer(common.mustCall((req, res) => {
res.end('ok');
}));
server.listen(common.PORT, () => {
http.get({
port: common.PORT,
headers: {'Test': 'Düsseldorf'}
}, common.mustCall((res) => {
assert.equal(res.statusCode, 200);
server.close();
}));
});
Loading…
Cancel
Save