refactor(FileManager): drop HTTPS support — melody downloads over plain HTTP only

The ESP32 mbedTLS TLS handshake requires ~40KB of contiguous heap, which is
not reliably available after runtime heap fragmentation. Melody .bsm files
carry no credentials so plain HTTP is acceptable.

Removed: WiFiClientSecure, esp_task_wdt WDT disable/re-enable around the GET,
SSL heap guard, and all secureClient cleanup paths. HTTPS URLs are now rejected
immediately with a clear error log (F-027).

Also fixed: ensureDirectoryExists now strips trailing slashes instead of
appending one — SD.exists() returns false for directories when a trailing
slash is present.

Docs: feature-catalog.md F-027 added, FileManager README updated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 10:42:46 +03:00
co-authored by Claude Sonnet 4.6
parent 9f33f90ea9
commit 9e415de7bc
4 changed files with 32 additions and 47 deletions
+17
View File
@@ -36,6 +36,7 @@ Every feature — user-facing or significant internal mechanism — is listed he
| F-024 | V1 playback segment_duration fix (single-segment mode) | v2.0.4 | Stable |
| F-025 | V2 playback command namespace (`playback.play` / `playback.stop`) | v2.0.4 | Stable |
| F-026 | V2 playback `mode` field (`single` / `timed` / `interval` / `infinite`) | v2.0.4 | Stable |
| F-027 | FileManager HTTPS removed — melody downloads over plain HTTP only | v2.0.4 | Stable |
---
@@ -290,6 +291,22 @@ Subsystem: `src/Player/Player.cpp:setMelodyAttributes()`
---
### F-027 — FileManager HTTPS removed — melody downloads over plain HTTP only
`FileManager::downloadFile` no longer supports HTTPS URLs. Any URL starting with `https://` is rejected immediately with an error log.
**Why:** The ESP32's mbedTLS context requires ~40 KB of contiguous heap for the TLS handshake. After the device has been running for a while, heap fragmentation makes this allocation unreliable, causing intermittent download failures. Melody `.bsm` files contain only note sequences and carry no credentials, so plain HTTP is acceptable for this use case.
**What was removed:** `WiFiClientSecure`, the SSL heap guard (`largestBlock < 40000` check), `esp_task_wdt_delete/add` calls around the GET, and all `secureClient` cleanup paths. The `esp_task_wdt` include was also dropped from `FileManager.cpp` and `WiFiClientSecure.h` from `FileManager.hpp`.
**Also fixed in this change:** `ensureDirectoryExists` now strips trailing slashes instead of appending one — `SD.exists()` returns false for directories when a trailing slash is present.
Melody files must be served via plain HTTP. The Firebase Storage URLs (currently used) must be proxied or replaced with an HTTP endpoint before downloads will work.
Subsystem: `src/FileManager/FileManager.cpp`, `src/FileManager/FileManager.hpp`
---
### F-023 — Telemetry bell max load default raised to 500
`bellMaxLoad[i]` initialised to `500` (was `200`). This is the denominator used to calculate bell load percentage in telemetry reports. The old value caused false "overload" warnings on normal use patterns.