Skip to content

Commit 2504bcd

Browse files
authored
Merge pull request #18 from Sojourneer/master
Fixed chunk size formatting
2 parents 7da5f67 + 7a9cc78 commit 2504bcd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/WebResponses.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,15 +388,15 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
388388
_packet.clear();
389389
goto content_abort;
390390
}
391-
// HTTP 1.1 allows leading zeros in chunk length. Or spaces may be added.
391+
// HTTP 1.1 allows leading zeros in chunk length. Trailing spaces breaks http-proxy.
392392
// See RFC2616 sections 2, 3.6.1.
393393
readLen = _fillBufferAndProcessTemplates((uint8_t*) (_packet.data() + 6), _packet.size() - 8);
394394
if(readLen == RESPONSE_TRY_AGAIN){
395395
_packet.clear();
396396
goto content_abort;
397397
}
398-
outLen = sprintf((char*)_packet.data(), "%x", readLen);
399-
while(outLen < 4) _packet[outLen++] = ' ';
398+
outLen = sprintf((char*)_packet.data(), "%04x", readLen);
399+
//while(outLen < 4) _packet[outLen++] = ' ';
400400
_packet[outLen++] = '\r';
401401
_packet[outLen++] = '\n';
402402
outLen += readLen;

0 commit comments

Comments
 (0)