]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: don't special-case multipart/byteranges responses
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 1 Mar 2013 00:58:26 +0000 (16:58 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 1 Mar 2013 00:58:26 +0000 (16:58 -0800)
Fixes #4767

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/7435046

src/pkg/net/http/response_test.go
src/pkg/net/http/transfer.go

index 8411964dc8259b1a3c7ef234f64d86734e0bd2c3..2f5f77369ffdb5e75c364363590c0557c4a44d7e 100644 (file)
@@ -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) {
index 3b473ad75b8527b0624b9dec3a716a63a267428c..43c6023a3a18fece9a6f8336faa50232edf966a7 100644 (file)
@@ -454,13 +454,6 @@ func fixLength(isResponse bool, status int, requestMethod string, header Header,
                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)
        return -1, nil
 }