libnavajo
web server for static and dynamic pages developement in C++
Public Member Functions | List of all members
HttpRequest Class Reference

Public Member Functions

std::string getCookie (const std::string &name) const
 
bool getCookie (const std::string &name, std::string &value) const
 
std::vector< std::string > getCookiesNames () const
 
bool getParameter (const std::string &name, std::string &value) const
 
std::string getParameter (const std::string &name) const
 
bool hasParameter (const std::string &name) const
 
std::vector< std::string > getParameterNames () const
 
bool isSessionValid ()
 
void createSession ()
 
void removeSession ()
 
void setSessionAttribute (const std::string &name, void *value)
 
void setSessionObjectAttribute (const std::string &name, SessionAttributeObject *value)
 
void * getSessionAttribute (const std::string &name)
 
SessionAttributeObjectgetSessionObjectAttribute (const std::string &name)
 
std::vector< std::string > getSessionAttributeNames ()
 
void getSessionRemoveAttribute (const std::string &name)
 
void initSessionId ()
 
std::string getSessionId () const
 
 HttpRequest (const HttpRequestMethod type, const char *url, const char *params, const char *cookies, const char *origin, const std::string &username, ClientSockData *client, MPFD::Parser *parser=NULL)
 
bool isMultipartContent () const
 
MPFD::ParsergetMPFDparser ()
 
const char * getUrl () const
 
HttpRequestMethod getRequestType () const
 
const char * getRequestOrigin () const
 
IpAddressgetPeerIpAddress ()
 
std::string & getHttpAuthUsername ()
 
std::string & getX509PeerDN ()
 
CompressionMode getCompressionMode ()
 
ClientSockDatagetClientSockData ()
 

Constructor & Destructor Documentation

HttpRequest::HttpRequest ( const HttpRequestMethod  type,
const char *  url,
const char *  params,
const char *  cookies,
const char *  origin,
const std::string &  username,
ClientSockData client,
MPFD::Parser parser = NULL 
)
inline

HttpRequest constructor

Parameters
typethe Http Request Type ( GET/POST/...)
urlthe requested url
paramsraw http parameters string params: raw http cookies string

Member Function Documentation

void HttpRequest::createSession ( )
inline

create a session cookie

ClientSockData* HttpRequest::getClientSockData ( )
inline

get the http request client socket data

Returns
the clientSockData
CompressionMode HttpRequest::getCompressionMode ( )
inline

get compression mode

Returns
the compression mode requested
std::string HttpRequest::getCookie ( const std::string &  name) const
inline

get cookie value

Parameters
namethe cookie name
bool HttpRequest::getCookie ( const std::string &  name,
std::string &  value 
) const
inline

get cookie value

Parameters
namethe cookie name
valuethe cookie value
Returns
true is the cookie exist
std::vector<std::string> HttpRequest::getCookiesNames ( ) const
inline

get cookies list

Returns
a vector containing all cookies names
std::string& HttpRequest::getHttpAuthUsername ( )
inline

get http authentification username

Returns
the login
MPFD::Parser* HttpRequest::getMPFDparser ( )
inline

get the MPFD parser

Returns
a pointer to the MPFDparser instance
bool HttpRequest::getParameter ( const std::string &  name,
std::string &  value 
) const
inline

get parameter value

Parameters
namethe parameter name
valuethe parameter value
Returns
true is the parameter exist
std::string HttpRequest::getParameter ( const std::string &  name) const
inline

get parameter value

Parameters
namethe parameter name
Returns
the parameter value
std::vector<std::string> HttpRequest::getParameterNames ( ) const
inline

get parameters list

Returns
a vector containing all parameters names
IpAddress& HttpRequest::getPeerIpAddress ( )
inline

get peer IP address

Returns
the ip address
const char* HttpRequest::getRequestOrigin ( ) const
inline

get request origin

Returns
the Http Request Origin
HttpRequestMethod HttpRequest::getRequestType ( ) const
inline

get request type

Returns
the Http Request Type ( GET/POST/...)
void* HttpRequest::getSessionAttribute ( const std::string &  name)
inline

get an attribute of the server session

Parameters
namethe attribute name
Returns
the attribute value or NULL if not found
std::vector<std::string> HttpRequest::getSessionAttributeNames ( )
inline

get the list of the attribute's Names of the server session

Returns
a vector containing all attribute's names
std::string HttpRequest::getSessionId ( ) const
inline

get sessionId value

Returns
the sessionId value
SessionAttributeObject* HttpRequest::getSessionObjectAttribute ( const std::string &  name)
inline

get an object attribute of the server session

Parameters
namethe attribute name
Returns
the object instance or NULL if not found
void HttpRequest::getSessionRemoveAttribute ( const std::string &  name)
inline

remove an attribute of the server session (if found)

Parameters
namethe attribute name
const char* HttpRequest::getUrl ( ) const
inline

get url

Returns
the requested url
std::string& HttpRequest::getX509PeerDN ( )
inline

get peer x509 dn

Returns
the DN of the peer certificate
bool HttpRequest::hasParameter ( const std::string &  name) const
inline

does the parameter exist ?

Parameters
namethe parameter name
Returns
true is the parameter exist
void HttpRequest::initSessionId ( )
inline

initialize sessionId value

bool HttpRequest::isMultipartContent ( ) const
inline

is there a multipart content in the request ?

Returns
true or false
bool HttpRequest::isSessionValid ( )
inline

is there a valid session cookie

void HttpRequest::removeSession ( )
inline

remove the session cookie

void HttpRequest::setSessionAttribute ( const std::string &  name,
void *  value 
)
inline

add an attribute to the session

Parameters
namethe attribute name
valuethe attribute value
void HttpRequest::setSessionObjectAttribute ( const std::string &  name,
SessionAttributeObject value 
)
inline

add an object attribute to the session

Parameters
namethe attribute name
valuethe object instance

The documentation for this class was generated from the following file: