1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:14:47 -07:00

http: fix panic when recovering from hijacked connection panic

Fixes #2375.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5279049
This commit is contained in:
Andrew Gerrand 2011-10-17 15:54:36 +11:00
parent edd1c9111d
commit 64471ae762

View File

@ -567,7 +567,9 @@ func (c *conn) serve() {
if err == nil {
return
}
c.rwc.Close()
if c.rwc != nil { // may be nil if connection hijacked
c.rwc.Close()
}
var buf bytes.Buffer
fmt.Fprintf(&buf, "http: panic serving %v: %v\n", c.remoteAddr, err)