Skip to content
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

Allow commas in cookie values #26

Closed
wants to merge 1 commit into from
Closed

Allow commas in cookie values #26

wants to merge 1 commit into from

Conversation

trowski
Copy link
Member

@trowski trowski commented Dec 30, 2023

While commas in cookie values are not allowed by RFC6265 (see 4.1.1 Syntax), it seems many modern browsers including Chrome and Firefox allow commas to be in cookie values.

Issue in .NET: dotnet/runtime#58773
Issue in Go: golang/go#7243

Ping @PeeHaa, since you raised this issue.

@trowski trowski requested a review from kelunik December 30, 2023 17:31
Copy link
Member

@bwoebi bwoebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it does not pose a problem to accept these (sending probably should still encode).
So, looks good to me :-)

@trowski
Copy link
Member Author

trowski commented Jan 1, 2024

If we want to still encode commas, then I'd have to modify the toString() method to replace , with %2C. That's a bit weird IMO since we don't encode the rest of the value, as we're expecting an encoded value to be provided in the first place.

@trowski
Copy link
Member Author

trowski commented Mar 10, 2024

Closing this in favor of maintaining strict compliance with the standard.

If necessary, one can always parse the comma-containing cookie header sent from the client and use Request::setCookie() to manually set the necessary cookie before another middleware or request handler. This would work well in the situation where the SessionMiddleware couldn't locate the session cookie due to another invalid cookie bundled with the session cookie in the same header.

@trowski trowski closed this Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants