]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: document server recovering panics
authorRuss Cox <rsc@golang.org>
Fri, 19 Sep 2014 17:53:33 +0000 (13:53 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 19 Sep 2014 17:53:33 +0000 (13:53 -0400)
Fixes #8594.

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/145760043

src/net/http/server.go

index 203037e9f5ee190fbc355c1fa9a12c40c8e874ee..8f2b777b29eac67df8d7ecfda56ead753ee7c354 100644 (file)
@@ -42,6 +42,12 @@ var (
 // and then return.  Returning signals that the request is finished
 // and that the HTTP server can move on to the next request on
 // the connection.
+//
+// If ServeHTTP panics, the server (the caller of ServeHTTP) assumes
+// that the effect of the panic was isolated to the active request.
+// It recovers the panic, logs a stack trace to the server error log,
+// and hangs up the connection.
+//
 type Handler interface {
        ServeHTTP(ResponseWriter, *Request)
 }