Documentation
¶
Overview ¶
Package httpserver is the HTTP server the API gateway and the Services' endpoints serve with: HTTP/1.1 and h2c, and a Shutdown that stops even when its ctx has already ended (#1034, #1117).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
Server is an http.Server speaking HTTP/1.1 and h2c. Callers may set its fields, such as ConnState, ConnContext, HTTP2 or TLSConfig, before serving, but not BaseContext, which Shutdown uses to end every request. Only Serve and ServeTLS track their listeners' close errors, and only Shutdown ends the requests' contexts; ListenAndServe and Close are http.Server's own.
func New ¶
New returns a Server for h. name names it in the line Shutdown logs when it closes connections by force, such as "API gateway".
func (*Server) Shutdown ¶
Shutdown stops the Server. It drains within ctx; if ctx ends first, the connections still open are closed by force, which is the normal end of a shutdown rather than an error, and one Info line says so. Then it ends every request's context, so connections the server handed over close as their handlers return. It reports only a real failure to stop, such as a listener that failed to close.