File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
libraries/ESP8266httpClient/src Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -386,6 +386,9 @@ int httpClient::handleHeaderResponse() {
386386 return HTTPC_ERROR_NOT_CONNECTED;
387387 }
388388
389+ _returnCode = -1 ;
390+ _size = -1 ;
391+
389392 while (connected ()) {
390393 size_t len = _tcp->available ();
391394 if (len > 0 ) {
@@ -421,7 +424,12 @@ int httpClient::handleHeaderResponse() {
421424 if (_size) {
422425 DEBUG_HTTPCLIENT (" [HTTP-Client][handleHeaderResponse] size: %d\n " , _size);
423426 }
424- return _returnCode;
427+ if (_returnCode) {
428+ return _returnCode;
429+ } else {
430+ DEBUG_HTTPCLIENT (" [HTTP-Client][handleHeaderResponse] Remote host is not an HTTP Server!" );
431+ return HTTPC_ERROR_NO_HTTP_SERVER;
432+ }
425433 }
426434
427435 } else {
Original file line number Diff line number Diff line change 4040#define HTTPC_ERROR_NOT_CONNECTED (-4 )
4141#define HTTPC_ERROR_CONNECTION_LOST (-5 )
4242#define HTTPC_ERROR_NO_STREAM (-6 )
43+ #define HTTPC_ERROR_NO_HTTP_SERVER (-7 )
4344
4445
4546class httpClient {
You can’t perform that action at this time.
0 commit comments