diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2015-04-28 13:10:25 -0700 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2015-04-29 23:52:43 +0000 |
| commit | ae080c1aecb129a3230e7afecdb4a16ad3da9b3c (patch) | |
| tree | fb305f53d4d211cc2b129f5d64800fcb60df9003 /src/net/http/transfer.go | |
| parent | 0774f6dbfd3103f59c7232a056b030d49cf5e82d (diff) | |
| download | go-ae080c1aecb129a3230e7afecdb4a16ad3da9b3c.tar.xz | |
net/http: handle "close" amongst multiple Connection tokens
Fixes #8840
Change-Id: I194d0248734c15336f91a6bcf57ffcc9c0a3a435
Reviewed-on: https://go-review.googlesource.com/9434
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/net/http/transfer.go')
| -rw-r--r-- | src/net/http/transfer.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/net/http/transfer.go b/src/net/http/transfer.go index 7372d7537e..5640344345 100644 --- a/src/net/http/transfer.go +++ b/src/net/http/transfer.go @@ -508,14 +508,13 @@ func shouldClose(major, minor int, header Header, removeCloseHeader bool) bool { if major < 1 { return true } else if major == 1 && minor == 0 { - if !strings.Contains(strings.ToLower(header.get("Connection")), "keep-alive") { + vv := header["Connection"] + if headerValuesContainsToken(vv, "close") || !headerValuesContainsToken(vv, "keep-alive") { return true } return false } else { - // TODO: Should split on commas, toss surrounding white space, - // and check each field. - if strings.ToLower(header.get("Connection")) == "close" { + if headerValuesContainsToken(header["Connection"], "close") { if removeCloseHeader { header.Del("Connection") } |
