aboutsummaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-02-17 19:26:56 -0500
committerAdnan Maolood <[email protected]>2021-02-17 19:27:25 -0500
commitb5a3c0adc534510885bd3e5aa5e910f05a95a590 (patch)
tree423cd2fc98c6b23e9d442538b983b694f63af631 /server.go
parentexamples: Use new ResponseWriter interface (diff)
downloadarchived-go-gemini-b5a3c0adc534510885bd3e5aa5e910f05a95a590.tar.xz
archived-go-gemini-b5a3c0adc534510885bd3e5aa5e910f05a95a590.zip
Add utility Handler functions
Diffstat (limited to 'server.go')
-rw-r--r--server.go29
1 files changed, 0 insertions, 29 deletions
diff --git a/server.go b/server.go
index a90fe50..fc3c618 100644
--- a/server.go
+++ b/server.go
@@ -430,32 +430,3 @@ func (srv *Server) logf(format string, args ...interface{}) {
log.Printf(format, args...)
}
}
-
-// A Handler responds to a Gemini request.
-//
-// ServeGemini should write the response header and data to the ResponseWriter
-// and then return. Returning signals that the request is finished; it is not
-// valid to use the ResponseWriter after or concurrently with the completion
-// 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(ResponseWriter, *Request)
-}
-
-// The HandlerFunc type is an adapter to allow the use of ordinary functions
-// as Gemini handlers. If f is a function with the appropriate signature,
-// HandlerFunc(f) is a Handler that calls f.
-type HandlerFunc func(ResponseWriter, *Request)
-
-// ServeGemini calls f(w, r).
-func (f HandlerFunc) ServeGemini(w ResponseWriter, r *Request) {
- f(w, r)
-}