net/http: useless string replace operation in Cookie.String #29135
Labels
Milestone
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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: