| AxKit2 documentation | view source | Contained in the AxKit2 distribution. |
CLASS->new( STRREF, IS_RESPONSE, IS_LAME )CLASS->new_response( [ CODE ] )$obj->parse_uri$obj->add_param( KEY, VALUE )$obj->param( [ KEY ] )$obj->http_code_english( [ CODE ] )$obj->code( CODE [, TEXT] )$obj->response_code$obj->request_method$obj->request_uri$obj->cookie( NAME )$obj->cookie( NAME, VALUE [, PARAMS] )$obj->filename( [ STRING ] )$obj->mime_type( [ STRING ] )$obj->path_info( [ STRING ] )$obj->version_number( [ VER ] )$obj->request_line$obj->header( KEY [, VALUE ] )$obj->lame_request$obj->to_string_ref$obj->clone$obj->set_version( VER )$obj->content_length$obj->req_keep_alive( RESPONSE_HEADERS )$obj->res_keep_alive_options$obj->res_keep_alive( REQUEST_HEADERS )$obj->range( SIZE )AxKit2::HTTPHeaders - HTTP Request and Response header class
This class parses and encapsulates HTTP headers, including the request/response line (e.g. GET / HTTP/1.0).
CLASS->new( STRREF, IS_RESPONSE, IS_LAME )Construct a new header object from the given STRREF. Assumes the header is
a response header if IS_RESPONSE is set. Assumes HTTP/0.9 if IS_LAME is
set.
CLASS->new_response( [ CODE ] )Create a new response header with response code CODE (default: 200 "OK").
Assumes response is HTTP/1.0.
$obj->parse_uriParse the request URI for querystring parameters.
$obj->add_param( KEY, VALUE )Add a new param (see $obj->param below).
$obj->param( [ KEY ] )Returns all params for KEY in LIST context, or the last param for KEY in
SCALAR context.
Returns a list of current params if KEY is not supplied.
$obj->http_code_english( [ CODE ] )Returns the english equivalent for HTTP response code CODE. If code is not
supplied uses the current response code (not valid for request headers).
$obj->code( CODE [, TEXT] )Sets the response code to CODE with optional TEXT.
$obj->response_codeGets the response code.
$obj->request_methodGets the request method (e.g. "GET", "POST", etc).
$obj->request_uriGets the request URI. Returns the full URI inclusive of query string.
Also callable as $obj->uri.
$obj->cookie( NAME )$obj->cookie( NAME, VALUE [, PARAMS] )$obj->filename( [ STRING ] )Gets/Sets the request filename value.
$obj->mime_type( [ STRING ] )Gets/Sets the request MIME type.
$obj->path_info( [ STRING ] )Gets/Sets the request path-info value.
$obj->version_number( [ VER ] )Gets/Sets the header version number. Uses the form MAJOR * 1000 + MINOR, so
HTTP/1.0 will return 1000 and HTTP/0.9 will return 9.
$obj->request_lineReturns the very first line of the request as seen.
$obj->header( KEY [, VALUE ] )Get/Set the value for a given header.
$obj->lame_requestReturns true if the request was a HTTP/0.9 request.
$obj->to_string_refReturns a reference to a string representing the headers in full.
$obj->cloneClone the current header object. Returns a new AxKit2::HTTPHeaders object.
$obj->set_version( VER )Set the HTTP version using the N.N format.
$obj->content_lengthUsing all available information, attempt to determine the content length of the message body being sent to us.
$obj->req_keep_alive( RESPONSE_HEADERS )Given $obj is the request headers, answers the question: "should a response
to this person specify keep-alive, given the request and the given response?"
This is used in proxy mode to determine based on the client's request and the backend's response whether or not the response from the proxy (us) should do keep-alive.
For normal responses (should a response be kept alive) see res_keep_alive.
$obj->res_keep_alive_optionsDetermine if an options response from a backend looks like it can do keep-alive.
$obj->res_keep_alive( REQUEST_HEADERS )Given $obj is the response headers, answers the question: "is the backend
expected to stay open?" this is a combination of the request we sent to it and
the response they sent...
You don't normally need to call this - it is automatically performed by the backend.
$obj->range( SIZE )Given a size, returns STATUS, RANGE_START, RANGE_END.
Status will be one of:
| AxKit2 documentation | view source | Contained in the AxKit2 distribution. |