Prevously, it would only do that when the first byte of the next response was received.
This prevents wasting memory when no response is being parsed.
*/
switch (parser->state) {
case HTTP_RESPONSE_PARSE_STATE_INIT:
- http_response_parser_restart(parser);
parser->state = HTTP_RESPONSE_PARSE_STATE_VERSION;
/* fall through */
case HTTP_RESPONSE_PARSE_STATE_VERSION:
return ret;
}
+ if (parser->state == HTTP_RESPONSE_PARSE_STATE_INIT)
+ http_response_parser_restart(parser);
+
/* RFC 7230, Section 3:
HTTP-message = start-line