aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/http/server.go')
-rw-r--r--src/net/http/server.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/net/http/server.go b/src/net/http/server.go
index 18efbb2ce1..0002da98d8 100644
--- a/src/net/http/server.go
+++ b/src/net/http/server.go
@@ -1922,12 +1922,15 @@ func (c *conn) serve(ctx context.Context) {
// If the handshake failed due to the client not speaking
// TLS, assume they're speaking plaintext HTTP and write a
// 400 response on the TLS conn's underlying net.Conn.
+ var reason string
if re, ok := err.(tls.RecordHeaderError); ok && re.Conn != nil && tlsRecordHeaderLooksLikeHTTP(re.RecordHeader) {
io.WriteString(re.Conn, "HTTP/1.0 400 Bad Request\r\n\r\nClient sent an HTTP request to an HTTPS server.\n")
re.Conn.Close()
- return
+ reason = "client sent an HTTP requset to an HTTPS server"
+ } else {
+ reason = err.Error()
}
- c.server.logf("http: TLS handshake error from %s: %v", c.rwc.RemoteAddr(), err)
+ c.server.logf("http: TLS handshake error from %s: %v", c.rwc.RemoteAddr(), reason)
return
}
// Restore Conn-level deadlines.