|
|
|
@ -1491,6 +1491,13 @@ request_url_cb (http_parser *p, const char *buf, size_t len)
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
status_complete_cb (http_parser *p) {
|
|
|
|
|
assert(p == parser);
|
|
|
|
|
p->data++;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
header_field_cb (http_parser *p, const char *buf, size_t len)
|
|
|
|
|
{
|
|
|
|
@ -3089,6 +3096,20 @@ create_large_chunked_message (int body_size_in_kb, const char* headers)
|
|
|
|
|
return buf;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
test_status_complete (void)
|
|
|
|
|
{
|
|
|
|
|
parser_init(HTTP_RESPONSE);
|
|
|
|
|
parser->data = 0;
|
|
|
|
|
http_parser_settings settings = settings_null;
|
|
|
|
|
settings.on_status_complete = status_complete_cb;
|
|
|
|
|
|
|
|
|
|
char *response = "don't mind me, just a simple response";
|
|
|
|
|
http_parser_execute(parser, &settings, response, strlen(response));
|
|
|
|
|
assert(parser->data == (void*)0); // the status_complete callback was never called
|
|
|
|
|
assert(parser->http_errno == HPE_INVALID_CONSTANT); // the errno for an invalid status line
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Verify that we can pause parsing at any of the bytes in the
|
|
|
|
|
* message and still get the result that we're expecting. */
|
|
|
|
|
void
|
|
|
|
@ -3396,6 +3417,8 @@ main (void)
|
|
|
|
|
, &requests[CONNECT_REQUEST]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
test_status_complete();
|
|
|
|
|
|
|
|
|
|
puts("requests okay");
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|