-
Notifications
You must be signed in to change notification settings - Fork 4.1k
fix(network): Include subdomains of localhost when including cookies #35771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(network): Include subdomains of localhost when including cookies #35771
Conversation
…ookies to include
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good, but please add a test. Also would be nice to have an issue which describes the problem the PR is fixing.
@simenbrekken please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
@yury-s I added a failing test but I couldn't figure out why it's failing, any ideas? |
Test results for "tests 1"6 failed 4 flaky39103 passed, 809 skipped Merge workflow run. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new test is failing across platforms, please fix.
res.setHeader('Set-Cookie', ['a=v; secure', 'b=v']); | ||
res.end(); | ||
}); | ||
await request.get(`${`http://a.b.localhost:${server.PORT}`}/setcookie.html`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await request.get(`${`http://a.b.localhost:${server.PORT}`}/setcookie.html`); | |
await request.get(`http://a.b.localhost:${server.PORT}/setcookie.html`); |
Replaced the direct check for
parsedURL.hostname === 'localhost'
with a new helper functionisLocalHostname
, which also considers hostnames ending with.localhost
as local. This improves flexibility and correctness when handling local hostnames.See also RFC 6761 section 6.3 on handling of
localhost
.