Skip to content

bpo-40001: BaseCookie add ignore_errors kwarg to load method#19058

Closed
aviramha wants to merge 1 commit into
python:mainfrom
aviramha:master
Closed

bpo-40001: BaseCookie add ignore_errors kwarg to load method#19058
aviramha wants to merge 1 commit into
python:mainfrom
aviramha:master

Conversation

@aviramha

@aviramha aviramha commented Mar 18, 2020

Copy link
Copy Markdown

@the-knights-who-say-ni

Copy link
Copy Markdown

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@aviramha

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

Comment thread Lib/http/cookies.py Outdated
@bharel

bharel commented Mar 18, 2020

Copy link
Copy Markdown
Contributor

Unfortunately the patch creates inconsistent results due to already-inconsistent parsing.

s = SimpleCookie(); s.load("invalid\x00=cookie;valid=b", ignore_errors=True)
s2 = SimpleCookie(); s2.load("invalid/=cookie;valid=b", ignore_errors=True)
assert s == s2  # Raises AssertionError.

See bpo-40002

@aviramha

Copy link
Copy Markdown
Author

Unfortunately the patch creates inconsistent results due to already-inconsistent parsing.

s = SimpleCookie(); s.load("invalid\x00=cookie;valid=b", ignore_errors=True)
s2 = SimpleCookie(); s2.load("invalid/=cookie;valid=b", ignore_errors=True)
assert s != s2

See bpo-40002

I think the difference between the two use cases is that the first doesn't pass validation as a whole header, whilst the second doesn't pass validation as a morsel, hence it's OK to ignore the specific erroneous morsel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants