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

Multiple data parts in multipart/form-data result in empty files/forms #201

Closed
forana opened this issue Jan 2, 2015 · 5 comments
Closed

Comments

@forana
Copy link

forana commented Jan 2, 2015

A POST body with one data part results in HTTP 200 with the expected contents:

--WjbdC_88SpbXfth8mh7N1d6vHDfUQU
Content-Disposition: form-data; name="file"; filename="test1353309547568909113txt"
Content-Type: application/octet-stream

There and Back Again
--WjbdC_88SpbXfth8mh7N1d6vHDfUQU
Content-Disposition: form-data; name="x"

y
--WjbdC_88SpbXfth8mh7N1d6vHDfUQU
Content-Disposition: form-data; name="m1a"

1
--WjbdC_88SpbXfth8mh7N1d6vHDfUQU--

response:

  ...
  "data": "", 
  "files": {
    "file": "There and Back Again"
  }, 
  "form": {
    "m1a": "1", 
    "x": "y"
  }, 
  ...

The same body (different boundary but correct headers) with two added data parts also results in HTTP 200, but with empty members:

--Xya-QurXmcGYKeT0_-hPkzjeGNbmQbYw1numA
Content-Disposition: form-data; name="file"; filename="test6297375454304944471txt"
Content-Type: application/octet-stream

There and Back Again
--Xya-QurXmcGYKeT0_-hPkzjeGNbmQbYw1numA
Content-Disposition: form-data; name="bytes"; filename="bytes"
Content-Type: application/octet-stream

The Talos Mistake
--Xya-QurXmcGYKeT0_-hPkzjeGNbmQbYw1numA
Content-Disposition: form-data; name="stream"; filename="stream"
Content-Type: application/octet-stream

Nerevar, Moon and Star
--Xya-QurXmcGYKeT0_-hPkzjeGNbmQbYw1numA
Content-Disposition: form-data; name="x"

y
--Xya-QurXmcGYKeT0_-hPkzjeGNbmQbYw1numA
Content-Disposition: form-data; name="m1a"

1
--Xya-QurXmcGYKeT0_-hPkzjeGNbmQbYw1numA--

response:

  ...
  "data": "", 
  "files": {}, 
  "form": {}, 
  ...
@forana
Copy link
Author

forana commented Jan 2, 2015

Updated to have a correct multiple-data request (my bad) - the issue still occurs, however.

@forana
Copy link
Author

forana commented Jan 2, 2015

Upon further research this is a duplicate of #102 - not actually related to having multiple files at all. Can be closed.

@forana forana closed this as completed Jan 2, 2015
@piotr-dobrogost
Copy link
Contributor

I think this is not duplicate of issue #102 as that issue is about Transfer-Encoding: chunked whereas this issue is about Content-Type: multipart/*. These are two different things.

@forana
Copy link
Author

forana commented Jan 5, 2015

The actual issue here was the transfer-encoding. I thought it was the number of files, as that was the only difference I could immediately see, but I was able to disprove that by having it work with any number of files so long as the transfer-encoding wasn't chunked. The number of files isn't an issue, after all.

@sigmavirus24
Copy link
Contributor

@piotr-dobrogost @forana this is a known problem with wsgi or werkzeug/flask iirc. I don't believe there are intentions to fix it though.

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

No branches or pull requests

3 participants