|
|
@ -65,7 +65,7 @@ static int unhex[] = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
|
|
|
parser->version_major = 0; \
|
|
|
|
parser->version_major = 0; \
|
|
|
|
parser->version_minor = 0; \
|
|
|
|
parser->version_minor = 0; \
|
|
|
|
parser->number_of_headers = 0; \
|
|
|
|
parser->number_of_headers = 0; \
|
|
|
|
parser->keep_alive = 0; \
|
|
|
|
parser->keep_alive = -1; \
|
|
|
|
parser->content_length = 0; \
|
|
|
|
parser->content_length = 0; \
|
|
|
|
parser->body_read = 0;
|
|
|
|
parser->body_read = 0;
|
|
|
|
|
|
|
|
|
|
|
@ -146,16 +146,18 @@ do { \
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
action headers_complete {
|
|
|
|
action headers_complete {
|
|
|
|
if(parser->on_headers_complete)
|
|
|
|
if(parser->on_headers_complete) {
|
|
|
|
callback_return_value = parser->on_headers_complete(parser);
|
|
|
|
callback_return_value = parser->on_headers_complete(parser);
|
|
|
|
if (callback_return_value != 0) fbreak;
|
|
|
|
if (callback_return_value != 0) fbreak;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
action begin_message {
|
|
|
|
action begin_message {
|
|
|
|
if(parser->on_message_begin)
|
|
|
|
if(parser->on_message_begin) {
|
|
|
|
callback_return_value = parser->on_message_begin(parser);
|
|
|
|
callback_return_value = parser->on_message_begin(parser);
|
|
|
|
if (callback_return_value != 0) fbreak;
|
|
|
|
if (callback_return_value != 0) fbreak;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
action content_length {
|
|
|
|
action content_length {
|
|
|
|
parser->content_length *= 10;
|
|
|
|
parser->content_length *= 10;
|
|
|
@ -401,18 +403,16 @@ http_parser_has_error (http_parser *parser)
|
|
|
|
return parser->cs == http_parser_error;
|
|
|
|
return parser->cs == http_parser_error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
int
|
|
|
|
int
|
|
|
|
http_should_keep_alive (http *request)
|
|
|
|
http_parser_should_keep_alive (http_parser *parser)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (request->keep_alive == -1)
|
|
|
|
if (parser->keep_alive == -1)
|
|
|
|
if (request->version_major == 1)
|
|
|
|
if (parser->version_major == 1)
|
|
|
|
return (request->version_minor != 0);
|
|
|
|
return (parser->version_minor != 0);
|
|
|
|
else if (request->version_major == 0)
|
|
|
|
else if (parser->version_major == 0)
|
|
|
|
return FALSE;
|
|
|
|
return FALSE;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
return TRUE;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return request->keep_alive;
|
|
|
|
return parser->keep_alive;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|