From 6db800be0a0519042657dfd9382313015d6abcd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit?= Date: Sun, 13 Feb 2022 16:03:12 +0300 Subject: [PATCH] fixed http.end taking too long http end takes 20-30 seconds if there is a large amount of data replacing this read loop with flush fixes that problem --- libraries/HTTPClient/src/HTTPClient.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libraries/HTTPClient/src/HTTPClient.cpp b/libraries/HTTPClient/src/HTTPClient.cpp index 86204c4b7a5..beba7dce06d 100644 --- a/libraries/HTTPClient/src/HTTPClient.cpp +++ b/libraries/HTTPClient/src/HTTPClient.cpp @@ -386,9 +386,7 @@ void HTTPClient::disconnect(bool preserveClient) if(connected()) { if(_client->available() > 0) { log_d("still data in buffer (%d), clean up.\n", _client->available()); - while(_client->available() > 0) { - _client->read(); - } + _client->flush(); } if(_reuse && _canReuse) {