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

multipart/form-data must use CRLF line breaks #1395

Merged
merged 1 commit into from Oct 14, 2021

Conversation

kalekseev
Copy link
Contributor

@kalekseev kalekseev commented Oct 11, 2021

Fixes #1313
Environment.NewLine equals \n on unix like systems that leads to invalid payload with LF line breaks:

--define a custom boundary here<LF>
Content-Disposition: form-data; name="images"; filename="image0.png"<LF>
Content-Type: image/png<CRLF>
...

From https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html

The boundary must be followed immediately either by another CRLF and the header fields for the next part, or by two CRLFs, in which case there are no header fields for the next part (and it is therefore assumed to be of Content-Type text/plain).

@cartermp
Copy link
Collaborator

I think this looks sensible. @baronfel, since you added the feature, any concerns?

@baronfel
Copy link
Contributor

None at all, excellent spot @kalekseev

Copy link
Collaborator

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kalekseev

@cartermp cartermp merged commit 9665fc3 into fsprojects:main Oct 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-Part HTTP Request Body on Linux
3 participants