Skip to content

Commit 64b62dc

Browse files
authored
Merge pull request #10724 from socram8888/fix-web-raw-timeout
Cap size of last chunk in raw read in WebServer
2 parents 740fc0b + 8b77d91 commit 64b62dc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: libraries/WebServer/src/Parsing.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ bool WebServer::_parseRequest(NetworkClient &client) {
187187
_currentRaw->status = RAW_WRITE;
188188

189189
while (_currentRaw->totalSize < _clientContentLength) {
190-
_currentRaw->currentSize = client.readBytes(_currentRaw->buf, HTTP_RAW_BUFLEN);
190+
size_t read_len = std::min(_clientContentLength - _currentRaw->totalSize, (size_t)HTTP_RAW_BUFLEN);
191+
_currentRaw->currentSize = client.readBytes(_currentRaw->buf, read_len);
191192
_currentRaw->totalSize += _currentRaw->currentSize;
192193
if (_currentRaw->currentSize == 0) {
193194
_currentRaw->status = RAW_ABORTED;

0 commit comments

Comments
 (0)