From 2498961231853311675d6e3bcf4f5c988b15ed4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?= Date: Tue, 22 Nov 2011 21:23:15 +0100 Subject: [PATCH] Accept HTTP/0.9 responses See joyent/node#1711 --- http_parser.c | 2 +- test.c | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/http_parser.c b/http_parser.c index 1fb7c20..bbeceb0 100644 --- a/http_parser.c +++ b/http_parser.c @@ -515,7 +515,7 @@ size_t http_parser_execute (http_parser *parser, break; case s_res_first_http_major: - if (ch < '1' || ch > '9') { + if (ch < '0' || ch > '9') { SET_ERRNO(HPE_INVALID_VERSION); goto error; } diff --git a/test.c b/test.c index 7d95b0e..6af0e78 100644 --- a/test.c +++ b/test.c @@ -1041,8 +1041,24 @@ const struct message responses[] = ,.body= "" } - +#define HTTP_VERSION_0_9 12 +/* Should handle HTTP/0.9 */ +, {.name= "http version 0.9" + ,.type= HTTP_RESPONSE + ,.raw= "HTTP/0.9 200 OK\r\n" + "\r\n" + ,.should_keep_alive= FALSE + ,.message_complete_on_eof= TRUE + ,.http_major= 0 + ,.http_minor= 9 + ,.status_code= 200 + ,.num_headers= 0 + ,.headers= + {} + ,.body= "" + } , {.name= NULL } /* sentinel */ + }; int