Documentation
¶
Index ¶
- Constants
- func ExecPhpScript(client *cl.Client, requestId uint16, parameters []*nvpair.NameValuePair, ...) (stdOut []byte, stdErr []byte, err error)
- func ParseStatus(statusValue string) (statusCode uint, statusText string, err error)
- func RunOncePhpScript(serverNetwork string, serverAddress string, requestId uint16, ...) (stdOut []byte, stdErr []byte, err error)
- func RunOnceSimplePhpScript(serverNetwork string, serverAddress string, scriptFilePath string) (stdOut []byte, stdErr []byte, err error)
- type Data
- func ExecPhpScriptAndGetHttpData(client *cl.Client, requestId uint16, parameters []*nvpair.NameValuePair, ...) (data *Data, err error)
- func RunOncePhpScriptAndGetHttpData(serverNetwork string, serverAddress string, requestId uint16, ...) (data *Data, err error)
- func RunOnceSimplePhpScriptAndGetHttpData(serverNetwork string, serverAddress string, scriptFilePath string) (data *Data, err error)
- func SplitHeadersFromStdout(stdout []byte) (data *Data, err error)
- type Header
- type OldSchoolStyleData
- type PhpScriptInfo
Constants ¶
const ( HeaderNameValueDelimiter = ":" // Status is a virtual HTTP header. It looks like PHP returns HTTP status // information inside a virtual HTTP header named 'Status'. Status = "status" OldRelativeUrlMarker = `./` ForwardSlash = `/` )
const ( ErrNoHeaderOnLine = "no header on line: %v" ErrHeaderNameIsEmpty = "header name is empty: %v" ErrHeaderValueIsEmpty = "header value is empty: %v" ErrTooManyRelativeUrlMarkers = "too many relative URL markers: %v" )
const (
QueryParamExtraPath = "extrapath"
)
Variables ¶
This section is empty.
Functions ¶
func ExecPhpScript ¶
func ExecPhpScript(client *cl.Client, requestId uint16, parameters []*nvpair.NameValuePair, stdin []byte) (stdOut []byte, stdErr []byte, err error)
ExecPhpScript executes a PHP script using the specified client. Path to the script file must be set as a 'SCRIPT_FILENAME' parameter inside the 'parameters' argument.
func ParseStatus ¶
ParseStatus parses information about HTTP status returned by PHP.
func RunOncePhpScript ¶
func RunOncePhpScript(serverNetwork string, serverAddress string, requestId uint16, parameters []*nvpair.NameValuePair, stdin []byte) (stdOut []byte, stdErr []byte, err error)
RunOncePhpScript runs a PHP script once. Path to the script file must be set as a 'SCRIPT_FILENAME' parameter inside the 'parameters' argument.
func RunOnceSimplePhpScript ¶
func RunOnceSimplePhpScript(serverNetwork string, serverAddress string, scriptFilePath string) (stdOut []byte, stdErr []byte, err error)
RunOnceSimplePhpScript runs a simple PHP script once and gets its output. Only the `SCRIPT_FILENAME` parameter is provided to the PHP script, that is why it is simple. The PHP-CGI server must be started manually before running this function.
Types ¶
type Data ¶
Data is data returned by a PHP script.
func ExecPhpScriptAndGetHttpData ¶
func ExecPhpScriptAndGetHttpData(client *cl.Client, requestId uint16, parameters []*nvpair.NameValuePair, stdin []byte) (data *Data, err error)
ExecPhpScriptAndGetHttpData executes a PHP script using the specified client, gets its output, splits the output into HTTP headers and HTTP body. Path to the script file must be set as a 'SCRIPT_FILENAME' parameter inside the 'parameters' argument. The PHP-CGI server must be started manually before running this function.
func RunOncePhpScriptAndGetHttpData ¶
func RunOncePhpScriptAndGetHttpData(serverNetwork string, serverAddress string, requestId uint16, parameters []*nvpair.NameValuePair, stdin []byte) (data *Data, err error)
RunOncePhpScriptAndGetHttpData runs a PHP script once, gets its output, splits the output into HTTP headers and HTTP body. Path to the script file must be set as a 'SCRIPT_FILENAME' parameter inside the 'parameters' argument. The PHP-CGI server must be started manually before running this function.
func RunOnceSimplePhpScriptAndGetHttpData ¶
func RunOnceSimplePhpScriptAndGetHttpData(serverNetwork string, serverAddress string, scriptFilePath string) (data *Data, err error)
RunOnceSimplePhpScriptAndGetHttpData runs a simple PHP script once, gets its output, splits the output into HTTP headers and HTTP body. Only the `SCRIPT_FILENAME` parameter is provided to the PHP script, that is why it is simple. The PHP-CGI server must be started manually before running this function.
func SplitHeadersFromStdout ¶
SplitHeadersFromStdout splits PHP stdout stream into HTTP headers and HTTP body.
func (*Data) FixLocationHeader ¶ added in v0.12.0
FixLocationHeader fixes relative URLs in 'Location' HTTP headers. 'currentUrlPath' is the value of 'URL.Path' of the current request.
type Header ¶
Header is an HTTP header returned by a PHP script.
func ParseHeader ¶
ParseHeader parses a PHP output line of text containing the HTTP header.
type OldSchoolStyleData ¶ added in v0.13.0
type PhpScriptInfo ¶ added in v0.13.0
type PhpScriptInfo struct { // Paths in URL format, // i.e. with forward slashes. OriginalUrlPath string UrlRelPath string UrlExtraPath string // Paths in file system format, // i.e. with separators of an operating system. FilePath string FileName string FileExt string FileAbsPath string FileAbsExtraPath string // A special parameter for storing CGI extra path. // This parameter is used to move extra path from path to a query parameter // in order to make CGI requests compatible with modern HTTP standard. QueryParamExtraPath string }