mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
stream_upload() matches the closing multipart boundary byte by byte. When a byte breaks a partial match, the matched prefix goes to flash as data, and so does the breaking byte, without being compared against the start of the boundary. The boundary starts with "\r\n--", so an image whose last byte is '\r' never completes: that '\r' starts a match, the '\r' of the boundary breaks it and is written as data, and the rest of the boundary no longer matches. The browser waits for a reply that never comes. Flush the matched prefix and look at the breaking byte again from the start of the boundary. A boundary may not contain CR, so no longer suffix of the matched prefix can start a new match.