Skip to content

Commit 2a2b664

Browse files
authored
Fix llhttp parser issues with closed connections (#3010)
* Do not re-initialise llhttp parser with client connection * Set parser.data in `BasicHttpHeaders::parse`
1 parent d67963b commit 2a2b664

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

Sming/Components/Network/src/Network/Http/BasicHttpHeaders.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ HttpError BasicHttpHeaders::parse(char* data, size_t len, http_parser_type type)
4242
return HttpError(HTTP_PARSER_ERRNO(&parser));
4343
#else
4444
llhttp_init(&parser, type, &parserSettings);
45+
parser.data = this;
4546
return HttpError(llhttp_execute(&parser, data, len));
4647
#endif
4748
}

Sming/Components/Network/src/Network/Http/HttpClientConnection.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@ class HttpClientConnection : public HttpConnection
8686
{
8787
if(err == ERR_OK) {
8888
state = eHCS_Ready;
89+
#ifdef USE_LEGACY_HTTP_PARSER
8990
init(HTTP_RESPONSE);
91+
#endif
9092
}
9193

9294
return HttpConnection::onConnected(err);

0 commit comments

Comments
 (0)