Commit 0bc38b7f authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: don't special-case multipart/byteranges responses

Fixes #4767

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7435046
parent 523cb45c
...@@ -324,6 +324,30 @@ var respTests = []respTest{ ...@@ -324,6 +324,30 @@ var respTests = []respTest{
"", "",
}, },
// golang.org/issue/4767: don't special-case multipart/byteranges responses
{
`HTTP/1.1 206 Partial Content
Connection: close
Content-Type: multipart/byteranges; boundary=18a75608c8f47cef
some body`,
Response{
Status: "206 Partial Content",
StatusCode: 206,
Proto: "HTTP/1.1",
ProtoMajor: 1,
ProtoMinor: 1,
Request: dummyReq("GET"),
Header: Header{
"Content-Type": []string{"multipart/byteranges; boundary=18a75608c8f47cef"},
},
Close: true,
ContentLength: -1,
},
"some body",
},
} }
func TestReadResponse(t *testing.T) { func TestReadResponse(t *testing.T) {
......
...@@ -454,13 +454,6 @@ func fixLength(isResponse bool, status int, requestMethod string, header Header, ...@@ -454,13 +454,6 @@ func fixLength(isResponse bool, status int, requestMethod string, header Header,
return 0, nil return 0, nil
} }
// Logic based on media type. The purpose of the following code is just
// to detect whether the unsupported "multipart/byteranges" is being
// used. A proper Content-Type parser is needed in the future.
if strings.Contains(strings.ToLower(header.get("Content-Type")), "multipart/byteranges") {
return -1, ErrNotSupported
}
// Body-EOF logic based on other methods (like closing, or chunked coding) // Body-EOF logic based on other methods (like closing, or chunked coding)
return -1, nil return -1, nil
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment