From 8b1af68e3f996592c4b152e793cde81de4b8957d Mon Sep 17 00:00:00 2001 From: mayankgour13 <36739521+mayankgour13@users.noreply.github.com> Date: Fri, 5 Jul 2019 18:32:01 +0530 Subject: [PATCH] Infinite loop while passing File(FS.h) resolved (#5038) Stream.available() never reaches to -1 which makes it an infinite loop. When File (FS.h) goes empty it reaches to 0 not -1. --- libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp index a7c3fb88a..cab81afde 100644 --- a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp +++ b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp @@ -761,7 +761,7 @@ int HTTPClient::sendRequest(const char * type, Stream * stream, size_t size) if(buff) { // read all data from stream and send it to server - while(connected() && (stream->available() > -1) && (len > 0 || len == -1)) { + while(connected() && (stream->available() > 0) && (len > 0 || len == -1)) { // get available data size int sizeAvailable = stream->available();