Back to godoc.org
github.com/Elegant996/scgi-transport

Package scgi

v0.1.0
Latest Go to latest

The latest major version is .

Published: May 10, 2020 | License: Apache-2.0 | Module: github.com/Elegant996/scgi-transport

Index

type SCGIClient

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

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

func Dial

func Dial(network, address string) (scgi *SCGIClient, err error)

Dial connects to the scgi 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) (scgi *SCGIClient, 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) (scgi *SCGIClient, err error)

DialWithDialerContext connects to the scgi 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 (*SCGIClient) Close

func (c *SCGIClient) Close()

Close closes scgi connection

func (*SCGIClient) Do

func (c *SCGIClient) 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 scgi responder out of scgi packet before returning it.

func (*SCGIClient) Get

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

Get issues a GET request to the scgi responder.

func (*SCGIClient) Head

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

Head issues a HEAD request to the scgi responder.

func (*SCGIClient) Post

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

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

func (*SCGIClient) Request

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

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

func (*SCGIClient) SetReadTimeout

func (c *SCGIClient) 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 (*SCGIClient) SetWriteTimeout

func (c *SCGIClient) 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 scgi path info is not found.
	SplitPath []string `json:"split_path,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 SCGI server.
	ReadTimeout caddy.Duration `json:"read_timeout,omitempty"`

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

Transport facilitates SCGI 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 scgi {
    root <path>
    split <at>
    env <key> <value>
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier