type request … type envVarsContextKey … func newRequest(reqId uint16, flags uint8) *request { … } // parseParams reads an encoded []byte into Params. func (r *request) parseParams() { … } type response … func newResponse(c *child, req *request) *response { … } func (r *response) Header() http.Header { … } func (r *response) Write(p []byte) (n int, err error) { … } func (r *response) WriteHeader(code int) { … } // writeCGIHeader finalizes the header sent to the client and writes it to the output. // p is not written by writeHeader, but is the first chunk of the body // that will be written. It is sniffed for a Content-Type if none is // set explicitly. func (r *response) writeCGIHeader(p []byte) { … } func (r *response) Flush() { … } func (r *response) Close() error { … } type child … func newChild(rwc io.ReadWriteCloser, handler http.Handler) *child { … } func (c *child) serve() { … } var errCloseConn … var emptyBody … var ErrRequestAborted … var ErrConnClosed … func (c *child) handleRecord(rec *record) error { … } // filterOutUsedEnvVars returns a new map of env vars without the // variables in the given envVars map that are read for creating each http.Request func filterOutUsedEnvVars(envVars map[string]string) map[string]string { … } func (c *child) serveRequest(req *request, body io.ReadCloser) { … } func (c *child) cleanUp() { … } // Serve accepts incoming FastCGI connections on the listener l, creating a new // goroutine for each. The goroutine reads requests and then calls handler // to reply to them. // If l is nil, Serve accepts connections from os.Stdin. // If handler is nil, [http.DefaultServeMux] is used. func Serve(l net.Listener, handler http.Handler) error { … } // ProcessEnv returns FastCGI environment variables associated with the request r // for which no effort was made to be included in the request itself - the data // is hidden in the request's context. As an example, if REMOTE_USER is set for a // request, it will not be found anywhere in r, but it will be included in // ProcessEnv's response (via r's context). func ProcessEnv(r *http.Request) map[string]string { … } // addFastCGIEnvToContext reports whether to include the FastCGI environment variable s // in the http.Request.Context, accessible via ProcessEnv. func addFastCGIEnvToContext(s string) bool { … }