From 7189aa6cee7cd16ea00d88826db9a80595e8056f Mon Sep 17 00:00:00 2001 From: mayankgour13 <36739521+mayankgour13@users.noreply.github.com> Date: Tue, 14 Aug 2018 04:09:28 +0530 Subject: [PATCH] Infinite loop while passing File(FS.h) resolved 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 28a3503484..f8fdc2f963 100644 --- a/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp +++ b/libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp @@ -523,7 +523,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();