mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-27 21:16:50 +03:00
fix #1368
This commit is contained in:
parent
54b16b19b7
commit
fb55e91118
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user