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

Don't work "multipart/form-data" file upload. #490

Closed
Cykooz opened this issue Sep 3, 2015 · 5 comments
Closed

Don't work "multipart/form-data" file upload. #490

Cykooz opened this issue Sep 3, 2015 · 5 comments
Labels

Comments

@Cykooz
Copy link
Member

Cykooz commented Sep 3, 2015

Example for reproduce my case:

import asyncio
import aiohttp  # version 0.17.3
import io

data = {'file': io.BytesIO(b'some buffer')}
url = 'http://requestb.in/pdt7vypd'
f = aiohttp.request('post', url, data=data)
asyncio.get_event_loop().run_until_complete(f)

After running this code "RequestBin" has the following data:

multipart/form-data; boundary="22335db0b3594db981b72bd5d424c366"
0 bytes 

HEADERS

Via: 1.1 vegur
Connection: close
Total-Route-Time: 0
Accept: */*
Connect-Time: 13
X-Request-Id: 50f58dd3-3d12-4e72-a3f4-92c64fac1cdd
Accept-Encoding: gzip, deflate
Transfer-Encoding: chunked
Content-Type: multipart/form-data; boundary="22335db0b3594db981b72bd5d424c366"
User-Agent: Python/3.4 aiohttp/0.17.3
Host: requestb.in

FORM/POST PARAMETERS
None 

RAW BODY
None

It looks as if the server received a request with an empty body. 'Content-Length' header is not present at all.

@asvetlov
Copy link
Member

I don't follow.

The test is passed. How to reproduce your issue?

@Cykooz
Copy link
Member Author

Cykooz commented Sep 11, 2015

To reproduce:

  • go to http://requestb.in/;
  • press "Create a RequestBin" and copy link at the top-right corner;
  • run shell of python3 with installed aiohttp;
  • execute my example code from first post.

Also you can make simple page with the form for file upload (without CSRF-protection) using Django.

@Cykooz
Copy link
Member Author

Cykooz commented Sep 14, 2015

I think that this problem is because of http://requestb.in and Django require to specify Content-Length for the whole request. :(

@kxepal
Copy link
Member

kxepal commented Sep 14, 2015

That's my lovely issue with multipart (: Seems like it won't be fixed for Django in nearest future.

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants