node.js complete on HEAD

27 November 2009
12:50

By cmlenz as Diff

This looks good to me, but doesn't seem to be quite enough

1 diff --git a/deps/http_parser/http_parser.c b/deps/http_parser/http_parser.c
2 index 808d11e..d3f34dd 100644
3 --- a/deps/http_parser/http_parser.c
4 +++ b/deps/http_parser/http_parser.c
5 @@ -1256,21 +1256,21 @@ size_t parse (http_parser *parser, const char *data, size_t len, int start_state
6 }
7
8 parser->body_read = 0;
9
10 CALLBACK2(headers_complete);
11
12 if (parser->flags & F_CHUNKED) {
13 /* chunked encoding - ignore Content-Length header */
14 state = s_chunk_size_start;
15 } else {
16 - if (parser->content_length == 0) {
17 + if (parser->content_length == 0 || parser->method == HTTP_HEAD) {
18 /* Content-Length header given but zero: Content-Length: 0\r\n */
19 CALLBACK2(message_complete);
20 state = NEW_MESSAGE();
21 } else if (parser->content_length > 0) {
22 /* Content-Length header given and non-zero */
23 state = s_body_identity;
24 } else {
25 if (start_state == s_start_req || http_should_keep_alive(parser)) {
26 /* Assume content-length 0 - read the next */
27 CALLBACK2(message_complete);

Download Raw Source

Comments

No comments so far.