Skip to content

Commit 5e3e997

Browse files
authored
Update to ESP8266HTTPClient.cpp for no Content-Length
Response bodies are ignored when _transferEncoding == HTTPC_TE_IDENTITY and there is no Content-Length header. The added code here fixes that issue.
1 parent 5d2563e commit 5e3e997

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,12 @@ int HTTPClient::writeToStream(Stream * stream)
732732
if(ret < 0) {
733733
return returnError(ret);
734734
}
735+
} else if(len == -1 && _client->available() > 0) {
736+
ret = writeToStreamDataBlock(stream, _client->available() > 0);
737+
738+
// have we an error?
739+
if(ret < 0) {
740+
return returnError(ret);
735741
}
736742
} else if(_transferEncoding == HTTPC_TE_CHUNKED) {
737743
int size = 0;

0 commit comments

Comments
 (0)