// Request returns the HTTP request as represented in the current // environment. This assumes the current program is being run // by a web server in a CGI environment. // The returned Request's Body is populated, if applicable. func Request() (*http.Request, error) { … } func envMap(env []string) map[string]string { … } // RequestFromMap creates an [http.Request] from CGI variables. // The returned Request's Body field is not populated. func RequestFromMap(params map[string]string) (*http.Request, error) { … } // Serve executes the provided [Handler] on the currently active CGI // request, if any. If there's no current CGI environment // an error is returned. The provided handler may be nil to use // [http.DefaultServeMux]. func Serve(handler http.Handler) error { … } type response … func (r *response) Flush() { … } 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) { … }