Skip to content

Make a cookie's path a URL path - #3512

Open
annevk wants to merge 1 commit into
mainfrom
cookie-path-url-path
Open

Make a cookie's path a URL path#3512
annevk wants to merge 1 commit into
mainfrom
cookie-path-url-path

Conversation

@annevk

@annevk annevk commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

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

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
@annevk
annevk requested a review from johannhof as a code owner August 23, 2026 18:00
@annevk annevk added the cookies Issues with the layered-cookies draft. label Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cookies Issues with the layered-cookies draft.

Development

Successfully merging this pull request may close these issues.

1 participant