Description | Hierarchy | Fields | Methods | Properties |
type unaHTTPparser = class(unaObject)
HTTP-like protocols parser
constructor create(); |
|
function getFullHeader(): aString; |
|
function getHeaderCount(): int; |
|
function getHeaderName(index: int): string; |
|
function getHeaderValue(const headerName: string; trim: bool = false): string; overload; |
|
function getHeaderValue(index: int; trim: bool = false): string; overload; |
|
function getPayload(): aString; |
|
function getPayloadComplete(connected: bool; defaultCL: int = -1): bool; |
|
function getPayloadSize(): int; |
|
function getReqMethod(): string; |
|
function getReqProtoVersion(): string; |
|
function getReqURI(): string; |
|
function getRespCode(): int; |
|
function getRespCodeString(): string; |
|
function getRespProtoVersion(): string; |
|
procedure BeforeDestruction(); override; |
|
procedure cleanup(); |
|
procedure dropIfComplete(defaultCL: int = -1); |
|
procedure feed(data: pointer; len: int); |
|
procedure doCleanup(); virtual; |
|
procedure setHeaderDelimiter(newDelimiter: char); |
property data: paChar read f_buf; |
|
property dataSize: int read f_bufSize; |
|
property headerComplete: bool read getHC; |
|
property headerSize: int read f_headerSize; |
constructor create(); |
|
Initializes instance. |
function getFullHeader(): aString; |
|
Returnsfull header. |
function getHeaderCount(): int; |
|
Returnsnumber of headers. |
function getHeaderName(index: int): string; |
|
Parameters
Returnsspecified header name. |
function getHeaderValue(const headerName: string; trim: bool = false): string; overload; |
|
Parameters
Returnsspecified header value |
function getHeaderValue(index: int; trim: bool = false): string; overload; |
|
Parameters
Returnsspecified header value by index. |
function getPayload(): aString; |
|
Returnspayload data (if any). |
function getPayloadComplete(connected: bool; defaultCL: int = -1): bool; |
|
True if complete payload was received.
Parameters
ReturnsTrue if payload is "completely" present: [Contnent-Length=0 or missing and default is 0 or default is -1 and connection is closed | or at least Contnent-Length bytes of payload is present] |
function getPayloadSize(): int; |
|
Returnscurrent payload size. |
function getReqMethod(): string; |
|
Returnsrequested method (if any). |
function getReqProtoVersion(): string; |
|
Returnsrequest protocol version (if any). |
function getReqURI(): string; |
|
Returnsrequested URI (if any). |
function getRespCode(): int; |
|
Returnsresponse code (if any). |
function getRespCodeString(): string; |
|
Returnsresponse code as string (if provided in response). |
function getRespProtoVersion(): string; |
|
Returnsresponse protocol version (if any). |
procedure BeforeDestruction(); override; |
|
Cleans up the instance. |
procedure cleanup(); |
|
Cleans internal buffers and prepares parser for new data. |
procedure dropIfComplete(defaultCL: int = -1); |
|
Drops complete Request/Response with payload (if any). |
procedure feed(data: pointer; len: int); |
|
Feeds parser with new portion of data.
Parameters
|
procedure doCleanup(); virtual; |
|
// |
procedure setHeaderDelimiter(newDelimiter: char); |
|
// |
property data: paChar read f_buf; |
|
RAW data access. |
property dataSize: int read f_bufSize; |
|
Returns data size, that is size of data written to parser so far, inlcuding header. |
property headerComplete: bool read getHC; |
|
True if complete header was received. |
property headerSize: int read f_headerSize; |
|
Returns header size (valid when headerComplete is true). |
(c) 2012 Lake of Soft