diff options
Diffstat (limited to 'devdocs/go/net%2Fhttp%2Fcgi%2Findex.html')
| -rw-r--r-- | devdocs/go/net%2Fhttp%2Fcgi%2Findex.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/devdocs/go/net%2Fhttp%2Fcgi%2Findex.html b/devdocs/go/net%2Fhttp%2Fcgi%2Findex.html new file mode 100644 index 00000000..c401bc1c --- /dev/null +++ b/devdocs/go/net%2Fhttp%2Fcgi%2Findex.html @@ -0,0 +1,48 @@ +<h1> Package cgi </h1> <ul id="short-nav"> +<li><code>import "net/http/cgi"</code></li> +<li><a href="#pkg-overview" class="overviewLink">Overview</a></li> +<li><a href="#pkg-index" class="indexLink">Index</a></li> +</ul> <h2 id="pkg-overview">Overview </h2> <p>Package cgi implements CGI (Common Gateway Interface) as specified in RFC 3875. </p> +<p>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. </p> <h2 id="pkg-index">Index </h2> <ul id="manual-nav"> +<li><a href="#Request">func Request() (*http.Request, error)</a></li> +<li><a href="#RequestFromMap">func RequestFromMap(params map[string]string) (*http.Request, error)</a></li> +<li><a href="#Serve">func Serve(handler http.Handler) error</a></li> +<li><a href="#Handler">type Handler</a></li> +<li> <a href="#Handler.ServeHTTP">func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request)</a> +</li> +</ul> <h3>Package files</h3> <p> <span>cgi_main.go</span> <span>child.go</span> <span>host.go</span> </p> <h2 id="Request">func <span>Request</span> </h2> <pre data-language="go">func Request() (*http.Request, error)</pre> <p>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. </p> +<h2 id="RequestFromMap">func <span>RequestFromMap</span> </h2> <pre data-language="go">func RequestFromMap(params map[string]string) (*http.Request, error)</pre> <p>RequestFromMap creates an <span>http.Request</span> from CGI variables. The returned Request's Body field is not populated. </p> +<h2 id="Serve">func <span>Serve</span> </h2> <pre data-language="go">func Serve(handler http.Handler) error</pre> <p>Serve executes the provided <a href="#Handler">Handler</a> 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 <span>http.DefaultServeMux</span>. </p> +<h2 id="Handler">type <span>Handler</span> </h2> <p>Handler runs an executable in a subprocess with a CGI environment. </p> +<pre data-language="go">type Handler struct { + Path string // path to the CGI executable + Root string // root URI prefix of handler or empty for "/" + + // Dir specifies the CGI executable's working directory. + // If Dir is empty, the base directory of Path is used. + // If Path has no base directory, the current working + // directory is used. + Dir string + + Env []string // extra environment variables to set, if any, as "key=value" + InheritEnv []string // environment variables to inherit from host, as "key" + Logger *log.Logger // optional log for errors or nil to use log.Print + Args []string // optional arguments to pass to child process + Stderr io.Writer // optional stderr for the child process; nil means os.Stderr; added in Go 1.7 + + // PathLocationHandler specifies the root http Handler that + // should handle internal redirects when the CGI process + // returns a Location header value starting with a "/", as + // specified in RFC 3875 ยง 6.3.2. This will likely be + // http.DefaultServeMux. + // + // If nil, a CGI response with a local URI path is instead sent + // back to the client and not redirected internally. + PathLocationHandler http.Handler +} +</pre> <h3 id="Handler.ServeHTTP">func (*Handler) <span>ServeHTTP</span> </h3> <pre data-language="go">func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request)</pre><div class="_attribution"> + <p class="_attribution-p"> + © Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br> + <a href="http://golang.org/pkg/net/http/cgi/" class="_attribution-link">http://golang.org/pkg/net/http/cgi/</a> + </p> +</div> |
