cgi

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875.

Note that using CGI means starting a new process to handle each request, which is typically less efficient than using a long-running server. This package is intended primarily for compatibility with existing systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Request

func Request() (*http.Request, error)

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 RequestFromMap

func RequestFromMap(params map[string]string) (*http.Request, error)

RequestFromMap creates an http.Request from CGI variables. The returned Request's Body field is not populated.

func Serve

func Serve(handler http.Handler) 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.

Types

type Handler

type Handler struct {
	Path string
	Root string

	Dir string

	Env        []string
	InheritEnv []string
	Logger     *log.Logger
	Args       []string
	Stderr     io.Writer

	PathLocationHandler http.Handler
}

Handler runs an executable in a subprocess with a CGI environment.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL