-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
TimeoutError instead of 403 "Forbidden" in case of not corresponding content length #8382
Comments
This is on making a request. Why do you think it's an issue with aiohttp? As far as I can see from your example, the server is not responding. If that's really the expected format of a request (which seems weird to me), then surely the issue is with the server. But, I'd expect any HTTP server to respond that way, i.e. if the Content-Length is longer than the data you sent, then it should continue waiting for the rest of the data. How would the server know when the data has finished being sent otherwise? |
When I am making exactly the same request, using |
What's the URL? The most common difference from those libraries is that URLs get encoded, so if you have query params they should be passed with the That might explain the different response, if you are actually requesting a different path. |
@Dreamsorcerer Thank you for your response. X-Amz-Security-Token
X-Amz-Algorithm
X-Amz-Date
X-Amz-SignedHeaders
X-Amz-Expires and so on and I get an already composed url with all params. I have wrapped the url by from yarl import URL
url = URL(url, encoded=True) but it still raises timeout. |
If this is still an issue with the latest release, then we need a reproducer that we can easily execute in order to investigate further. As mentioned before, the description of the problem just sounds like you're sending an invalid HTTP request where the expected behaviour is for the server to wait indefinitely for data your failing to send. So, without a reproducer there's no way we can guess what is going on here. |
Describe the bug
I use aiohttp to upload a file to an AWS S3 bucket using a pre-signed URL.
The header of the PUT request has a
Content-Length
parameter. If the length specified in the header differs from the actual length of the data being sent, it will cause aTimeoutError
instead of returning a403 "Forbidden" SignatureDoesNotMatch
In my case, these values can be different because the value in the headers is taken from metadata calculated in a different system. Sending it in the headers is necessary to perform validation.
To Reproduce
Expected behavior
Return response with
403 "Forbidden"
instead of raising TimeoutErrorLogs/tracebacks
Python Version
Python 3.11.6
aiohttp Version
multidict Version
yarl Version
OS
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
Related component
Client
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: