aboutsummaryrefslogtreecommitdiff
path: root/zenhttp/httpasio.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2022-02-04 11:21:05 +0100
committerMartin Ridgers <[email protected]>2022-02-04 11:21:35 +0100
commit0600246747f44d8731283982933bf95dd9dfaf95 (patch)
treee78e51255d75d064fb7e1ac1f858175f51e94ffb /zenhttp/httpasio.cpp
parentFixed bug adding endpoint with no URL. (diff)
downloadzen-0600246747f44d8731283982933bf95dd9dfaf95.tar.xz
zen-0600246747f44d8731283982933bf95dd9dfaf95.zip
Close connection if HTTP header parsing failed
Diffstat (limited to 'zenhttp/httpasio.cpp')
-rw-r--r--zenhttp/httpasio.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/zenhttp/httpasio.cpp b/zenhttp/httpasio.cpp
index 55ce867a4..318f47eff 100644
--- a/zenhttp/httpasio.cpp
+++ b/zenhttp/httpasio.cpp
@@ -634,12 +634,11 @@ HttpRequest::ConsumeData(const char* InputData, size_t DataSize)
{
const size_t ConsumedBytes = http_parser_execute(&m_Parser, &s_ParserSettings, InputData, DataSize);
- if (m_Parser.http_errno)
+ if (m_Parser.http_errno && m_Parser.http_errno != HPE_INVALID_EOF_STATE)
{
- ZEN_WARN("HTTP parser error {}", (uint32_t)m_Parser.http_errno);
-
- // TODO: we need to kill the connection since we're most likely
- // out of sync and can't make progress
+ ZEN_WARN("HTTP parser error {}. Closing connection", (uint32_t)m_Parser.http_errno);
+ TerminateConnection();
+ return DataSize;
}
return ConsumedBytes;