Next: Posting Data, Previous: Server Configuration, Up: Server [Contents][Index]
There isn’t much here yet. Maybe you can help?
Each HTTP request produces a UserRequest
associated with a UserSession.
Sessions are tightly coupled with PHP24;
an existing PHP session is expected,
as identified by the ‘PHPSESSID’ cookie.
Sessions are shared via Memcache
(see ResilientMemcache).25
If a session is not found (or is invalid),
an HTTP 500
status code is returned and the
HTTP request is aborted.
Requests are subject to a 120 second timeout,
after which the request will be served an HTTP 408
status code.
Note that this does not stop background processing—this timeout exists to prevent the user from hanging indefinitely.
If a process intends to perform background processing for any length of time (longer than a few seconds), it should complete the request as quickly as possible and use some other mechanism to report back progress (e.g. polling).
The UserRequest exposes raw request data with minor processing.
#getUri
)The path component of the URI. The method name is unfortunate.
#getGetData
)Query string processed into a key/value object. Despite the name, this is also populated if non-GET requests contain query strings.
#getPostData
)POST data processed into an object as if it were a query string
(just as #getGetData
).
Since this requires data that is streamed asynchronously,
this method takes a callback that waits for all data to become
available;
if the data are already available,
it is immediately invoked with the processed POST data.
#getCookies
)Cookies parsed into a key/value object.
#getRemoteAddr
)IP address of the origin of the request. If the server is behind a proxy that sets the ‘X-Forwarded-For’ header, it is used instead.
#getHostAddr
)Hostname of the server. If the server is behind a proxy that sets the ‘X-Forwarded-Host’ header, it is used instead.
#getOrigin
)Origin of request. Only available if at lease one of the ‘Origin’ or ‘Referer’ headers are set. This is useful mainly for determining the protocol and host while behind a proxy.
#getUserAgent
)The user agent string of the request.
#getSessionId
)The user’s unique session id (‘PHPSESSID’).
#getSessionIdName
)The name of the cookie from which the session ID originated (hard-coded to ‘PHPSESSID’).
TODO: Document return format and writing response data.
Next: Posting Data, Previous: Server Configuration, Up: Server [Contents][Index]