Carapace

HttpRequest Class

An HttpRequest object encapsulates the data sent across HTTP as a request for a resource. The data it holds is defined in the HTTP specification RFC 1945

HttpRequest Creation

The create function can be used to create a HttpRequest object eg.

    (create HttpRequest)

This is typically created by receiving data from an HTTP connection.

Once created, this object is tailored using its properties and methods.

HttpRequest Properties

A HttpRequest module supports the following properties:

property name property type description
url Url the requested URL
major Integer the major version of the HTTP protocol
minor Integer the minor version of the HTTP protocol
headers List attribute-value list of string pairs which hold the header information sent with the request
headerTable HashTable table of lower-case keys --> value
cookies HashTable table of cookieName --> value
method String the requested method -- usually either GET or PUT
contentType String the way the data sent with the request is encoded -- eg. application/text
contentEncoding String modifier on the contentType eg. x-gzip
data Binary the data sent with the request
formData List the data split into an attribute/value list
peer List list of (ipAddress, port) of the agent sending this request
environments WebEnvironments the complete set of web environments when running within an HTML template
root String the complete set of web environments when running within an HTML template

HttpRequest Methods

The HttpRequest object supports the following method:

method name description
headerString convert the headers into a string
connectionId return the connectionId
setConnectionId set the CarapaceConnection cookie
path return the path associated with this request
shift change the contained URL
checkConnection check the environment exists and, if so, check the owner can access the supplied resource


headerString

Convert the headers into a string.

Arguments: none

Return type: String


connectionId

Return the connectionId -- ie. the cookie CarapaceConnection.

Arguments: none

Return type: Object


setConnectionId

Set the CarapaceConnection cookie.

Arguments:

idString

Return type: the empty List


path

Return the path associated with this request. This treats the URL as describing a path, using the root property to define the starting point.

Arguments: none

Return type: String


shift

Change the contained URL.

Arguments:

newFragmentString

Return type: HttpRequest


checkConnection

Check the environment exists and, if so, check the owner can access the supplied resource.

If the check fails, an Error is raised.

Arguments:

envObject
resourceNameString

Return type: the empty List


Contents Index Current topic: communications Related topics: communications classes, HTTP response