From 54a6ef2ffa3f002381eed83fc7b3c3085fc3fe87 Mon Sep 17 00:00:00 2001 From: alexbadger Date: Mon, 28 Mar 2022 22:45:47 +1100 Subject: [PATCH 1/2] Improve stability of library When data is not correctly read by the browser, the SSL_read appears to keep the data in buffer and eventually causes a Core 0 panic'ed. Checking if there is further data to be read and reading this data clears the buffer and stops the crash. --- src/HTTPConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HTTPConnection.cpp b/src/HTTPConnection.cpp index e26a846..eb7ae69 100644 --- a/src/HTTPConnection.cpp +++ b/src/HTTPConnection.cpp @@ -149,7 +149,7 @@ void HTTPConnection::closeConnection() { * This method will try to fill up the buffer with data from */ int HTTPConnection::updateBuffer() { - if (!isClosed()) { + if (!isClosed()||canReadData()) { // If there is buffer data that has been marked as processed. // Some example is shown here: From 4966e3a3648b9fa3d93dc3d34de9c53f6ac4688f Mon Sep 17 00:00:00 2001 From: singlefile Date: Tue, 29 Mar 2022 09:34:47 +1100 Subject: [PATCH 2/2] Fix compiler error with SHA crypto for ESP32 --- src/HTTPConnection.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/HTTPConnection.hpp b/src/HTTPConnection.hpp index fb15d7a..f3a3375 100644 --- a/src/HTTPConnection.hpp +++ b/src/HTTPConnection.hpp @@ -6,7 +6,11 @@ #include #include +#ifdef ESP32 +#include +#else #include +#endif #include // Required for sockets