fastcgi

package
v2.4.0-beta.2-forest Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BeginRequest is the begin request flag.
	BeginRequest uint8 = iota + 1
	// AbortRequest is the abort request flag.
	AbortRequest
	// EndRequest is the end request flag.
	EndRequest
	// Params is the parameters flag.
	Params
	// Stdin is the standard input flag.
	Stdin
	// Stdout is the standard output flag.
	Stdout
	// Stderr is the standard error flag.
	Stderr
	// Data is the data flag.
	Data
	// GetValues is the get values flag.
	GetValues
	// GetValuesResult is the get values result flag.
	GetValuesResult
	// UnknownType is the unknown type flag.
	UnknownType
	// MaxType is the maximum type flag.
	MaxType = UnknownType
)
View Source
const (
	// Responder is the responder flag.
	Responder uint8 = iota + 1
	// Authorizer is the authorizer flag.
	Authorizer
	// Filter is the filter flag.
	Filter
)
View Source
const (
	// RequestComplete is the completed request flag.
	RequestComplete uint8 = iota
	// CantMultiplexConns is the multiplexed connections flag.
	CantMultiplexConns
	// Overloaded is the overloaded flag.
	Overloaded
	// UnknownRole is the unknown role flag.
	UnknownRole
)
View Source
const (
	// MaxConns is the maximum connections flag.
	MaxConns string = "MAX_CONNS"
	// MaxRequests is the maximum requests flag.
	MaxRequests string = "MAX_REQS"
	// MultiplexConns is the multiplex connections flag.
	MultiplexConns string = "MPXS_CONNS"
)
View Source
const FCGIHeaderLen uint8 = 8

FCGIHeaderLen describes header length.

View Source
const FCGIKeepConn uint8 = 1

FCGIKeepConn describes keep connection mode.

View Source
const FCGIListenSockFileno uint8 = 0

FCGIListenSockFileno describes listen socket file number.

View Source
const FCGINullRequestID uint8 = 0

FCGINullRequestID describes the null request ID.

View Source
const Version1 uint8 = 1

Version1 describes the version.

Variables

This section is empty.

Functions

This section is empty.

Types

type FCGIClient

type FCGIClient struct {
	// contains filtered or unexported fields
}

FCGIClient implements a FastCGI client, which is a standard for interfacing external applications with Web servers.

func Dial

func Dial(network, address string) (fcgi *FCGIClient, err error)

Dial connects to the fcgi responder at the specified network address, using default net.Dialer. See func net.Dial for a description of the network and address parameters.

func DialContext

func DialContext(ctx context.Context, network, address string) (fcgi *FCGIClient, err error)

DialContext is like Dial but passes ctx to dialer.Dial.

func DialWithDialerContext

func DialWithDialerContext(ctx context.Context, network, address string, dialer net.Dialer) (fcgi *FCGIClient, err error)

DialWithDialerContext connects to the fcgi responder at the specified network address, using custom net.Dialer and a context. See func net.Dial for a description of the network and address parameters.

func (*FCGIClient) Close

func (c *FCGIClient) Close()

Close closes fcgi connection

func (*FCGIClient) Do

func (c *FCGIClient) Do(p map[string]string, req io.Reader) (r io.Reader, err error)

Do made the request and returns a io.Reader that translates the data read from fcgi responder out of fcgi packet before returning it.

func (*FCGIClient) Get

func (c *FCGIClient) Get(p map[string]string, body io.Reader, l int64) (resp *http.Response, err error)

Get issues a GET request to the fcgi responder.

func (*FCGIClient) Head

func (c *FCGIClient) Head(p map[string]string) (resp *http.Response, err error)

Head issues a HEAD request to the fcgi responder.

func (*FCGIClient) Options

func (c *FCGIClient) Options(p map[string]string) (resp *http.Response, err error)

Options issues an OPTIONS request to the fcgi responder.

func (*FCGIClient) Post

func (c *FCGIClient) Post(p map[string]string, method string, bodyType string, body io.Reader, l int64) (resp *http.Response, err error)

Post issues a POST request to the fcgi responder. with request body in the format that bodyType specified

func (*FCGIClient) PostFile

func (c *FCGIClient) PostFile(p map[string]string, data url.Values, file map[string]string) (resp *http.Response, err error)

PostFile issues a POST to the fcgi responder in multipart(RFC 2046) standard, with form as a string key to a list values (url.Values), and/or with file as a string key to a list file path.

func (*FCGIClient) PostForm

func (c *FCGIClient) PostForm(p map[string]string, data url.Values) (resp *http.Response, err error)

PostForm issues a POST to the fcgi responder, with form as a string key to a list values (url.Values)

func (*FCGIClient) Request

func (c *FCGIClient) Request(p map[string]string, req io.Reader) (resp *http.Response, err error)

Request returns a HTTP Response with Header and Body from fcgi responder

func (*FCGIClient) SetReadTimeout

func (c *FCGIClient) SetReadTimeout(t time.Duration) error

SetReadTimeout sets the read timeout for future calls that read from the fcgi responder. A zero value for t means no timeout will be set.

func (*FCGIClient) SetWriteTimeout

func (c *FCGIClient) SetWriteTimeout(t time.Duration) error

SetWriteTimeout sets the write timeout for future calls that send data to the fcgi responder. A zero value for t means no timeout will be set.

type Transport

type Transport struct {
	// Use this directory as the fastcgi root directory. Defaults to the root
	// directory of the parent virtual host.
	Root string `json:"root,omitempty"`

	// The path in the URL will be split into two, with the first piece ending
	// with the value of SplitPath. The first piece will be assumed as the
	// actual resource (CGI script) name, and the second piece will be set to
	// PATH_INFO for the CGI script to use.
	//
	// Future enhancements should be careful to avoid CVE-2019-11043,
	// which can be mitigated with use of a try_files-like behavior
	// that 404s if the fastcgi path info is not found.
	SplitPath []string `json:"split_path,omitempty"`

	// Path declared as root directory will be resolved to its absolute value
	// after the evaluation of any symbolic links.
	// Due to the nature of PHP opcache, root directory path is cached: when
	// using a symlinked directory as root this could generate errors when
	// symlink is changed without php-fpm being restarted; enabling this
	// directive will set $_SERVER['DOCUMENT_ROOT'] to the real directory path.
	ResolveRootSymlink bool `json:"resolve_root_symlink,omitempty"`

	// Extra environment variables.
	EnvVars map[string]string `json:"env,omitempty"`

	// The duration used to set a deadline when connecting to an upstream.
	DialTimeout caddy.Duration `json:"dial_timeout,omitempty"`

	// The duration used to set a deadline when reading from the FastCGI server.
	ReadTimeout caddy.Duration `json:"read_timeout,omitempty"`

	// The duration used to set a deadline when sending to the FastCGI server.
	WriteTimeout caddy.Duration `json:"write_timeout,omitempty"`
	// contains filtered or unexported fields
}

Transport facilitates FastCGI communication.

func (Transport) CaddyModule

func (Transport) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*Transport) Provision

func (t *Transport) Provision(ctx caddy.Context) error

Provision sets up t.

func (Transport) RoundTrip

func (t Transport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

func (*Transport) UnmarshalCaddyfile

func (t *Transport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile deserializes Caddyfile tokens into h.

transport fastcgi {
    root <path>
    split <at>
    env <key> <value>
    resolve_root_symlink
    dial_timeout <duration>
    read_timeout <duration>
    write_timeout <duration>
}

Jump to

Keyboard shortcuts

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