Skip to content

Commit

Permalink
deps: update http-parser to version 1.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) in header

PR-URL: #5242
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
jasnell authored and rvagg committed Feb 24, 2016
1 parent 563c359 commit 1e45a61
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion deps/http_parser/http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

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 @@ -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 <sys/types.h>
#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER<1600)
Expand Down
16 changes: 16 additions & 0 deletions test/simple/test-http-header-obstext.js
Original file line number Diff line number Diff line change
@@ -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();
}));
});

0 comments on commit 1e45a61

Please sign in to comment.