diff options
| -rw-r--r-- | gemini.go | 6 | ||||
| -rw-r--r-- | handler.go | 7 | ||||
| -rw-r--r-- | server.go | 10 |
3 files changed, 0 insertions, 23 deletions
@@ -21,12 +21,6 @@ var ( // methods after a call to Shutdown or Close. ErrServerClosed = errors.New("gemini: server closed") - // ErrAbortHandler is a sentinel panic value to abort a handler. - // While any panic from ServeGemini aborts the response to the client, - // panicking with ErrAbortHandler also suppresses logging of a stack - // trace to the server's error log. - ErrAbortHandler = errors.New("gemini: abort Handler") - // ErrHandlerTimeout is returned on ResponseWriter Write calls // in handlers which have timed out. ErrHandlerTimeout = errors.New("gemini: Handler timeout") @@ -14,13 +14,6 @@ import ( // of the ServeGemini call. // // Handlers should not modify the provided Request. -// -// If ServeGemini panics, the server (the caller of ServeGemini) 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 closes the -// network connection. To abort a handler so the client sees an interrupted -// response but the server doesn't log an error, panic with the value -// ErrAbortHandler. type Handler interface { ServeGemini(context.Context, ResponseWriter, *Request) } @@ -6,7 +6,6 @@ import ( "errors" "log" "net" - "runtime" "sync" "sync/atomic" "time" @@ -298,15 +297,6 @@ func (srv *Server) serveConn(ctx context.Context, conn net.Conn) { defer srv.tryFinishShutdown() defer srv.deleteConn(&conn) - defer func() { - if err := recover(); err != nil && err != ErrAbortHandler { - const size = 64 << 10 - buf := make([]byte, size) - buf = buf[:runtime.Stack(buf, false)] - srv.logf("gemini: panic serving %v: %v\n%s", conn.RemoteAddr(), err, buf) - } - }() - if d := srv.ReadTimeout; d != 0 { conn.SetReadDeadline(time.Now().Add(d)) } |