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
net/http: useless string replace operation in Cookie.String #29135
Comments
/cc @bradfitz |
@bronze1man do you plan on sending this as a CL for 1.13? In general it should be fine to send CLs without an issue, unless there's a bug to be tracked. Otherwise, if you don't plan on sending the CL, we can just close this issue. |
Thanks for mention, I just find this bug when i read the source code. |
Change https://golang.org/cl/157777 mentions this issue: |
Closing so I can take this over on Gerrit. |
I meant to close the PR. |
isCookieNameValid do not allow "\r" "\n" appear in the cookie name.
https://github.com/golang/go/blob/master/src/net/http/cookie.go#L168
https://github.com/golang/go/blob/master/src/net/http/http.go#L50
https://github.com/golang/go/blob/master/src/internal/x/net/http/httpguts/httplex.go#L15
sanitizeCookieName replace "\r" "\n" to "-"
https://github.com/golang/go/blob/master/src/net/http/cookie.go#L172
This replace operation should have no effect.So it can be delete to save cpu time and make code easier to read.
The text was updated successfully, but these errors were encountered: