diff options
| author | Brad Fitzpatrick <bradfitz@golang.org> | 2011-03-12 09:58:53 -0800 |
|---|---|---|
| committer | Brad Fitzpatrick <bradfitz@golang.org> | 2011-03-12 09:58:53 -0800 |
| commit | 1c96562f36e354328fb7c6c29b00a4048f852630 (patch) | |
| tree | 31b2bbf2cec4133b327c86c075402723f7a4c9fc /src/pkg/http/server.go | |
| parent | a7528f1b810cd5824fb91b5cc3ff12801f333e89 (diff) | |
| download | go-1c96562f36e354328fb7c6c29b00a4048f852630.tar.xz | |
http: use Header.Del not empty Set(k, "")
Also don't serialize empty headers.
R=dsymonds, rsc
CC=golang-dev
https://golang.org/cl/4275045
Diffstat (limited to 'src/pkg/http/server.go')
| -rw-r--r-- | src/pkg/http/server.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/pkg/http/server.go b/src/pkg/http/server.go index 6a7c74efb0..91caebc2db 100644 --- a/src/pkg/http/server.go +++ b/src/pkg/http/server.go @@ -236,7 +236,7 @@ func (w *response) WriteHeader(code int) { hasCL = true } else { log.Printf("http: invalid Content-Length of %q sent", clenStr) - w.header.Set("Content-Length", "") + w.header.Del("Content-Length") } } @@ -247,7 +247,7 @@ func (w *response) WriteHeader(code int) { // For now just ignore the Content-Length. log.Printf("http: WriteHeader called with both Transfer-Encoding of %q and a Content-Length of %d", te, contentLength) - w.header.Set("Content-Length", "") + w.header.Del("Content-Length") hasCL = false } @@ -286,7 +286,7 @@ func (w *response) WriteHeader(code int) { // Cannot use Content-Length with non-identity Transfer-Encoding. if w.chunking { - w.header.Set("Content-Length", "") + w.header.Del("Content-Length") } if !w.req.ProtoAtLeast(1, 0) { return |
