Fix unhandled content issue
This commit is contained in:
parent
12be39c747
commit
2af6556748
10
src/http.c
10
src/http.c
|
@ -273,8 +273,9 @@ http_10_parse_header(char *data, int32_t *p_size, AislStream stream)
|
|||
*p_size -= size;
|
||||
return HTTP_PARSER_SUCCESS;
|
||||
} else if (newline == key || (newline == key+1 && *key == '\r')) {
|
||||
*p_size -= size;
|
||||
return (aisl_stream_set_end_of_headers(stream) == 0) ?
|
||||
HTTP_PARSER_READY : HTTP_PARSER_SUCCESS;
|
||||
HTTP_PARSER_SUCCESS : HTTP_PARSER_READY;
|
||||
}
|
||||
return HTTP_PARSER_ERROR;
|
||||
}
|
||||
|
@ -283,7 +284,12 @@ http_10_parse_header(char *data, int32_t *p_size, AislStream stream)
|
|||
ParserStatus
|
||||
http_10_parse_body(char *data, int32_t *p_size, AislStream stream)
|
||||
{
|
||||
switch (aisl_stream_set_body(stream, data, *p_size)) {
|
||||
int32_t size = *p_size;
|
||||
|
||||
if (!size)
|
||||
return HTTP_PARSER_HUNGRY;
|
||||
|
||||
switch (aisl_stream_set_body(stream, data, size)) {
|
||||
case 0:
|
||||
return HTTP_PARSER_READY;
|
||||
case -1:
|
||||
|
|
|
@ -168,6 +168,7 @@ aisl_stream_set_end_of_headers(AislStream stream)
|
|||
} else {
|
||||
result = 2;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -180,6 +181,8 @@ aisl_stream_set_body(AislStream stream, const char *data, int32_t size)
|
|||
if (!(stream->content_length < size)) {
|
||||
struct aisl_evt_input on_input;
|
||||
|
||||
stream->content_length -= size;
|
||||
|
||||
if (stream->content_length == 0) {
|
||||
stream->state = AISL_STREAM_STATE_READY;
|
||||
result = 0;
|
||||
|
@ -188,7 +191,7 @@ aisl_stream_set_body(AislStream stream, const char *data, int32_t size)
|
|||
}
|
||||
|
||||
on_input.evt.code = AISL_EVENT_STREAM_INPUT;
|
||||
on_input.evt.source = (void *) stream;
|
||||
on_input.evt.source = (void *)stream;
|
||||
on_input.evt.status = AISL_SUCCESS;
|
||||
on_input.data = data;
|
||||
on_input.size = size;
|
||||
|
@ -358,6 +361,7 @@ aisl_response(AislStream stream, AislHttpResponse rs_code, uint64_t c_len)
|
|||
return AISL_MALLOC_ERROR;
|
||||
|
||||
stream->head_offset = l;
|
||||
stream->body_offset = l;
|
||||
stream->state = AISL_STREAM_STATE_SEND_HEADER;
|
||||
|
||||
return AISL_SUCCESS;
|
||||
|
|
Loading…
Reference in New Issue