Functions
Flush
method
#
func (r *response) Flush()
Read
method
#
func (b neverEnding) Read(p []byte) (n int, err error)
Request
function
#
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)
RequestFromMap
function
#
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
function
#
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
ServeHTTP
method
#
func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request)
Write
method
#
func (r *response) Write(p []byte) (n int, err error)
cgiMain
function
#
func cgiMain()
childCGIProcess
function
#
childCGIProcess is used by integration_test to complete unit tests.
func childCGIProcess()
envMap
function
#
func envMap(env []string) map[string]string
handleInternalRedirect
method
#
func (h *Handler) handleInternalRedirect(rw http.ResponseWriter, req *http.Request, path string)
printf
method
#
func (h *Handler) printf(format string, v ...any)
removeLeadingDuplicates
function
#
removeLeadingDuplicates remove leading duplicate in environments.
It's possible to override environment like following.
cgi.Handler{
...
Env: []string{"SCRIPT_FILENAME=foo.php"},
}
func removeLeadingDuplicates(env []string) (ret []string)
stderr
method
#
func (h *Handler) stderr() io.Writer
testCGI
function
#
testCGI is a CGI program translated from a Perl program to complete host_test.
test cases in host_test should be provided by testCGI.
func testCGI()
upperCaseAndUnderscore
function
#
func upperCaseAndUnderscore(r rune) rune