mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
net/http: revert 97d027b3aa68
Revert the following change set:
changeset: 13018:97d027b3aa68
user: Gustavo Niemeyer <gustavo@niemeyer.net>
date: Mon Apr 23 22:00:16 2012 -0300
summary: net/http: allow clients to disable keep-alive
This broke a test on Windows 64 and somebody else
will have to check.
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6112054
This commit is contained in:
parent
990f3af72b
commit
733b51d996
3 changed files with 8 additions and 26 deletions
|
|
@ -732,24 +732,12 @@ func (r *Request) FormFile(key string) (multipart.File, *multipart.FileHeader, e
|
|||
}
|
||||
|
||||
func (r *Request) expectsContinue() bool {
|
||||
return hasToken(r.Header.Get("Expect"), "100-continue")
|
||||
return strings.ToLower(r.Header.Get("Expect")) == "100-continue"
|
||||
}
|
||||
|
||||
func (r *Request) wantsHttp10KeepAlive() bool {
|
||||
if r.ProtoMajor != 1 || r.ProtoMinor != 0 {
|
||||
return false
|
||||
}
|
||||
return hasToken(r.Header.Get("Connection"), "keep-alive")
|
||||
}
|
||||
|
||||
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)
|
||||
return strings.Contains(strings.ToLower(r.Header.Get("Connection")), "keep-alive")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue