-
-
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
There should be an exception in a case of "too many redirects" #2631
Comments
Google chrome gets
I think the same behavior in aiohttp makes sense. |
Hi, i did some reading: I think this kind of exception should be excpeted with 421 Misdirected Request: Maybe even to throw: Because in the end the "client/agent" did not "found" the resource in the end, right? This is problem of Recursion: https://en.wikipedia.org/wiki/Recursion But how to handle it is another story :), since in @hellysmile example in "Steps to reproduce" client managed to get response on the LAST recurrence can we say we got the resource? Draft: Not sure how to handle it doe yet. |
In my mind |
Agreed on 404 i went wrong in that direction. ClientRedirectRecursionError(ClientResponseError): ClientRedirectionTimeout(ClientResponseError): |
I think the same behavior is good for aiohttp too (exception the limit is 10 for historical reasons, let's not touch it now). Too high Redirection timeout is not what I want to have: the timeout depends on network speed and it interfere with timeout for single request. |
"Too high max_redirects is bad because a cost of HTTP request is much higher than cost of Python recursive call." And in the case of reaching max_redirects: |
No, it is overengineering. If somebody want to shoot the leg -- we do nothing. |
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. |
Long story short
When loading
http://relax-tip.de/
it redirects tohttp://deepskin.de/
, buthttp://deepskin.de/
redirects back tohttp://relax-tip.de/
.aiohttp has built-in limit
max_redirects=10
, but when this limit is reached users get last redirect response and no way to figure-out that is cycle redirect, as well aiohttp follows redirects automatically and it is no expected to get304
response.Expected behaviour
I have an idea, when redirects limit is reached raise
TooManyRedirects
(requests do it)Actual behaviour
10 redirect response returned as successful response
Steps to reproduce
Your environment
client
If such idea makes sense, I'll do pull request to implement this feature
The text was updated successfully, but these errors were encountered: