Detect errors on EOF

This commit is contained in:
Ryan Dahl
2011-02-04 15:57:09 -08:00
parent fcdbc2629f
commit 1c3624a963
2 changed files with 22 additions and 4 deletions

View File

@@ -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