Skip to content

Do not filter cookies if unsafe flag provided#1005

Merged
asvetlov merged 2 commits intoaio-libs:masterfrom
kpidata:master
Jul 26, 2016
Merged

Do not filter cookies if unsafe flag provided#1005
asvetlov merged 2 commits intoaio-libs:masterfrom
kpidata:master

Conversation

@bmwant
Copy link
Copy Markdown
Member

@bmwant bmwant commented Jul 26, 2016

What do these changes do?

For the testing purposes or when user is aware about what he is doing it's handy to be able provide unsafe cookie jar (so cookies will be preserved even for domain specified as IP address, e.g. 127.0.0.1)

Are there changes in behavior for the user?

cookie_jar = aiohttp.CookieJar(loop=loop, unsafe=True)
with aiohttp.ClientSession(loop=loop, cookie_jar=cookie_jar) as session:
    resp = await session.get('http://127.0.0.1/')
    print(resp.cookies)
    await resp.release()

Now cookies right in place

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

@coveralls
Copy link
Copy Markdown

coveralls commented Jul 26, 2016

Coverage Status

Coverage remained the same at 97.971% when pulling fd22462 on kpidata:master into 32c0f1d on KeepSafe:master.

@asvetlov
Copy link
Copy Markdown
Member

Shame on me, I've missed the second IP address check.

@asvetlov asvetlov merged commit 7dad207 into aio-libs:master Jul 26, 2016
@asvetlov
Copy link
Copy Markdown
Member

Will be fixed in aiohttp 0.22.3

asvetlov pushed a commit that referenced this pull request Jul 26, 2016
* Add test for unsafe cookies jar

* Remove code duplication and make base class for testing CookieJar
@lock
Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

3 participants