Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Accept HTTP/0.9 responses
Browse files Browse the repository at this point in the history
  • Loading branch information
felixge authored and ry committed Nov 22, 2011
1 parent f1d48aa commit 2498961
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion http_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
18 changes: 17 additions & 1 deletion test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2498961

Please sign in to comment.