1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

Merge branch 'master' into patch-2

This commit is contained in:
probonopd 2016-01-16 22:09:45 +01:00
commit b2a92963d3

View File

@ -193,6 +193,12 @@ void HTTPClient::begin(String host, uint16_t port, String url, bool https, Strin
*/ */
void HTTPClient::end(void) { void HTTPClient::end(void) {
if(connected()) { if(connected()) {
if(_tcp->available() > 0) {
DEBUG_HTTPCLIENT("[HTTP-Client][end] still data in buffer (%d), clean up.\n", _tcp->available());
while(_tcp->available() > 0) {
_tcp->read();
}
}
if(_reuse && _canReuse) { if(_reuse && _canReuse) {
DEBUG_HTTPCLIENT("[HTTP-Client][end] tcp keep open for reuse\n"); DEBUG_HTTPCLIENT("[HTTP-Client][end] tcp keep open for reuse\n");
} else { } else {
@ -711,6 +717,9 @@ bool HTTPClient::connect(void) {
if(connected()) { if(connected()) {
DEBUG_HTTPCLIENT("[HTTP-Client] connect. already connected, try reuse!\n"); DEBUG_HTTPCLIENT("[HTTP-Client] connect. already connected, try reuse!\n");
while(_tcp->available() > 0) {
_tcp->read();
}
return true; return true;
} }