gh-92936: allow double quote in cookie values #113663
Open
+15
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As detailed more extensively in: #92936 it's not uncommon to see cookies with json and therefore double quotes in them. While IMO a well behaved application would base64 or otherwise encode those values, there are numerous services putting double quotes in the cookies, and it would be nice to have support for this directly in python so various http server/client/util libraries don't need to implement their own cookie parsing. Additionally browsers are tolerant of and handle double quotes in cookie values so
SimpleCookie
should also.Before this change
SimpleCookie
will without error drop cookie values that appear after a value with a double quote in them, which can lead to some very confusing and hard to debug issues when implementing http clients and servers.After this change
SimpleCookie
allows a double quote character in the values section of the cookie while making no attempt to determine if the value is valid json or anything else (since that's a application/usecase specific concern)Downstream issues:
aio-libs/aiohttp#7993
yt-dlp/yt-dlp#4780