mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
0774f6dbfd
commit
ae080c1aec
4 changed files with 197 additions and 4 deletions
|
|
@ -405,6 +405,57 @@ some body`,
|
|||
|
||||
"foobar",
|
||||
},
|
||||
|
||||
// Both keep-alive and close, on the same Connection line. (Issue 8840)
|
||||
{
|
||||
"HTTP/1.1 200 OK\r\n" +
|
||||
"Content-Length: 256\r\n" +
|
||||
"Connection: keep-alive, close\r\n" +
|
||||
"\r\n",
|
||||
|
||||
Response{
|
||||
Status: "200 OK",
|
||||
StatusCode: 200,
|
||||
Proto: "HTTP/1.1",
|
||||
ProtoMajor: 1,
|
||||
ProtoMinor: 1,
|
||||
Request: dummyReq("HEAD"),
|
||||
Header: Header{
|
||||
"Content-Length": {"256"},
|
||||
},
|
||||
TransferEncoding: nil,
|
||||
Close: true,
|
||||
ContentLength: 256,
|
||||
},
|
||||
|
||||
"",
|
||||
},
|
||||
|
||||
// Both keep-alive and close, on different Connection lines. (Issue 8840)
|
||||
{
|
||||
"HTTP/1.1 200 OK\r\n" +
|
||||
"Content-Length: 256\r\n" +
|
||||
"Connection: keep-alive\r\n" +
|
||||
"Connection: close\r\n" +
|
||||
"\r\n",
|
||||
|
||||
Response{
|
||||
Status: "200 OK",
|
||||
StatusCode: 200,
|
||||
Proto: "HTTP/1.1",
|
||||
ProtoMajor: 1,
|
||||
ProtoMinor: 1,
|
||||
Request: dummyReq("HEAD"),
|
||||
Header: Header{
|
||||
"Content-Length": {"256"},
|
||||
},
|
||||
TransferEncoding: nil,
|
||||
Close: true,
|
||||
ContentLength: 256,
|
||||
},
|
||||
|
||||
"",
|
||||
},
|
||||
}
|
||||
|
||||
func TestReadResponse(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue