From 6bd3274d3b79bd576b4660b73129856a2cba4310 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Mon, 15 Jul 2024 10:59:55 +0200 Subject: [PATCH] fix(httpc): Fix data read was less than expected (#10019) --- libraries/HTTPClient/src/HTTPClient.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/HTTPClient/src/HTTPClient.cpp b/libraries/HTTPClient/src/HTTPClient.cpp index b1328c07316..d2722205898 100644 --- a/libraries/HTTPClient/src/HTTPClient.cpp +++ b/libraries/HTTPClient/src/HTTPClient.cpp @@ -1423,7 +1423,7 @@ int HTTPClient::writeToStreamDataBlock(Stream * stream, int size) // some time for the stream delay(1); - int leftBytes = (readBytes - bytesWrite); + int leftBytes = (bytesRead - bytesWrite); // retry to send the missed bytes bytesWrite = stream->write((buff + bytesWrite), leftBytes); @@ -1446,7 +1446,7 @@ int HTTPClient::writeToStreamDataBlock(Stream * stream, int size) // count bytes to read left if(len > 0) { - len -= readBytes; + len -= bytesRead; } delay(0);