-
-
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
Cookies doesn't shared between requests #139
Comments
As i can see in sources, connection closed (and cookies not handled by connector) instead releasing. If I have something misunderstood or mistaken — please, give right example. Docs seems outdated. |
Hi, @spumer, _shared_cookie_conn = aiohttp.connector.TCPConnector(share_cookies=True)
@asyncio.coroutine
def main():
resp = yield from aiohttp.request('get', 'http:https://steamcommunity.com/', connector=_shared_cookie_conn)
assert dict(resp.cookies) != {}
assert dict(_shared_cookie_conn.cookies) == {}
yield from handle_response_or_release(resp)
# resp2 = yield from aiohttp.request('get', 'http:https://steamcommunitycom/', connector=_shared_cookie_conn)
# assert dict(_shared_cookie_conn.cookies) != {}
# ...
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main()) |
Hopefully, that makes it clear |
@popravich Yea! Thanks a lot! 👍 |
@spumer, updated the docs. |
I think making guard for check that user called Solution adds subtle incompatibility: now user can read response from |
I disagree, problem with .read() it reads whole response into memory. Using .read() will kill my application immediately. |
+1. More over, read() may not actually read all the response and will block the client for a very long time. |
We can have some special method for marking response object 'processed'. |
May be change the way how cookies get shared? Any reasons why connector, which actually should manage connection and his state, knows about and manages the headers which are a little bit more high level than it operates? |
Add separate CookieManager and pass it along |
ok, the problem here is with cookies. |
Something like that. Actually, that's what I currently doing, but via wrapper around |
Sounds right. And that's becomes possible after |
Guys, any thoughts on pull-request? Can I merge it? |
share response cookies as soon as received (relates to #139)
Cookies doesn't handled if server set cookie with 200 response code
In example http:https://aiohttp.readthedocs.org/en/latest/client.html#cookies the http:https://httpbin.org set cookie with redirect response and it works.
So, should i manually release response each time or this is a bug?
The text was updated successfully, but these errors were encountered: