RFC2616 sections 4.4 and 14.16:
* Cannot use Content-Length with non-identity Transfer-Encoding
* Content-Range response is "bytes x-y/z" not "x-y/z"
R=rsc
CC=golang-dev
https://golang.org/cl/
4018041
}
size = ra.length
code = StatusPartialContent
- w.SetHeader("Content-Range", fmt.Sprintf("%d-%d/%d", ra.start, ra.start+ra.length, d.Size))
+ w.SetHeader("Content-Range", fmt.Sprintf("bytes %d-%d/%d", ra.start, ra.start+ra.length-1, d.Size))
}
w.SetHeader("Accept-Ranges", "bytes")
if rt.code == StatusRequestedRangeNotSatisfiable {
continue
}
- h := fmt.Sprintf("%d-%d/%d", rt.start, rt.end, testFileLength)
+ h := fmt.Sprintf("bytes %d-%d/%d", rt.start, rt.end-1, testFileLength)
if rt.r == "" {
h = ""
}
w.header["Transfer-Encoding"] = "", false
w.chunking = false
}
+ // Cannot use Content-Length with non-identity Transfer-Encoding.
+ if w.chunking {
+ w.header["Content-Length"] = "", false
+ }
if !w.req.ProtoAtLeast(1, 0) {
return
}