mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/http: correct and faster hasToken
Fixes #3535 R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/6245060
This commit is contained in:
parent
cb62365f57
commit
469e3a91d4
3 changed files with 78 additions and 8 deletions
|
|
@ -745,11 +745,3 @@ func (r *Request) wantsHttp10KeepAlive() bool {
|
|||
func (r *Request) wantsClose() bool {
|
||||
return hasToken(r.Header.Get("Connection"), "close")
|
||||
}
|
||||
|
||||
func hasToken(s, token string) bool {
|
||||
if s == "" {
|
||||
return false
|
||||
}
|
||||
// TODO This is a poor implementation of the RFC. See http://golang.org/issue/3535
|
||||
return strings.Contains(strings.ToLower(s), token)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue