aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/server.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2016-05-11 15:01:28 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2016-05-11 22:14:27 +0000
commiteb9062b7bf77a5051b3db6f3e944739a486ca1e4 (patch)
treeb080485b675f114160ae920202cad5cf0bf9a31f /src/net/http/server.go
parent114051aa1d5da5dec1b2707b1403261a3135b9b5 (diff)
downloadgo-eb9062b7bf77a5051b3db6f3e944739a486ca1e4.tar.xz
net/http: keep HTTP/1.0 keep-alive conns open if response can't have a body
Fixes #15647 Change-Id: I588bfa4eb336d1da1fcda8d06e32ed13c0b51c70 Reviewed-on: https://go-review.googlesource.com/23061 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Andrew Gerrand <adg@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/net/http/server.go')
-rw-r--r--src/net/http/server.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/net/http/server.go b/src/net/http/server.go
index e24777421c..d0be7d01db 100644
--- a/src/net/http/server.go
+++ b/src/net/http/server.go
@@ -1008,7 +1008,7 @@ func (cw *chunkWriter) writeHeader(p []byte) {
// Check for a explicit (and valid) Content-Length header.
hasCL := w.contentLength != -1
- if w.wants10KeepAlive && (isHEAD || hasCL) {
+ if w.wants10KeepAlive && (isHEAD || hasCL || !bodyAllowedForStatus(w.status)) {
_, connectionHeaderSet := header["Connection"]
if !connectionHeaderSet {
setHeader.connection = "keep-alive"