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

Issue with lowercase content-disposition in multipart form #765

Closed
pmorenov opened this issue May 1, 2020 · 9 comments
Closed

Issue with lowercase content-disposition in multipart form #765

pmorenov opened this issue May 1, 2020 · 9 comments

Comments

@pmorenov
Copy link

pmorenov commented May 1, 2020

Issue Info

Platform Name - flutter
Platform version - 1.12.13+hotfix.9
Dio Version - 3.0.9

Issue Description and Steps

I have a form multipart request that fails in the server with a 400 (Unable to get name from form-data). I've found the root cause:

The body contains the parts separated by 'boundaries':

----dio-boundary-1767347126
content-disposition: form-data; name="message"

The message
----dio-boundary-1767347126
content-disposition: form-data; name="callback"

false
----dio-boundary-1767347126--

Probably related to issue 641, the 'content-disposition' tags are sent in lowercase.

Inspecting this request with CharlesProxy and changing content-disposition to Content-Disposition results in the server returning a 200 as expected.

So the body should be:

----dio-boundary-1767347126
Content-Disposition: form-data; name="message"

The message
----dio-boundary-1767347126
Content-Disposition: form-data; name="preferCallBack"

false
----dio-boundary-1767347126--

@pmorenov
Copy link
Author

pmorenov commented May 1, 2020

The Mulesoft backend I'm working with expects 'Content-Disposition' to extract the fields:
https://help.mulesoft.com/s/article/Attachments-being-lost-in-a-Multipart-Mixed

pmorenov pushed a commit to pmorenov/dio that referenced this issue May 3, 2020
Prefer uppercase, as some backends fail to auto-extract fields if the header is sent in lowercase.

https://tools.ietf.org/id/draft-ietf-appsawg-multipart-form-data-04.html#rfc.section.5.2

Fixes cfug#765
pmorenov pushed a commit to pmorenov/dio that referenced this issue May 4, 2020
Prefer 'Content-Disposition' over 'content-disposition'

Prefer 'Content-Type' over 'content-type'

Prefer 'Content-Transfer-Encoding' over 'content-transfer-encoding'

Some backends fail to auto-extract fields if the field headers are sent in lowercase.

https://tools.ietf.org/id/draft-ietf-appsawg-multipart-form-data-04.html#rfc.section.5.2

Fixes cfug#765
@shaxxx
Copy link

shaxxx commented May 18, 2020

Possible duplicate of #641

1 similar comment
@shaxxx
Copy link

shaxxx commented May 18, 2020

Possible duplicate of #641

@stale
Copy link

stale bot commented Jun 17, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

@stale stale bot added the stale label Jun 17, 2020
@pmorenov
Copy link
Author

Still an issue, please check the linked PR for a fix.

@stale stale bot removed the stale label Jun 20, 2020
@stale
Copy link

stale bot commented Jul 20, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

@stale stale bot added the stale label Jul 20, 2020
@stale stale bot closed this as completed Jul 27, 2020
@abdulrojak288
Copy link

I got the same problem, is there a solution?

@abdulrojak288
Copy link

Still an issue, please check the linked PR for a fix.

I got the same problem, is there a solution?

@orzzp
Copy link

orzzp commented Mar 25, 2022

I got the same problem, is there a solution?

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 a pull request may close this issue.

4 participants