|
Zen API
|
Supports HTTP server request parsing.
Inheritance diagram for kHttpServerRequest:Public Member Functions | |
| kStatus | kHttpServerRequest_BeginRead (kHttpServerRequest request, k64u *length, kStream *stream) |
| Begins reading the message body. More... | |
| k64s | kHttpServerRequest_ContentLength (kHttpServerRequest request) |
| Reports the total message length for a simple (non-chunk-encoded) message. More... | |
| const kChar * | kHttpServerRequest_FindHeaderValue (kHttpServerRequest request, const kChar *name) |
| Finds the header field value associated with the given header field name, if present. More... | |
| kPointer | kHttpServerRequest_FirstHeader (kHttpServerRequest request) |
| Gets a reference to the first header. More... | |
| kBool | kHttpServerRequest_HasBody (kHttpServerRequest request) |
| Reports whether the request has an associated message body. More... | |
| kSize | kHttpServerRequest_HeaderCount (kHttpServerRequest request) |
| Returns the total count of headers parsed from this request. More... | |
| const kChar * | kHttpServerRequest_HeaderName (kHttpServerRequest request, kPointer header) |
| Gets the field name associated with a header reference. More... | |
| const kChar * | kHttpServerRequest_HeaderValue (kHttpServerRequest request, kPointer header) |
| Gets the field value associated with a header reference. More... | |
| kBool | kHttpServerRequest_IsChunkCoded (kHttpServerRequest request) |
| Reports whether the message body is chunk-encoded. More... | |
| const kChar * | kHttpServerRequest_Method (kHttpServerRequest request) |
| Returns a string representing the HTTP request method (e.g. More... | |
| kPointer | kHttpServerRequest_NextHeader (kHttpServerRequest request, kPointer header) |
| Given a header reference, gets a reference to the next header. More... | |
| const kChar * | kHttpServerRequest_Uri (kHttpServerRequest request) |
| Returns a string representing the HTTP request URI (/resources/page.html). More... | |
| const kChar * | kHttpServerRequest_UriPath (kHttpServerRequest request) |
| Returns a string representing the HTTP request URI in absolute path form (/resources/page.html). More... | |
| kVersion | kHttpServerRequest_Version (kHttpServerRequest request) |
| Returns a value representing the HTTP version associated with this request. More... | |
| kAlloc | kObject_Alloc (kObject object) |
| Gets the memory allocator associated with this object. More... | |
| kStatus | kObject_Clone (kObject *object, kObject source, kAlloc allocator) |
| Constructs a new object by copying an existing object, including any aggregated child elements. More... | |
| kStatus | kObject_Destroy (kObject object) |
| Destroys the object. More... | |
| kStatus | kObject_Dispose (kObject object) |
| Destroys the object and any aggregated child elements. More... | |
| kBool | kObject_Equals (kObject object, kObject other) |
| Determines whether the object is equal to another object. More... | |
| kSize | kObject_HashCode (kObject object) |
| Gets a hash code representing the state of this object. More... | |
| kBool | kObject_Is (kObject object, kType type) |
| Determines whether this object is an instance of the specified type. More... | |
| kBool | kObject_IsShared (kObject object) |
| Reports whether the object is currently shared (reference count greater than one). More... | |
| kStatus | kObject_SetPool (kObject object, kObjectPool pool) |
| Sets the object pool associated with this object. More... | |
| kStatus | kObject_Share (kObject object) |
| Increments the reference count associated with this object. More... | |
| kSize | kObject_Size (kObject object) |
| Estimates the memory consumed by this object, including any aggregated child elements. More... | |
| kType | kObject_Type (kObject object) |
| Returns the type of the object. More... | |
| kStatus kHttpServerRequest_BeginRead | ( | kHttpServerRequest | request, |
| k64u * | length, | ||
| kStream * | stream | ||
| ) |
Begins reading the message body.
For simple messages, call this function once to receive the total message length and a reference to a stream object that can be used to read the entire message.
For chunk-encoded messages, call this function to receive the length of the next chunk and a reference to a stream object that can be used to read the chunk. Each individual chunk must be read out before this function can be used to learn about the next chunk. Reading is complete when a length of zero is reported by this function.
| request | Request object. |
| length | Receives the amount of data, in bytes, that should be read from the stream. |
| stream | Receives a reference to a stream object that should be used to read message content. |
| k64s kHttpServerRequest_ContentLength | ( | kHttpServerRequest | request | ) |
Reports the total message length for a simple (non-chunk-encoded) message.
| request | Request object. |
| const kChar * kHttpServerRequest_FindHeaderValue | ( | kHttpServerRequest | request, |
| const kChar * | name | ||
| ) |
Finds the header field value associated with the given header field name, if present.
| request | Request object. |
| name | Header field name. |
| kPointer kHttpServerRequest_FirstHeader | ( | kHttpServerRequest | request | ) |
Gets a reference to the first header.
| request | Request object. |
| kBool kHttpServerRequest_HasBody | ( | kHttpServerRequest | request | ) |
Reports whether the request has an associated message body.
| request | Request object. |
| kSize kHttpServerRequest_HeaderCount | ( | kHttpServerRequest | request | ) |
Returns the total count of headers parsed from this request.
The headers reported by this function can include both leading and trailing headers. However, trailing headers are only reported after the final segment of a chunk-encoded message is parsed.
| request | Request object. |
| const kChar * kHttpServerRequest_HeaderName | ( | kHttpServerRequest | request, |
| kPointer | header | ||
| ) |
Gets the field name associated with a header reference.
HTTP header field names are case-insensitive. To avoid ambiguity, the kHttpServerRequest class converts all header names to Pascal caps (e.g. "Content-Length").
| request | Request object. |
| header | Header reference. |
| const kChar * kHttpServerRequest_HeaderValue | ( | kHttpServerRequest | request, |
| kPointer | header | ||
| ) |
Gets the field value associated with a header reference.
| request | Request object. |
| header | Header reference. |
| kBool kHttpServerRequest_IsChunkCoded | ( | kHttpServerRequest | request | ) |
Reports whether the message body is chunk-encoded.
| request | Request object. |
| const kChar * kHttpServerRequest_Method | ( | kHttpServerRequest | request | ) |
Returns a string representing the HTTP request method (e.g.
"GET", "POST").
| request | Request object. |
| kPointer kHttpServerRequest_NextHeader | ( | kHttpServerRequest | request, |
| kPointer | header | ||
| ) |
Given a header reference, gets a reference to the next header.
| request | Request object. |
| header | Current header. |
| const kChar * kHttpServerRequest_Uri | ( | kHttpServerRequest | request | ) |
Returns a string representing the HTTP request URI (/resources/page.html).
The URI can be in absolute URI form (http://www.example.com/index.html) or absolute path form (/index.html). Use the kHttpServerRequest_UriPath function to access the URI in absolute path form.
| request | Request object. |
| const kChar * kHttpServerRequest_UriPath | ( | kHttpServerRequest | request | ) |
Returns a string representing the HTTP request URI in absolute path form (/resources/page.html).
| request | Request object. |
| kVersion kHttpServerRequest_Version | ( | kHttpServerRequest | request | ) |
Returns a value representing the HTTP version associated with this request.
| request | Request object. |
Gets the memory allocator associated with this object.
Most objects are constructed with an allocator, which is used to allocate the memory required by the object. Objects retain a reference to this allocator to enable further allocations and to free memory when the object is destroyed.
| object | Object. |
Constructs a new object by copying an existing object, including any aggregated child elements.
If the source object is an object collection (e.g. kArrayList<kString>), any aggregated child objects are also cloned. In this case, the kObject_Dispose method can be used to free the cloned collection and its associated elements.
This method will fail if the source object (or an aggregated child element) does not support cloning.
| object | Receives the constructed object. |
| source | Source object. |
| allocator | Memory allocator (or kNULL for default). |
Destroys the object.
The kObject_Destroy method destroys the object itself and any resources that are owned by the object. See Object Destruction for more information.
When an object is destroyed (or disposed), its reference count is decremented. The object is only truly destroyed when the reference count reaches zero. See Reference Counting for more information.
| object | Object (or kNULL). |
Destroys the object and any aggregated child elements.
The kObject_Dispose method destroys the object itself, any resources that are owned by the object, and if the object represents a collection of objects, any child objects in the collection. See Object Destruction for more information.
When an object is destroyed (or disposed), its reference count is decremented. The object is only truly destroyed when the reference count reaches zero. See Reference Counting for more information.
| object | Object (or kNULL). |
Determines whether the object is equal to another object.
By default, objects are compared by reference; objects are considered equal if the given handles refer to the same object instance. However, some classes override the Equals method to provide a more meaningful comparison (e.g. kString).
| object | Object. |
| other | Object for comparison. |
Gets a hash code representing the state of this object.
By default, objects return a hash code based on the object handle value. However, some classes override the HashCode method to provide a more useful hash (e.g. kString).
| object | Object. |
Determines whether this object is an instance of the specified type.
This function compares the type of this object with the given type. An object is considered to be an instance of a given type if a) the type represents a class and this object inherits from (or instantiates) that class, or b) the type represents an interface and this object implements the interface.
| object | Object. |
| type | Type. |
Reports whether the object is currently shared (reference count greater than one).
Objects are initialized with a reference count of one. The kObject_Share method can be used to increment the reference count. The kObject_Destroy and kObject_Dispose methods decrease the reference count, and when the reference count reaches zero, the object is actually destroyed/disposed.
This method can be used to determine if the reference count of an object is currently greater than one.
This method is thread-safe.
| object | Object. |
|
inherited |
Sets the object pool associated with this object.
Object pools can be used to implement custom lifecycle management. If an object has an assigned pool, then the kObjectPool_Reclaim method will be called just prior to destruction, to provide an opportunity for the object to be reclaimed.
| object | Object. |
| pool | Pool object (or kNULL to clear the pool assignment). |
Increments the reference count associated with this object.
This method is thread-safe.
| object | Object. |
Estimates the memory consumed by this object, including any aggregated child elements.
This method can be optionally overridden by kObject-derived classes to report the amount of memory consumed by an object. The default implementation reports only the size of the class instance (additional allocations performed by the class are excluded).
| object | Object. |
Returns the type of the object.
Each object is an instance of a specific class type. The type handle returned by this function can be used to learn about the class.
| object | Object. |