Documentation
¶
Index ¶
- Variables
- func ListenAndServeHTTPSWithContext(ctx context.Context, server *http.Server, certFile, keyFile string) error
- func ListenAndServeHTTPWithContext(ctx context.Context, server *http.Server) error
- func ServeHTTPSWithContext(ctx context.Context, server *http.Server, ln net.Listener, ...) error
- func ServeHTTPWithContext(ctx context.Context, server *http.Server, ln net.Listener) error
Constants ¶
This section is empty.
Variables ¶
var PanicToError = derror.PanicToError
PanicToError is a legacy alias for derror.PanicToError.
Note: We use a variable here (instead of wrapping the function) in order to avoid adding an extra entry to the stacktrace.
Functions ¶
func ListenAndServeHTTPSWithContext ¶
func ListenAndServeHTTPSWithContext(ctx context.Context, server *http.Server, certFile, keyFile string) error
ListenAndServeHTTPSWithContext is DEPRECATED; even with this function helping you out, there are enough historical "gotchas" with http.Server, that you should consider using github.com/datawire/dlib/dhttp instead.
ListenAndServeHTTPSWithContext runs server.ListenAndServeTLS() on an http.Server, but properly calls server.Shutdown when the Context is canceled.
It obeys hard/soft cancellation as implemented by dcontext.WithSoftness; it calls server.Shutdown() when the soft Context is canceled, and the hard Context being canceled causes the .Shutdown() to hurry along and kill any live requests and return, instead of waiting for them to be completed gracefully.
It is invalid to call ListenAndServeHTTPSWithContext with server.BaseContext set; the passed-in Context is the base Context.
func ListenAndServeHTTPWithContext ¶
ListenAndServeHTTPWithContext is DEPRECATED; even with this function helping you out, there are enough historical "gotchas" with http.Server, that you should consider using github.com/datawire/dlib/dhttp instead.
ListenAndServeHTTPWithContext runs server.ListenAndServe() on an http.Server, but properly calls server.Shutdown when the Context is canceled.
It obeys hard/soft cancellation as implemented by dcontext.WithSoftness; it calls server.Shutdown() when the soft Context is canceled, and the hard Context being canceled causes the .Shutdown() to hurry along and kill any live requests and return, instead of waiting for them to be completed gracefully.
It is invalid to call ListenAndServeHTTPWithContext with server.BaseContext set; the passed-in Context is the base Context.
func ServeHTTPSWithContext ¶
func ServeHTTPSWithContext(ctx context.Context, server *http.Server, ln net.Listener, certFile, keyFile string) error
ServeHTTPSWithContext is DEPRECATED; even with this function helping you out, there are enough historical "gotchas" with http.Server, that you should consider using github.com/datawire/dlib/dhttp instead.
ServeHTTPSWithContext runs server.ServeTLS() on an http.Server, but properly calls server.Shutdown when the Context is canceled.
It obeys hard/soft cancellation as implemented by dcontext.WithSoftness; it calls server.Shutdown() when the soft Context is canceled, and the hard Context being canceled causes the .Shutdown() to hurry along and kill any live requests and return, instead of waiting for them to be completed gracefully.
It is invalid to call ServeHTTPSWithContext with server.BaseContext set; the passed-in Context is the base Context.
ServeHTTPSWithContext always closes the Listener before returning (this is slightly different than *http.Server.ServeTLS, which does not close the Listener if returning early during setup due to being passed invalid cert or key files).
func ServeHTTPWithContext ¶
ServeHTTPWithContext is DEPRECATED; even with this function helping you out, there are enough historical "gotchas" with http.Server, that you should consider using github.com/datawire/dlib/dhttp instead.
ServeHTTPWithContext(ln) runs server.Serve(ln) on an http.Server, but properly calls server.Shutdown when the Context is canceled.
It obeys hard/soft cancellation as implemented by dcontext.WithSoftness; it calls server.Shutdown() when the soft Context is canceled, and the hard Context being canceled causes the .Shutdown() to hurry along and kill any live requests and return, instead of waiting for them to be completed gracefully.
It is invalid to call ServeHTTPWithContext with server.BaseContext set; the passed-in Context is the base Context.
Types ¶
This section is empty.