File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,12 @@ bool WebServer::_parseRequest(NetworkClient &client) {
186186
_currentHandler->raw(*this, _currentUri, *_currentRaw);
187187
_currentRaw->status = RAW_WRITE;
188188

189-
while (_currentRaw->totalSize < _clientContentLength) {
190-
_currentRaw->currentSize = client.readBytes(_currentRaw->buf, HTTP_RAW_BUFLEN);
189+
while (1) {
190+
size_t read_len = std::min(_clientContentLength - _currentRaw->totalSize, (size_t) HTTP_RAW_BUFLEN);
191+
if (read_len == 0) {
192+
break;
193+
}
194+
_currentRaw->currentSize = client.readBytes(_currentRaw->buf, read_len);
191195
_currentRaw->totalSize += _currentRaw->currentSize;
192196
if (_currentRaw->currentSize == 0) {
193197
_currentRaw->status = RAW_ABORTED;

0 commit comments

Comments
 (0)