scgiclient

package module
v0.0.0-...-88aedc8 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2017 License: Apache-2.0 Imports: 10 Imported by: 2

README

scgiclient

Because I needed to talk scgi to do [rtorrentrpc] 1

Install:

  1. Install Go: http://golang.org/doc/install
  2. go get github.com/mpl/scgiclient

Documentation

Overview

Package scgiclient implements the client side of the Simple Common Gateway Interface protocol, as described at http://python.ca/scgi/protocol.txt

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Addr   string
	Header []byte
	Body   []byte
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(addr string, body []byte) *Request

NewRequest returns a Request ready to be sent with Request.Send().

func (*Request) Close

func (r *Request) Close() error

Close closes the connection to r.Addr.

func (*Request) Receive

func (r *Request) Receive() (*Response, error)

Receive reads the response from r.Addr and returns it in a Response. The connection to r.Addr must already be established.

func (*Request) Send

func (r *Request) Send() (int64, error)

Send sends an scgi message built with r.Header and r.Body, to r.Addr. It returns the number of bytes sent and an error, if any.

type Response

type Response struct {
	Header map[string]string
	Body   []byte
	// contains filtered or unexported fields
}

func Send

func Send(addr string, r io.Reader) (*Response, error)

Send sends and scgi request to addr, with all the data read from r as the body of the request. The received response is returned and the connection to addr is closed.

func (*Response) Close

func (r *Response) Close() error

Close closes the connection to r.Addr.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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