From 4b6f4dfa2912d77bd58e8f386fdbd8bda31766ea Mon Sep 17 00:00:00 2001 From: Sandeep Mistry Date: Fri, 17 Jun 2016 14:37:51 -0400 Subject: [PATCH] Add check for bodyLen in read loop --- examples/SimpleHttpExample/SimpleHttpExample.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/SimpleHttpExample/SimpleHttpExample.ino b/examples/SimpleHttpExample/SimpleHttpExample.ino index dd8cb10..d409b42 100644 --- a/examples/SimpleHttpExample/SimpleHttpExample.ino +++ b/examples/SimpleHttpExample/SimpleHttpExample.ino @@ -6,8 +6,8 @@ // outputs the content to the serial port #include -#include #include +#include // This example downloads the URL "http://arduino.cc/" @@ -82,6 +82,7 @@ void loop() char c; // Whilst we haven't timed out & haven't reached the end of the body while ( (http.connected() || http.available()) && + (bodyLen > 0 || bodyLen != HttpClient::kNoContentLengthHeader) && ((millis() - timeoutStart) < kNetworkTimeout) ) { if (http.available())