We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version
go 1.15.6
Yes
go env
func TestCookieParse(t *testing.T) { req, err := http.NewRequest(http.MethodGet, "http://localhost", nil) if err != nil { t.Error(err) return } req.Header = http.Header{ "Cookie": []string{"name=1;;age=2"}, } if c, err := req.Cookie("age"); err != nil { t.Error(err) return } else if c.Value != "2" { t.Errorf("age have: %s, want: 2", c.Value) return } }
The test passes as expected, and the value of "age" should be "2".
The test failed with an error as "http: named cookie not present".
I parsed the same cookie string in PHP and NodeJS, and both of them return the value of "age" as "2".
And I tried the same code in Go 1.12, the value of "age" is also "2".
Is this a bug since Go 1.13 or just a feature ?
If this is a bug, you can fix it just like the below code:
old code in net/http/cookie.go:250
if splitIndex := strings.Index(line, ";"); splitIndex > 0 {
new code
if splitIndex := strings.Index(line, ";"); splitIndex >= 0 {
The text was updated successfully, but these errors were encountered:
This is malformed cookie header according to RFC 6265 Section 5.4.4.2
See #39087 (comment) for the bar for inclusion
Sorry, something went wrong.
No branches or pull requests
What version of Go are you using (
go version
)?go 1.15.6
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
The test passes as expected, and the value of "age" should be "2".
What did you see instead?
The test failed with an error as "http: named cookie not present".
My View
I parsed the same cookie string in PHP and NodeJS, and both of them return the value of "age" as "2".
And I tried the same code in Go 1.12, the value of "age" is also "2".
Is this a bug since Go 1.13 or just a feature ?
If this is a bug, you can fix it just like the below code:
old code in net/http/cookie.go:250
new code
The text was updated successfully, but these errors were encountered: