aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-12-13 17:08:18 -0500
committerRuss Cox <rsc@golang.org>2011-12-13 17:08:18 -0500
commit2c6d3eaf78c9314fe49a550e765def95463179e8 (patch)
treecdc39642be53f399cd76a019dd3707c1566aab9a
parent5fb7e5b482eba62a78738866c536ef04f0696809 (diff)
downloadgo-2c6d3eaf78c9314fe49a550e765def95463179e8.tar.gz
go-2c6d3eaf78c9314fe49a550e765def95463179e8.zip
undo CL 5414048 / f6b994f33cf4
breaks build ««« original CL description http: close connection after printing panic stack trace In a testing situation, it's possible for a local http server to panic and the test exit without the stack trace ever being printed. Fixes #2480. R=rsc, bradfitz CC=golang-dev https://golang.org/cl/5414048 »»» R=bradfitz CC=golang-dev https://golang.org/cl/5482061
-rw-r--r--src/pkg/net/http/server.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/net/http/server.go b/src/pkg/net/http/server.go
index 56f56cb044..fa9009517d 100644
--- a/src/pkg/net/http/server.go
+++ b/src/pkg/net/http/server.go
@@ -569,14 +569,14 @@ func (c *conn) serve() {
if err == nil {
return
}
+ 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)
buf.Write(debug.Stack())
log.Print(buf.String())
-
- if c.rwc != nil { // may be nil if connection hijacked
- c.rwc.Close()
- }
}()
if tlsConn, ok := c.rwc.(*tls.Conn); ok {