Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite multipart boundary detection #7728

Merged
merged 3 commits into from
Nov 29, 2020

Conversation

earlephilhower
Copy link
Collaborator

@earlephilhower earlephilhower commented Nov 28, 2020

Use a simpler, cleaner implementation of multipart form detection as
defined in https://tools.ietf.org/html/rfc7578 .

Implements a simple state machine that detects the \r\n--<boundary>
stream in input a character at a time, instead of buffering and
comparing in chunks which can miss things due to alignment issues and
which also had a problem with replacing characters in a binary stream.

Fixes #7723

Use a simpler, cleaner implementation of multipart form detection as
defined in https://tools.ietf.org/html/rfc7578 .

Implements a simple state machine that detects the \r\n--<boundary>
stream in input a character at a time, instead of buffering and
comparing in chunks which can miss things due to alignment issues and
which also had a problem with replacing characters in a binary stream.

Fixes esp8266#7723
@earlephilhower
Copy link
Collaborator Author

@luc-github can you please test this with your failing forms and report back?

Using FSBrowser and your binaries, it works correctly, but I don't have any other handy multipart form apps to test against.

@luc-github
Copy link
Contributor

ok I will test when back home and report results

thank you

@luc-github
Copy link
Contributor

I can confirm the PR fix the issue - I have tested with my application ESP3D and now index.html.gz is properly expanded after upload - which confirm no more corruption during upload

Thank you for the fix

Adjust the private _uploadReadByte function to return -1 on error (like
a read()), and the main file upload handler to use that return value
instead of duplicating logic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

https://github.com/esp8266/Arduino/pull/7543 corrupt binary upload like index.html.gz
3 participants