This class holds the request that arrived from the client. More...
#include <DcRequest.h>
Public Member Functions | |
CdcRequest (CdcSocket *psock) | |
Constructor - Builds an empty object, and attaches a CdcSocket pointer to it. | |
virtual | ~CdcRequest () |
Destructor - Does nothing. | |
void | ReadNextRequest () |
Get a new request from the client. | |
CdcString | GetMethod () const |
Returns the Method in the request. | |
CdcString | GetURL () const |
Returns the URL in the request. | |
CdcString | GetFullURL () const |
Returns the full URL as it was received from the client. | |
CdcString | GetVersion () const |
Returns the Version in the request. | |
CdcString | GetHost () const |
Returns the Host of the request. | |
CdcString | GetAliasHost () const |
Returns the alias name for the host as it is in the request. | |
void | EraseHeaderField (const CdcString &name) |
Erase a request header field. | |
virtual BufferHolder | GetRequestHeader (BufferHolder name) const |
IdcRequest GetRequestHeader. | |
CdcString | GetHeaderField (const CdcString &name) const |
This class GetHeaderField. | |
virtual BufferHolder | GetRequestVariable (BufferHolder name) const |
IdcRequest GetRequestVariable. | |
CdcString | GetVariable (const CdcString &name) const |
This class GetVariable. | |
virtual void | SetRequestVariable (BufferHolder name, BufferHolder val) |
SetRequestVariable is an implementation of Idcrequest::SetRequestVariable. | |
void | SetVariable (const CdcString &name, const CdcString &val) |
virtual BufferHolder | GetRequestVarsNamesList (BufferHolder sep=BufferHolder("|")) |
This is an implementation of IdcRequest::GetRequestVarsNamesList. |
This class holds the request that arrived from the client.
The user builds a request object with a pointer to CdcSocket as a parameter to the Constructor. To get the next request the user calls ReadNextRequest. Then the user can access each data field (read only). In order to send the "100 Continue" message after reading the first <u>line</u> of the request, call to ReadFirstLineFirst send the message and then call to ReadNextRequest.
The Request object may hold more then one request in it's buffer, at one time. The next call to ReadNextRequest will load the next request into the object (and delete the request from the buffer).
Use just one CdcRequest object for each connection with a client.
Note: there is a different between 'Request Message (Expression)' - The entire message from the client, and 'Request Line' - The first line in the request message (method URL version).
CdcRequest implements the interface IdcRequest. The functions that implements IdcRequest, work with STL string and not CdcString, because scripting engines doesn't know CdcString. In addition some of the interface functions have a little different names from the implemented class functions, and they call the "real" class function in-line. That is to solve the ambiguity problem of working with STL string and CdcString in the same class.
Definition at line 66 of file DcRequest.h.
CdcRequest::CdcRequest | ( | CdcSocket * | psock ) |
Constructor - Builds an empty object, and attaches a CdcSocket pointer to it.
DcRequest.cpp: Implamentation of CdcRequst class.
psock | A pointer to a CdcSocket object. |
for documentation see the header file.
Definition at line 28 of file DcRequest.cpp.
virtual CdcRequest::~CdcRequest | ( | ) | [inline, virtual] |
Destructor - Does nothing.
Definition at line 207 of file DcRequest.h.
void CdcRequest::EraseHeaderField | ( | const CdcString & | name ) |
Erase a request header field.
I need it for the logout process.
name | The name of the header field as string. |
Definition at line 391 of file DcRequest.cpp.
CdcString CdcRequest::GetAliasHost | ( | ) | const [inline] |
Returns the alias name for the host as it is in the request.
Definition at line 263 of file DcRequest.h.
CdcString CdcRequest::GetFullURL | ( | ) | const [inline] |
Returns the full URL as it was received from the client.
Definition at line 242 of file DcRequest.h.
This class GetHeaderField.
Definition at line 276 of file DcRequest.h.
CdcString CdcRequest::GetHost | ( | ) | const [inline] |
Returns the Host of the request.
Definition at line 256 of file DcRequest.h.
CdcString CdcRequest::GetMethod | ( | ) | const [inline] |
Returns the Method in the request.
Definition at line 228 of file DcRequest.h.
virtual BufferHolder CdcRequest::GetRequestHeader | ( | BufferHolder | name ) | const [inline, virtual] |
virtual BufferHolder CdcRequest::GetRequestVariable | ( | BufferHolder | name ) | const [inline, virtual] |
BufferHolder CdcRequest::GetRequestVarsNamesList | ( | BufferHolder | sep = BufferHolder ("|") ) |
[virtual] |
This is an implementation of IdcRequest::GetRequestVarsNamesList.
Implements IdcRequest.
Definition at line 416 of file DcRequest.cpp.
CdcString CdcRequest::GetURL | ( | ) | const [inline] |
Returns the URL in the request.
Definition at line 235 of file DcRequest.h.
This class GetVariable.
Definition at line 283 of file DcRequest.h.
CdcString CdcRequest::GetVersion | ( | ) | const [inline] |
Returns the Version in the request.
Definition at line 249 of file DcRequest.h.
void CdcRequest::ReadNextRequest | ( | ) |
Get a new request from the client.
the request may be read from the socket, or it may be already in the buffer, from a previous reads from this socket. After calling this function the object will hold the next request from the client.
(CdcException) | Exceptions from the private parsing functions, or from the CdcSocket object. |
Definition at line 37 of file DcRequest.cpp.
virtual void CdcRequest::SetRequestVariable | ( | BufferHolder | name, |
BufferHolder | val | ||
) | [inline, virtual] |
SetRequestVariable is an implementation of Idcrequest::SetRequestVariable.
Implements IdcRequest.
Definition at line 289 of file DcRequest.h.
Definition at line 291 of file DcRequest.h.