dm

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FCGI_REQUEST_COMPLETE = 0
	FCGI_CANT_MPX_CONN    = 1
	FCGI_OVERLOADED       = 2
	FCGI_UNKNOWN_ROLE     = 3
)

Protocol Status.

View Source
const (
	FCGI_HEADER_LEN      = 8
	FCGI_VERSION_1       = 1
	FCGI_NULL_REQUEST_ID = 0
)
View Source
const (
	Parameter_AuthType         = "AUTH_TYPE"
	Parameter_ContentLength    = "CONTENT_LENGTH"
	Parameter_ContentType      = "CONTENT_TYPE"
	Parameter_DocumentRoot     = "DOCUMENT_ROOT"
	Parameter_DocumentUri      = "DOCUMENT_URI"
	Parameter_GatewayInterface = "GATEWAY_INTERFACE"
	Parameter_PathInfo         = "PATH_INFO"
	Parameter_PathTranslated   = "PATH_TRANSLATED"
	Parameter_QueryString      = "QUERY_STRING"
	Parameter_RemoteAddr       = "REMOTE_ADDR"
	Parameter_RemoteHost       = "REMOTE_HOST"
	Parameter_RemoteIdent      = "REMOTE_IDENT"
	Parameter_RemotePort       = "REMOTE_PORT"
	Parameter_RemoteUser       = "REMOTE_USER"
	Parameter_RequestMethod    = "REQUEST_METHOD"
	Parameter_RequestUri       = "REQUEST_URI"
	Parameter_ScriptFilename   = "SCRIPT_FILENAME"
	Parameter_ScriptName       = "SCRIPT_NAME"
	Parameter_ServerAddr       = "SERVER_ADDR"
	Parameter_ServerName       = "SERVER_NAME"
	Parameter_ServerPort       = "SERVER_PORT"
	Parameter_ServerProtocol   = "SERVER_PROTOCOL"
	Parameter_ServerSoftware   = "SERVER_SOFTWARE"
)
View Source
const (
	Parameter_Https              = "HTTPS"
	Parameter_OrigPathInfo       = "ORIG_PATH_INFO"
	Parameter_PhpAuthDigest      = "PHP_AUTH_DIGEST"
	Parameter_PhpAuthPw          = "PHP_AUTH_PW"
	Parameter_PhpAuthUser        = "PHP_AUTH_USER"
	Parameter_PhpSelf            = "PHP_SELF"
	Parameter_RedirectRemoteUser = "REDIRECT_REMOTE_USER"
	Parameter_RedirectStatus     = "REDIRECT_STATUS"
	Parameter_RequestScheme      = "REQUEST_SCHEME"
	Parameter_RequestTimeFloat   = "REQUEST_TIME_FLOAT"
	Parameter_ServerAdmin        = "SERVER_ADMIN"
	Parameter_ServerSignature    = "SERVER_SIGNATURE"
)

PHP Parameters.

View Source
const (
	FCGI_BEGIN_REQUEST     = 1
	FCGI_ABORT_REQUEST     = 2
	FCGI_END_REQUEST       = 3
	FCGI_PARAMS            = 4
	FCGI_STDIN             = 5
	FCGI_STDOUT            = 6
	FCGI_STDERR            = 7
	FCGI_DATA              = 8
	FCGI_GET_VALUES        = 9
	FCGI_GET_VALUES_RESULT = 10
	FCGI_UNKNOWN_TYPE      = 11
	FCGI_MAXTYPE           = FCGI_UNKNOWN_TYPE
)

Record Types.

View Source
const (
	FCGI_RESPONDER  = 1
	FCGI_AUTHORIZER = 2
	FCGI_FILTER     = 3
)

Roles.

View Source
const (
	FCGI_KEEP_CONN = 1
)

Flags.

View Source
const (
	ParameterPrefix_Http = "HTTP_"
)

Variables

This section is empty.

Functions

func CalculatePadding

func CalculatePadding(dataLength int) (padding int)

CalculatePadding calculates the required padding size. FastCGI Specification recommends aligning data by 8 bytes.

func GetContentsFromRecordsByType

func GetContentsFromRecordsByType(recs []*Record, recordType RecordType) (contents []byte)

GetContentsFromRecordsByType extracts contents from records having the specified type, concatenates it and returns it.

func GetStdErrFromRecords

func GetStdErrFromRecords(recs []*Record) (stderr []byte)

GetStdErrFromRecords extracts stderr records from the list of records and concatenates their content.

func GetStdOutFromRecords

func GetStdOutFromRecords(recs []*Record) (stdout []byte)

GetStdOutFromRecords extracts stdout records from the list of records and concatenates their content.

func PaddingToBytes

func PaddingToBytes(paddingLength byte) (ba []byte, err error)

PaddingToBytes prepares the padding bytes.

func Uint16ToBytes

func Uint16ToBytes(x uint16) (ba []byte)

Uint16ToBytes converts an uint16 into an array (slice) of bytes using the Big-Endian byte order.

func Uint32ToBytes

func Uint32ToBytes(x uint32) (ba []byte)

Uint32ToBytes converts an uint32 into an array (slice) of bytes using the Big-Endian byte order.

func WritePaddingToBytesBuffer

func WritePaddingToBytesBuffer(buf *bytes.Buffer, paddingLength byte) (err error)

WritePaddingToBytesBuffer puts th padding into a buffer of bytes.

func WriteParametersToBytesBuffer

func WriteParametersToBytesBuffer(buf *bytes.Buffer, parameters []*nvpair.NameValuePair) (err error)

WriteParametersToBytesBuffer puts parameters into a buffer of bytes.

Types

type BeginRequestBody

type BeginRequestBody struct {
	Role     Role
	Flags    byte
	Reserved [5]byte
}
typedef struct {
	unsigned char roleB1;
	unsigned char roleB0;
	unsigned char flags;
	unsigned char reserved[5];
} FCGI_BeginRequestBody;

func NewBeginRequestBody

func NewBeginRequestBody(role Role, flags byte) (brb BeginRequestBody)

func (BeginRequestBody) ToBytes

func (brb BeginRequestBody) ToBytes() (ba []byte)

type EndRequestBody

type EndRequestBody struct {
	AppStatus      uint32
	ProtocolStatus byte
	Reserved       [3]byte
}
typedef struct {
	unsigned char appStatusB3;
	unsigned char appStatusB2;
	unsigned char appStatusB1;
	unsigned char appStatusB0;
	unsigned char protocolStatus;
	unsigned char reserved[3];
} FCGI_EndRequestBody;

func NewEndRequestBody

func NewEndRequestBody(appStatus uint32, protocolStatus byte) (erb EndRequestBody)

func (EndRequestBody) ToBytes

func (erb EndRequestBody) ToBytes() (ba []byte)
type Header struct {
	Version       byte
	Type          RecordType
	RequestId     uint16
	ContentLength uint16
	PaddingLength byte
	Reserved      byte
}
typedef struct {
	unsigned char version;
	unsigned char type;
	unsigned char requestIdB1;
	unsigned char requestIdB0;
	unsigned char contentLengthB1;
	unsigned char contentLengthB0;
	unsigned char paddingLength;
	unsigned char reserved;
} FCGI_Header;

func (Header) ToBytes

func (h Header) ToBytes() (ba []byte)

type ParameterName

type ParameterName = string

type ParameterValue

type ParameterValue = []byte

type Record

type Record struct {
	Version       byte
	Type          RecordType
	RequestId     uint16
	ContentLength uint16
	PaddingLength byte
	Reserved      byte

	ContentData []byte
	PaddingData []byte
}
typedef struct {
	unsigned char version;
	unsigned char type;
	unsigned char requestIdB1;
	unsigned char requestIdB0;
	unsigned char contentLengthB1;
	unsigned char contentLengthB0;
	unsigned char paddingLength;
	unsigned char reserved;
	unsigned char contentData[contentLength];
	unsigned char paddingData[paddingLength];
} FCGI_Record;

func FilterRecordsByRequestId

func FilterRecordsByRequestId(recsInput []*Record, requestId uint16) (recsOutput []*Record)

FilterRecordsByRequestId returns only those records, that have the specified Request ID.

func NewRecordFromStream

func NewRecordFromStream(stream io.Reader) (rec *Record, err error)

func (*Record) ParseContentAsNVPs

func (r *Record) ParseContentAsNVPs() (nvps []*nvpair.NameValuePair, err error)

func (*Record) ToBytes

func (r *Record) ToBytes() (ba []byte, err error)

type RecordType

type RecordType = byte

type Role

type Role = uint16

type UnknownTypeRequestBody

type UnknownTypeRequestBody struct {
	Type     RecordType
	Reserved [7]byte
}
 typedef struct {
	unsigned char type;
	unsigned char reserved[7];
} FCGI_UnknownTypeBody;

func NewUnknownTypeRequestBody

func NewUnknownTypeRequestBody(recordType RecordType) (utrb UnknownTypeRequestBody)

func (UnknownTypeRequestBody) ToBytes

func (utrb UnknownTypeRequestBody) ToBytes() (ba []byte)

Jump to

Keyboard shortcuts

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