import "github.com/spakin/gosp/src/gosp"
Package gosp provides all of the types, functions, and values needed to compile a generated Gosp server. RequestData, Open, and perhaps LiesInOrBelow are the only things defined by this package that an end user should care about. Everything else is used internally by the Gosp server.
Fprintf is merely a renamed fmt.Fprintf.
LiesInOrBelow returns true if a child file or directory lies in or below a parent directory (or is the parent directory).
LogDebugMessage asks the Web server to write a debug message to its log file.
Open is a wrapper for os.Open that allows opening only those files that lie within or below the current directory.
ReportPanic alerts the Web server that the Gosp server encountered an unexpected error. It should be called from a deferred function in GospGeneratePage.
SetHTTPStatus tells the Web server what HTTP status code it should return.
SetHeaderField provides a field name and value for the Web server to include in the HTTP header. If repl is true, the value replaces any prior value for the field. If repl is false, the field and value are appended to the existing set of {field name, value} pairs.
SetMIMEType tells the Web server what MIME type it should return.
KeyValue represents a metadata key:value pair.
Metadata is a channel on which we can send HTTP metadata.
type RequestData struct { Scheme string // HTTP scheme ("http" or "https") LocalHostname string // Name of the local host Port int // Port number to which the request was issued URI string // Path portion of the URI PathInfo string // Additional text following the Gosp filename QueryArgs string // Query arguments from the request URL string // Complete URL requested Method string // Request method ("GET", "POST", etc.) RequestLine string // First line of the request (e.g., "GET / HTTP/1.1") RequestTime int64 // Request time in nanoseconds since the Unix epoch RemoteHostname string // Name of the remote host RemoteIP string // IP address of the remote host Filename string // Local filename of the Gosp page PostData map[string]string // {Key, value} pairs sent by a POST request GetData map[string]string // {Key, value} pairs sent by a GET request (parsed version of QueryArgs) HeaderData map[string]string // Request headers as {key, value} pairs AdminEmail string // Email address of the Web server administrator Environment map[string]string // Environment variables passed in from the server }
RequestData encapsulates Web-server information passed into a Gosp server. Many of its fields come from the client. Those should therefore not be used without first checking them for invalid or malicious content.
Writer is merely a renamed io.Writer.
Package gosp imports 8 packages (graph). Updated 2019-12-01. Refresh now. Tools for package owners.