Skip to content

Commit

Permalink
Merge pull request #10724 from socram8888/fix-web-raw-timeout
Browse files Browse the repository at this point in the history
Cap size of last chunk in raw read in WebServer
  • Loading branch information
me-no-dev authored Dec 14, 2024
2 parents 740fc0b + 8b77d91 commit 64b62dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libraries/WebServer/src/Parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ bool WebServer::_parseRequest(NetworkClient &client) {
_currentRaw->status = RAW_WRITE;

while (_currentRaw->totalSize < _clientContentLength) {
_currentRaw->currentSize = client.readBytes(_currentRaw->buf, HTTP_RAW_BUFLEN);
size_t read_len = std::min(_clientContentLength - _currentRaw->totalSize, (size_t)HTTP_RAW_BUFLEN);
_currentRaw->currentSize = client.readBytes(_currentRaw->buf, read_len);
_currentRaw->totalSize += _currentRaw->currentSize;
if (_currentRaw->currentSize == 0) {
_currentRaw->status = RAW_ABORTED;
Expand Down

0 comments on commit 64b62dc

Please sign in to comment.