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;
|
*p_size -= size;
|
||||||
return HTTP_PARSER_SUCCESS;
|
return HTTP_PARSER_SUCCESS;
|
||||||
} else if (newline == key || (newline == key+1 && *key == '\r')) {
|
} else if (newline == key || (newline == key+1 && *key == '\r')) {
|
||||||
|
*p_size -= size;
|
||||||
return (aisl_stream_set_end_of_headers(stream) == 0) ?
|
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;
|
return HTTP_PARSER_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +284,12 @@ http_10_parse_header(char *data, int32_t *p_size, AislStream stream)
|
||||||
ParserStatus
|
ParserStatus
|
||||||
http_10_parse_body(char *data, int32_t *p_size, AislStream stream)
|
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:
|
case 0:
|
||||||
return HTTP_PARSER_READY;
|
return HTTP_PARSER_READY;
|
||||||
case -1:
|
case -1:
|
||||||
|
|
|
@ -168,6 +168,7 @@ aisl_stream_set_end_of_headers(AislStream stream)
|
||||||
} else {
|
} else {
|
||||||
result = 2;
|
result = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +181,8 @@ aisl_stream_set_body(AislStream stream, const char *data, int32_t size)
|
||||||
if (!(stream->content_length < size)) {
|
if (!(stream->content_length < size)) {
|
||||||
struct aisl_evt_input on_input;
|
struct aisl_evt_input on_input;
|
||||||
|
|
||||||
|
stream->content_length -= size;
|
||||||
|
|
||||||
if (stream->content_length == 0) {
|
if (stream->content_length == 0) {
|
||||||
stream->state = AISL_STREAM_STATE_READY;
|
stream->state = AISL_STREAM_STATE_READY;
|
||||||
result = 0;
|
result = 0;
|
||||||
|
@ -358,6 +361,7 @@ aisl_response(AislStream stream, AislHttpResponse rs_code, uint64_t c_len)
|
||||||
return AISL_MALLOC_ERROR;
|
return AISL_MALLOC_ERROR;
|
||||||
|
|
||||||
stream->head_offset = l;
|
stream->head_offset = l;
|
||||||
|
stream->body_offset = l;
|
||||||
stream->state = AISL_STREAM_STATE_SEND_HEADER;
|
stream->state = AISL_STREAM_STATE_SEND_HEADER;
|
||||||
|
|
||||||
return AISL_SUCCESS;
|
return AISL_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue