mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-09-02 15:02:51 +08:00
A firmware image cannot be buffered whole, so the upload is streamed to flash, and stream_upload() already resumes across TCP segments. The multipart preamble did not: handle_post() walked the part headers from the start of whichever segment it held, so a client that split inside the octet-stream part header lost its place, never started streaming, and the request hung. Firefox splits exactly there, right after filename=". Buffer the multipart body only until the octet-stream part header is complete, locate the payload, then stream from that point; later segments stream as before. The header reuses the configuration buffer, which is idle during a firmware upload, so no extra memory is needed.