diff options
| author | Clement Skau <clementskau@gmail.com> | 2011-01-19 10:05:48 -0500 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-01-19 10:05:48 -0500 |
| commit | 49741f23d5938eff80f2c8ca4b16c9f1b0e15f7d (patch) | |
| tree | 3eeaaea552fc3226f701174690bd2e16029470c7 /src/pkg/http/server.go | |
| parent | 43582bad33f18ea3f88252574810aee849380590 (diff) | |
| download | go-49741f23d5938eff80f2c8ca4b16c9f1b0e15f7d.tar.xz | |
http: fix Content-Range and Content-Length in response
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
Diffstat (limited to 'src/pkg/http/server.go')
| -rw-r--r-- | src/pkg/http/server.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pkg/http/server.go b/src/pkg/http/server.go index 2ecdd5ee25..644724f58e 100644 --- a/src/pkg/http/server.go +++ b/src/pkg/http/server.go @@ -229,6 +229,10 @@ func (w *response) WriteHeader(code int) { 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 } |
