Movatterモバイル変換


[0]ホーム

URL:


cgi

packagestandard library
go1.25.2Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License:BSD-3-ClauseImports:22Imported by:703

Details

Repository

cs.opensource.google/go/go

Links

Documentation

Overview

Package cgi implements CGI (Common Gateway Interface) as specifiedinRFC 3875.

Note that using CGI means starting a new process to handle eachrequest, which is typically less efficient than using along-running server. This package is intended primarily forcompatibility with existing systems.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcRequest

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

Request returns the HTTP request as represented in the currentenvironment. This assumes the current program is being runby a web server in a CGI environment.The returned Request's Body is populated, if applicable.

funcRequestFromMap

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

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

funcServe

func Serve(handlerhttp.Handler)error

Serve executes the providedHandler on the currently active CGIrequest, if any. If there's no current CGI environmentan error is returned. The provided handler may be nil to usehttp.DefaultServeMux.

Types

typeHandler

type Handler struct {Pathstring// path to the CGI executableRootstring// 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.DirstringEnv        []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.PrintArgs       []string// optional arguments to pass to child processStderrio.Writer// optional stderr for the child process; nil means os.Stderr// 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 inRFC 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.PathLocationHandlerhttp.Handler}

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

func (*Handler)ServeHTTP

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

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp