Documentation
¶
Index ¶
- Constants
- func CalculatePadding(dataLength int) (padding int)
- func GetContentsFromRecordsByType(recs []*Record, recordType RecordType) (contents []byte)
- func GetStdErrFromRecords(recs []*Record) (stderr []byte)
- func GetStdOutFromRecords(recs []*Record) (stdout []byte)
- func PaddingToBytes(paddingLength byte) (ba []byte, err error)
- func Uint16ToBytes(x uint16) (ba []byte)
- func Uint32ToBytes(x uint32) (ba []byte)
- func WritePaddingToBytesBuffer(buf *bytes.Buffer, paddingLength byte) (err error)
- func WriteParametersToBytesBuffer(buf *bytes.Buffer, parameters []*nvpair.NameValuePair) (err error)
- type BeginRequestBody
- type EndRequestBody
- type Header
- type ParameterName
- type ParameterValue
- type Record
- type RecordType
- type Role
- type UnknownTypeRequestBody
Constants ¶
const ( FCGI_REQUEST_COMPLETE = 0 FCGI_CANT_MPX_CONN = 1 FCGI_OVERLOADED = 2 FCGI_UNKNOWN_ROLE = 3 )
Protocol Status.
const ( FCGI_HEADER_LEN = 8 FCGI_VERSION_1 = 1 FCGI_NULL_REQUEST_ID = 0 )
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" )
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.
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.
const ( FCGI_RESPONDER = 1 FCGI_AUTHORIZER = 2 FCGI_FILTER = 3 )
Roles.
const (
FCGI_KEEP_CONN = 1
)
Flags.
const (
ParameterPrefix_Http = "HTTP_"
)
Variables ¶
This section is empty.
Functions ¶
func CalculatePadding ¶
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 ¶
GetStdErrFromRecords extracts stderr records from the list of records and concatenates their content.
func GetStdOutFromRecords ¶
GetStdOutFromRecords extracts stdout records from the list of records and concatenates their content.
func PaddingToBytes ¶
PaddingToBytes prepares the padding bytes.
func Uint16ToBytes ¶
Uint16ToBytes converts an uint16 into an array (slice) of bytes using the Big-Endian byte order.
func Uint32ToBytes ¶
Uint32ToBytes converts an uint32 into an array (slice) of bytes using the Big-Endian byte order.
func WritePaddingToBytesBuffer ¶
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 ¶
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 ¶
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 ¶
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;
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 ¶
FilterRecordsByRequestId returns only those records, that have the specified Request ID.
func (*Record) ParseContentAsNVPs ¶
type RecordType ¶
type RecordType = byte
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)