Skip to content

Commit 7d78247

Browse files
Jeroen88me-no-dev
Jeroen88
authored andcommitted
Fix persistance issue found, see ESP8266 issue #6152 (#2851)
1 parent 89feacb commit 7d78247

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

libraries/HTTPClient/src/HTTPClient.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,8 @@ int HTTPClient::handleHeaderResponse()
10801080
return HTTPC_ERROR_NOT_CONNECTED;
10811081
}
10821082

1083+
_canReuse = !_useHTTP10;
1084+
10831085
String transferEncoding;
10841086
_returnCode = -1;
10851087
_size = -1;
@@ -1098,6 +1100,7 @@ int HTTPClient::handleHeaderResponse()
10981100

10991101
if(headerLine.startsWith("HTTP/1.")) {
11001102
_returnCode = headerLine.substring(9, headerLine.indexOf(' ', 9)).toInt();
1103+
_canReuse = (_returnCode != '0');
11011104
} else if(headerLine.indexOf(':')) {
11021105
String headerName = headerLine.substring(0, headerLine.indexOf(':'));
11031106
String headerValue = headerLine.substring(headerLine.indexOf(':') + 1);

libraries/HTTPClient/src/HTTPClient.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class HTTPClient
217217
String _host;
218218
uint16_t _port = 0;
219219
int32_t _connectTimeout = -1;
220-
bool _reuse = false;
220+
bool _reuse = true;
221221
uint16_t _tcpTimeout = HTTPCLIENT_DEFAULT_TCP_TIMEOUT;
222222
bool _useHTTP10 = false;
223223
bool _secure = false;

0 commit comments

Comments
 (0)