Redirect on upload from file causes IO error from file being closed · Issue #5530 · aio-libs/aiohttp · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🐞 Describe the bug
As seen from #1907, aiohttp takes ownership of passed files and closes them after writing. However, in the case of a 302 redirect, where I assume that aiohttp is re-performing the request, it attempts to re-read the data from the closed file.
This appears to be pretty difficult to do correctly.
Currently the file gets closed when the connection is closed.
I was hoping we could use expect100 as some kind of solution, but this doesn't resolve the problem and reveals a limitation on the server-side:
The server-side code doesn't have an easy way to send the 302 without first sending a 100-Continue (maybe you can use a custom expect handler, but it would then need to know about all your endpoints, in order to know whether they can be resolved without further data. Maybe we could improve this somehow to only send 100-Continue when a handler tries to read the body?).
🐞 Describe the bug
As seen from #1907,
aiohttp
takes ownership of passed files and closes them after writing. However, in the case of a 302 redirect, where I assume thataiohttp
is re-performing the request, it attempts to re-read the data from the closed file.💡 To Reproduce
Client code:
Server code:
💡 Expected behavior
Successful PUT upload (or to not follow redirects and return a 302 response).
📋 Logs/tracebacks
📋 Your version of the Python
📋 Your version of the aiohttp/yarl/multidict distributions
📋 Additional context
Relates to the client aspect of aiohttp.
The text was updated successfully, but these errors were encountered: