diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-02-04 16:00:08 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-02-04 18:03:26 -0800 |
commit | e42c74e14168af6803f3d674069ba823aa54f2dd (patch) | |
tree | bc82fffcc2f68738055b147b1a7bcc82e2743612 /deps/http_parser | |
parent | f99fc29e62c6375d1d09967c64723f3c1fbd675a (diff) | |
download | android-node-v8-e42c74e14168af6803f3d674069ba823aa54f2dd.tar.gz android-node-v8-e42c74e14168af6803f3d674069ba823aa54f2dd.tar.bz2 android-node-v8-e42c74e14168af6803f3d674069ba823aa54f2dd.zip |
Upgrade http-parser
Diffstat (limited to 'deps/http_parser')
-rw-r--r-- | deps/http_parser/http_parser.c | 17 | ||||
-rw-r--r-- | deps/http_parser/test.c | 10 |
2 files changed, 23 insertions, 4 deletions
diff --git a/deps/http_parser/http_parser.c b/deps/http_parser/http_parser.c index 5a0972a7df..9c5640f6d4 100644 --- a/deps/http_parser/http_parser.c +++ b/deps/http_parser/http_parser.c @@ -331,10 +331,20 @@ size_t http_parser_execute (http_parser *parser, uint64_t nread = parser->nread; if (len == 0) { - if (state == s_body_identity_eof) { - CALLBACK2(message_complete); + switch (state) { + case s_body_identity_eof: + CALLBACK2(message_complete); + return 0; + + case s_dead: + case s_start_req_or_res: + case s_start_res: + case s_start_req: + return 0; + + default: + return 1; // error } - return 0; } /* technically we could combine all of these (except for url_mark) into one @@ -1384,6 +1394,7 @@ size_t http_parser_execute (http_parser *parser, break; default: + parser->state = state; return p - data; /* Error */ } } diff --git a/deps/http_parser/test.c b/deps/http_parser/test.c index e5699aab98..2d1d8bd5da 100644 --- a/deps/http_parser/test.c +++ b/deps/http_parser/test.c @@ -1735,14 +1735,22 @@ main (void) /// REQUESTS - test_simple("hello world", 0); test_simple("GET / HTP/1.1\r\n\r\n", 0); + test_simple("ASDF / HTTP/1.1\r\n\r\n", 0); test_simple("PROPPATCHA / HTTP/1.1\r\n\r\n", 0); test_simple("GETA / HTTP/1.1\r\n\r\n", 0); + // Well-formed but incomplete + test_simple("GET / HTTP/1.1\r\n" + "Content-Type: text/plain\r\n" + "Content-Length: 6\r\n" + "\r\n" + "fooba", + 0); + static const char *all_methods[] = { "DELETE", "GET", |