From 2c15d45131bbad55c710427a2ea5a1b383e9811c Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 19 Sep 2014 13:53:33 -0400 Subject: [PATCH] net/http: document server recovering panics Fixes #8594. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://golang.org/cl/145760043 --- src/net/http/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/net/http/server.go b/src/net/http/server.go index 203037e9f5..8f2b777b29 100644 --- a/src/net/http/server.go +++ b/src/net/http/server.go @@ -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) } -- 2.48.1