fastcgi

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

*

  • library to parse fastcgi protocol

Index

Constants

View Source
const (
	TypeBeginRequest    recType = 1
	TypeAbortRequest    recType = 2
	TypeEndRequest      recType = 3
	TypeParams          recType = 4
	TypeStdin           recType = 5
	TypeStdout          recType = 6
	TypeStderr          recType = 7
	TypeData            recType = 8
	TypeGetValues       recType = 9
	TypeGetValuesResult recType = 10
	TypeUnknownType     recType = 11
)
View Source
const (
	HeaderSize = 8
)
View Source
const (
	Version = uint8(1)
)

Variables

View Source
var (
	FastCGIRequestHeader  = []byte{0x1, 0x1, 0x0, 0x1, 0x0, 0x8}
	FastCGIResponseHeader = []byte{0x1, 0x6, 0x0, 0x1}
)

Functions

func Decode

func Decode(origin []byte) (string, error)

func Encode

func Encode(reqId uint16, http *Http) ([]byte, error)

Types

type BeginRequest

type BeginRequest struct {
	Role     uint16
	Flags    uint8
	Reserved [5]uint8
}

func (*BeginRequest) GetType

func (br *BeginRequest) GetType() recType

type EndRequest

type EndRequest struct {
	AppStatus      uint32
	ProtocolStatus uint8
	Reserved       [3]uint8
}

func (*EndRequest) GetType

func (br *EndRequest) GetType() recType
type Header struct {
	Version       uint8
	Type          recType
	Id            uint16
	ContentLength uint16
	PaddingLength uint8
	Reserved      uint8
}

func ParseHeader

func ParseHeader(buf *bytes.Buffer) (*Header, error)

func (*Header) ParseRecord

func (h *Header) ParseRecord(buf *bytes.Buffer) (Record, error)

func (*Header) ReadLength

func (h *Header) ReadLength(r io.Reader, order binary.ByteOrder, data *int) error

type Http

type Http struct {
	IsRequest bool              // true: request, false: response
	Header    map[string]string // http header
	BodyIn    []byte            // http body (in)
	BodyOut   []byte            // http body (out)
	BodyErr   []byte            // http body (err)
}

func NewHttp

func NewHttp() *Http

func (*Http) Generate

func (http *Http) Generate() (string, error)

type Params

type Params struct {
	Maps map[string]string
}

func (*Params) GetType

func (br *Params) GetType() recType

type Record

type Record interface {
	GetType() recType
}

type StderrResponse

type StderrResponse struct {
	Data []byte
}

func (*StderrResponse) GetType

func (br *StderrResponse) GetType() recType

type StdinRequest

type StdinRequest struct {
	Data []byte
}

func (*StdinRequest) GetType

func (br *StdinRequest) GetType() recType

type StdoutResponse

type StdoutResponse struct {
	Data []byte
}

func (*StdoutResponse) GetType

func (br *StdoutResponse) GetType() recType

type UnknownType

type UnknownType struct {
	Type     uint8
	Reserved [7]uint8
}

func (*UnknownType) GetType

func (br *UnknownType) GetType() recType

Jump to

Keyboard shortcuts

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