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

Too strict cookie parsing? #1112

Closed
simme opened this issue Oct 20, 2013 · 4 comments
Closed

Too strict cookie parsing? #1112

simme opened this issue Oct 20, 2013 · 4 comments
Assignees
Labels
feature New functionality or improvement
Milestone

Comments

@simme
Copy link

simme commented Oct 20, 2013

I'm having trouble parsing cookies whose names include [ and ]. Even with strictHeader set to false.

I can't find anything in the RFC6265 spec that seem to explicitly forbid those characters. But I must admit I mainly skimmed it.

@simme
Copy link
Author

simme commented Oct 20, 2013

Changing the regexp for non-strict mode to:
internals.looseRx = /\s*([^\x00-\x20\(\)<>@\,;\:\\"\/\?\=\{\}\x7F]+)\s*=\s*(?:(?:"([^\"]*)")|([^\;]*))(?:(?:;|(?:\s*\,)\s*)|$)/g;

"Solves" my issue.

@hueniverse
Copy link
Contributor

Cookie names are 'token' type: https://tools.ietf.org/html/rfc2616#section-2.2 which does not allow []. But I made it looser anyway.

@ghost ghost assigned hueniverse Oct 25, 2013
@simme
Copy link
Author

simme commented Oct 25, 2013

Cool! This will help, since PHP apparently uses [] to make "arrays" in cookies!

jmonster pushed a commit to jmonster/hapi that referenced this issue Feb 10, 2014
@Marsup Marsup added feature New functionality or improvement and removed request labels Sep 20, 2019
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

3 participants