Make a cookie's path a URL path - #3512
Open
annevk wants to merge 1 commit into
Open
Conversation
Path-Matches compared serialized paths, which made a cookie path of /foo match a request path of /foobar, and passed URL paths to the URL path serializer, which takes a URL. Compare URL path segments instead, using the operations URL now provides. The Path attribute was split into a list that kept its leading empty segment, which is not how a URL path is represented, so such a path matched nothing and no "__Host-" prefixed cookie could be set. Isomorphic decode the attribute, drop that segment, and return failure if the result is not an ASCII string, rather than storing a path no request could ever carry. That check applies to the Path attribute that wins, so it happens once all attributes have been processed. Cookie Default Path removed an item from the URL path it was given, or replaced that path's first item, and it is called with a request URL's path. Operate on a clone instead. Also stop passing a path to Store a Cookie, which takes no such argument. Depends on whatwg/url#929. Tests: web-platform-tests/wpt#62165
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Path-Matches compared serialized paths, which made a cookie path of /foo match a
request path of /foobar, and passed URL paths to the URL path serializer, which
takes a URL. Compare URL path segments instead, using the operations URL now
provides.
The Path attribute was split into a list that kept its leading empty segment,
which is not how a URL path is represented, so such a path matched nothing and no
"__Host-" prefixed cookie could be set. Isomorphic decode the attribute, drop
that segment, and return failure if the result is not an ASCII string, rather
than storing a path no request could ever carry. That check applies to the Path
attribute that wins, so it happens once all attributes have been processed.
Cookie Default Path removed an item from the URL path it was given, or replaced
that path's first item, and it is called with a request URL's path. Operate on a
clone instead.
Also stop passing a path to Store a Cookie, which takes no such argument.
Depends on whatwg/url#929.
Tests: web-platform-tests/wpt#62165