fix: use esp_http_client for KOSync to prevent TLS OOM on ESP32-C3
The Arduino WiFiClientSecure allocates 16KB TLS buffers by default, which exhausts the ESP32-C3's limited heap (~46KB free after WiFi) during the TLS handshake. This causes KOReader sync to fail silently or crash on HTTPS servers (including the default sync.koreader.rocks). Replace WiFiClientSecure/HTTPClient with esp_http_client (ESP-IDF), which supports configurable buffer sizes. Use 2KB TLS buffers — more than sufficient for KOSync's tiny JSON payloads (<1KB). Also: - Use esp_crt_bundle for proper TLS certificate verification instead of setInsecure() - Strip trailing slashes from server URL to prevent double-slash in API paths - Add lastHttpCode for diagnostics - Add heap logging to help debug memory issues Fixes #581 (cherry picked from commit 835abc19ff14fcbea8571ccb0dfd8d21e882b84c)
This commit is contained in:
@@ -74,4 +74,7 @@ class KOReaderSyncClient {
|
||||
* Get human-readable error message.
|
||||
*/
|
||||
static const char* errorString(Error error);
|
||||
|
||||
/** HTTP status code from the last request (for diagnostics). */
|
||||
static int lastHttpCode;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user