Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2020-10-18.08:59:25.049>labels= ['type-bug', 'library', '3.10']
title='CookieJar cookies should not be sorted'updated_at=<Date2021-10-07.15:18:17.271>user='https://github.com/IKermani'
Moreover there is no definition in the 2965 about the cookie ordering in Cookie Header when cookies have equal-length path fields.
This is a undesirable behavior when working with certain libraries like requests. psf/requests#5630
In this case browser implements the RFC 6265 which obsoletes the RFC 2965. Therefore The behavior is based on https://tools.ietf.org/html/rfc6265#section-5.4:
"The user agent SHOULD sort the cookie-list in the following order:
Cookies with longer paths are listed before cookies with shorter paths.
Among cookies that have equal-length path fields, cookies with earlier creation-times are listed before cookies with later creation-times."
This means that the order of the cookies with same path attribute in Cookie header follow the Set-Cookie order in the HTTP response.
RFC 6265 compliance is not what this issue is meant rather it imply on the sorting of cookies which is unnecessary here and not mentioned in RFC 2965 or the regular Netscape cookie protocol.
The seems reasonable to me. Likely, the sorting was originally added to make the execution order deterministic. Now that dicts remember insertion order, that is no longer necessary. Helpfully, the docs do not specify sorting, so there is no guaranteed behavior. That said, there is some risk that applications or their tests depend on the existing behavior.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: