Skip to content

Commit b42f5a4

Browse files
author
Jeroen88
committed
Solve HTTP1.1 persistance issue #6152
1 parent 9600f3e commit b42f5a4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,8 @@ int HTTPClient::handleHeaderResponse()
12481248
return HTTPC_ERROR_NOT_CONNECTED;
12491249
}
12501250

1251+
_canReuse = !_useHTTP10;
1252+
12511253
String transferEncoding;
12521254
_returnCode = -1;
12531255
_size = -1;
@@ -1266,6 +1268,7 @@ int HTTPClient::handleHeaderResponse()
12661268

12671269
if(headerLine.startsWith("HTTP/1.")) {
12681270
_returnCode = headerLine.substring(9, headerLine.indexOf(' ', 9)).toInt();
1271+
_canReuse = (_returnCode != '0');
12691272
} else if(headerLine.indexOf(':')) {
12701273
String headerName = headerLine.substring(0, headerLine.indexOf(':'));
12711274
String headerValue = headerLine.substring(headerLine.indexOf(':') + 1);

libraries/ESP8266HTTPClient/src/ESP8266HTTPClient.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class HTTPClient
235235
/// request handling
236236
String _host;
237237
uint16_t _port = 0;
238-
bool _reuse = false;
238+
bool _reuse = true;
239239
uint16_t _tcpTimeout = HTTPCLIENT_DEFAULT_TCP_TIMEOUT;
240240
bool _useHTTP10 = false;
241241

0 commit comments

Comments
 (0)