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

Redirect loop #56

Closed
orf opened this issue May 27, 2014 · 4 comments
Closed

Redirect loop #56

orf opened this issue May 27, 2014 · 4 comments
Labels

Comments

@orf
Copy link
Contributor

orf commented May 27, 2014

Aiohttp gets stuck in a loop as it doesn't respect set-cookie headers in redirect responses. If you request A which redirects to B, B then sets a cookie and redirects to A. A will see no cookie has been sent and so redirect you back to B. This is not very efficient as it ends up making 10 requests by default before returning.

https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/client.py#L126

@fafhrd91
Copy link
Member

by default aiohttp.request does not share cookies. you can use custom connector object with share_cookies turned on. something like that:

connector = aiohttp.TcpConnector(share_cookies=True)
aiohttp.request('post', 'http://...', connector=connector)

another question should we turn cookies on by default? and should we use global connector object instead of new object for each request() call?
@asvetlov thoughts?

@asvetlov
Copy link
Member

I think cookies should be disabled by default.
Maybe we need to add simpler way to pass cookies and get it back like requests do but let's hold over the decision about that part of API.
For second question: creation of new connector object is fast, shared global connector can lead to mysterious quirks -- so I'm strongly -1 for global connector.

@fafhrd91
Copy link
Member

ok, sounds good.

@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