Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Fix RFC 7230 violation #1301

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/WebResponses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,14 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
size_t readLen = 0;

if(_chunked){
// HTTP 1.1 allows leading zeros in chunk length. Or spaces may be added.
// HTTP 1.1 allows leading zeros in chunk length.
// See RFC2616 sections 2, 3.6.1.
readLen = _fillBufferAndProcessTemplates(buf+headLen+6, outLen - 8);
if(readLen == RESPONSE_TRY_AGAIN){
free(buf);
return 0;
}
outLen = sprintf((char*)buf+headLen, "%x", readLen) + headLen;
while(outLen < headLen + 4) buf[outLen++] = ' ';
outLen = sprintf((char*)buf+headLen, "%04x", readLen) + headLen;
buf[outLen++] = '\r';
buf[outLen++] = '\n';
outLen += readLen;
Expand Down