diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-01-28 00:54:05 +0300 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2015-01-28 18:56:44 +0300 |
commit | 660509694cfd4de59df0548eabbe18c97d75c63a (patch) | |
tree | 01cedf84a24d7d1af93391eb12b627857e2a31be /deps/http_parser/test.c | |
parent | 90ddb46d522c37d2bc2eb68a6e0c9d52f9fbba42 (diff) |
deps: roll back http_parser to 2.3.0
Commit 598efcbe ("deps: update http_parser to 2.4.1") introduced a
regression in HTTP Upgrade header handling.
Fixes: https://github.com/iojs/io.js/issues/627
PR-URL: https://github.com/iojs/io.js/pull/628
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Diffstat (limited to 'deps/http_parser/test.c')
-rw-r--r-- | deps/http_parser/test.c | 101 |
1 files changed, 7 insertions, 94 deletions
diff --git a/deps/http_parser/test.c b/deps/http_parser/test.c index aae0f739838..9799dc6d346 100644 --- a/deps/http_parser/test.c +++ b/deps/http_parser/test.c @@ -950,91 +950,6 @@ const struct message requests[] = ,.body= "" } -#define CONNECTION_MULTI 35 -, {.name = "multiple connection header values with folding" - ,.type= HTTP_REQUEST - ,.raw= "GET /demo HTTP/1.1\r\n" - "Host: example.com\r\n" - "Connection: Something,\r\n" - " Upgrade, ,Keep-Alive\r\n" - "Sec-WebSocket-Key2: 12998 5 Y3 1 .P00\r\n" - "Sec-WebSocket-Protocol: sample\r\n" - "Upgrade: WebSocket\r\n" - "Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n" - "Origin: http://example.com\r\n" - "\r\n" - "Hot diggity dogg" - ,.should_keep_alive= TRUE - ,.message_complete_on_eof= FALSE - ,.http_major= 1 - ,.http_minor= 1 - ,.method= HTTP_GET - ,.query_string= "" - ,.fragment= "" - ,.request_path= "/demo" - ,.request_url= "/demo" - ,.num_headers= 7 - ,.upgrade="Hot diggity dogg" - ,.headers= { { "Host", "example.com" } - , { "Connection", "Something, Upgrade, ,Keep-Alive" } - , { "Sec-WebSocket-Key2", "12998 5 Y3 1 .P00" } - , { "Sec-WebSocket-Protocol", "sample" } - , { "Upgrade", "WebSocket" } - , { "Sec-WebSocket-Key1", "4 @1 46546xW%0l 1 5" } - , { "Origin", "http://example.com" } - } - ,.body= "" - } - -#define CONNECTION_MULTI_LWS 36 -, {.name = "multiple connection header values with folding and lws" - ,.type= HTTP_REQUEST - ,.raw= "GET /demo HTTP/1.1\r\n" - "Connection: keep-alive, upgrade\r\n" - "Upgrade: WebSocket\r\n" - "\r\n" - "Hot diggity dogg" - ,.should_keep_alive= TRUE - ,.message_complete_on_eof= FALSE - ,.http_major= 1 - ,.http_minor= 1 - ,.method= HTTP_GET - ,.query_string= "" - ,.fragment= "" - ,.request_path= "/demo" - ,.request_url= "/demo" - ,.num_headers= 2 - ,.upgrade="Hot diggity dogg" - ,.headers= { { "Connection", "keep-alive, upgrade" } - , { "Upgrade", "WebSocket" } - } - ,.body= "" - } - -#define CONNECTION_MULTI_LWS_CRLF 37 -, {.name = "multiple connection header values with folding and lws" - ,.type= HTTP_REQUEST - ,.raw= "GET /demo HTTP/1.1\r\n" - "Connection: keep-alive, \r\n upgrade\r\n" - "Upgrade: WebSocket\r\n" - "\r\n" - "Hot diggity dogg" - ,.should_keep_alive= TRUE - ,.message_complete_on_eof= FALSE - ,.http_major= 1 - ,.http_minor= 1 - ,.method= HTTP_GET - ,.query_string= "" - ,.fragment= "" - ,.request_path= "/demo" - ,.request_url= "/demo" - ,.num_headers= 2 - ,.upgrade="Hot diggity dogg" - ,.headers= { { "Connection", "keep-alive, upgrade" } - , { "Upgrade", "WebSocket" } - } - ,.body= "" - } , {.name= NULL } /* sentinel */ }; @@ -2292,6 +2207,7 @@ print_error (const char *raw, size_t error_location) break; case '\n': + char_len = 2; fprintf(stderr, "\\n\n"); if (this_line) goto print; @@ -2994,11 +2910,15 @@ test_simple (const char *buf, enum http_errno err_expected) { parser_init(HTTP_REQUEST); + size_t parsed; + int pass; enum http_errno err; - parse(buf, strlen(buf)); + parsed = parse(buf, strlen(buf)); + pass = (parsed == strlen(buf)); err = HTTP_PARSER_ERRNO(parser); - parse(NULL, 0); + parsed = parse(NULL, 0); + pass &= (parsed == 0); parser_free(); @@ -3556,13 +3476,6 @@ main (void) test_simple(buf, HPE_INVALID_METHOD); } - // illegal header field name line folding - test_simple("GET / HTTP/1.1\r\n" - "name\r\n" - " : value\r\n" - "\r\n", - HPE_INVALID_HEADER_TOKEN); - const char *dumbfuck2 = "GET / HTTP/1.1\r\n" "X-SSL-Bullshit: -----BEGIN CERTIFICATE-----\r\n" |