-
Notifications
You must be signed in to change notification settings - Fork 1.7k
RangeError when creating a cookie with an empty vale #35189
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
Comments
Hi tomyeh, I came across this issue too, when running the stable Dart v2.1.0 release. Just looking at your fix for this issue, https://github.com/tomyeh/sdk/commit/8d1d9bafa30d3ea8ef05ec4416ce1b3d5d251167, and thought it might need to handle the situation where the value is a one-character string containing just a double quote (i.e. It that situation, the code will throw a RangeError, because the Looking at the cookie grammar in RFC 6265, I think that is not an error, but is a valid cookie-value. It doesn't match the second alternative in the definition of a cookie-value, so it must match the first.
That is, treating the one-character string P.S. There is probably a meta-discussion about what the "value" of a cookie really is. The Dart implementation currently treats the double-quotes as a part of the string value -- which I think is correct, since the RFC says "The semantics of the cookie-value are not defined...". So it needs to preserve any double quotes, so the application can decide if they are significant or not (i.e. when to produce headers with or without them, and what to do if it receives a cookie with or without them). |
Setting a cookie with an empty string `''` causes a crash. See: dart-lang/sdk#35189
If I'm reading the RFC spec correctly, doesn't it say that a So you either have 2 bounding double-quotes or none, but never 1. |
Sorry, you are correct. Looking at it again, if the Anyway, I'm looking forward to being able to create cookies with zero-length values again. Thanks for fixing that. |
Hi, I fixed this bug, it's a duplicate of #35804. |
Dart 2.1
MacOS
Test Code:
Exception:
Cause:
_validate
doesn't honer empty caseThe text was updated successfully, but these errors were encountered: