From 887bdef1cdbc8d12030fe52407d570ebf846ba6b Mon Sep 17 00:00:00 2001 From: 1618033 Date: Tue, 29 Nov 2022 19:19:46 -0600 Subject: [PATCH] Fix "blank new line in chunk" bug If a chunk contains an empty line ("\r\n") chunkLength will be 0 and _setReadyState(readyStateDone) will be called, resulting in truncated payloads. We actually need to wait for "0\r\n" to set state as done. --- src/AsyncHTTPRequest_Impl_Generic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AsyncHTTPRequest_Impl_Generic.h b/src/AsyncHTTPRequest_Impl_Generic.h index af1d43dd..623547e9 100644 --- a/src/AsyncHTTPRequest_Impl_Generic.h +++ b/src/AsyncHTTPRequest_Impl_Generic.h @@ -1448,7 +1448,7 @@ void AsyncHTTPRequest::_processChunks() size_t chunkLength = strtol(chunkHeader.c_str(), nullptr, 16); _contentLength += chunkLength; - if (chunkLength == 0) + if (chunkHeader == "0\r\n") { char* connectionHdr = respHeaderValue("connection");