Skip to content

Commit

Permalink
deps: update to http-parser 2.5.2
Browse files Browse the repository at this point in the history
Fixes http-parser regression with IS_HEADER_CHAR check
Add test case for obstext characters (> 0x80) is header

PR-URL: #5238
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Myles Borins <mborins@us.ibm.com>
  • Loading branch information
jasnell authored and Myles Borins committed Feb 15, 2016
1 parent 8e592bb commit 188cff3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deps/http_parser/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# IN THE SOFTWARE.

PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
SONAME ?= libhttp_parser.so.2.5.1
SONAME ?= libhttp_parser.so.2.5.2

CC?=gcc
AR?=ar
Expand Down
2 changes: 1 addition & 1 deletion deps/http_parser/http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,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)

Expand Down
2 changes: 1 addition & 1 deletion deps/http_parser/http_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 5
#define HTTP_PARSER_VERSION_PATCH 1
#define HTTP_PARSER_VERSION_PATCH 2

#include <sys/types.h>
#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600)
Expand Down
2 changes: 1 addition & 1 deletion deps/http_parser/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -3251,7 +3251,7 @@ test_double_content_length_error (int req)

parsed = http_parser_execute(&parser, &settings_null, buf, buflen);
if (parsed != buflen) {
assert(HTTP_PARSER_ERRNO(&parser) == HPE_MULTIPLE_CONTENT_LENGTH);
assert(HTTP_PARSER_ERRNO(&parser) == HPE_UNEXPECTED_CONTENT_LENGTH);
return;
}

Expand Down
18 changes: 18 additions & 0 deletions test/parallel/test-http-header-obstext.js
Original file line number Diff line number Diff line change
@@ -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();
}));
});

0 comments on commit 188cff3

Please sign in to comment.