uHTTP for C++
uHTTP::HTTPRequest Class Reference

#include <HTTPRequest.h>

Inheritance diagram for uHTTP::HTTPRequest:
uHTTP::HTTPPacket

Public Member Functions

 HTTPRequest ()
 
 HTTPRequest (uhttp_shared_ptr< HTTPSocket > httpSock)
 
 ~HTTPRequest ()
 
void setMethod (const std::string &value)
 
const char * getMethod (std::string &methodBuf)
 
bool isMethod (const std::string &value)
 
bool isGetRequest ()
 
bool isPutRequest ()
 
bool isPostRequest ()
 
bool isHeadRequest ()
 
bool isDeleteRequest ()
 
bool isUpdateRequest ()
 
bool isSubscribeRequest ()
 
bool isUnsubscribeRequest ()
 
bool isNotifyRequest ()
 
void setURI (const std::string &value)
 
const char * getURI (std::string &uriBuf)
 
void getURI (URI &uri)
 
void setURL (const std::string &value)
 
void setURL (URL *url)
 
ParameterListgetParameterList (ParameterList &paramList)
 
bool getParameterValue (const std::string &name, std::string *paramBuf)
 
bool isSOAPAction ()
 
void setRequestHost (const std::string &host)
 
const char * getRequestHost ()
 
void setRequestPort (int host)
 
int getRequestPort ()
 
void setSocket (uhttp_shared_ptr< HTTPSocket > socket)
 
uhttp_shared_ptr< HTTPSocketgetSocket ()
 
const char * getLocalAddress ()
 
int getLocalPort ()
 
bool parseRequestLine (const std::string &lineStr)
 
const char * getRequestLine (std::string &requestLineBuf)
 
const char * getHeader (std::string &headerBuf)
 
bool isKeepAlive ()
 
bool read ()
 
HTTP::StatusCode post (HTTPResponse *httpRes, bool isOnlyHeader=false)
 
HTTPResponsepost (const std::string &host, int port, HTTPResponse *httpRes, bool isKeepAlive)
 
HTTPResponsepost (const std::string &host, int port, HTTPResponse *httpRes)
 
HTTPResponsepost (const std::string &host, int port, bool isKeepAlive)
 
HTTPResponsepost (const std::string &host, int port)
 
HTTPResponsepost (bool isKeepAlive=false)
 
void set (HTTPRequest *httpReq)
 
HTTP::StatusCode returnResponse (int statusCode)
 
HTTP::StatusCode returnOK ()
 
HTTP::StatusCode returnBadRequest ()
 
HTTP::StatusCode returnNotFound ()
 
const char * toString (std::string &buf)
 
void print ()
 
- Public Member Functions inherited from uHTTP::HTTPPacket
 HTTPPacket ()
 
 HTTPPacket (HTTPPacket *httpPacket)
 
 HTTPPacket (HTTPSocket *httpSock)
 
 HTTPPacket (uHTTP::InputStream *in)
 
 ~HTTPPacket ()
 
void init ()
 
void setVersion (const std::string &ver)
 
const char * getVersion ()
 
bool set (uHTTP::InputStream *in, bool onlyHeaders=false)
 
bool set (uHTTP::Socket *sock, bool onlyHeaders=false)
 
bool set (HTTPSocket *httpSock)
 
void set (HTTPPacket *httpPacket)
 
bool read (HTTPSocket *httpSock)
 
void setFirstLine (const std::string &value)
 
const char * getFirstLine ()
 
const char * getFirstLineToken (int num, std::string &tokenBuf)
 
bool hasFirstLine ()
 
size_t getNHeaders ()
 
bool addHeader (HTTPHeader *header)
 
bool addHeader (const std::string &name, const std::string &value)
 
HTTPHeadergetHeader (size_t n)
 
HTTPHeaderListgetHeaders ()
 
HTTPHeadergetHeader (const std::string &name)
 
void clearHeaders ()
 
bool hasHeader (const std::string &name)
 
void setHeader (const std::string &name, const std::string &value)
 
void setHeader (const std::string &name, int value)
 
void setHeader (const std::string &name, long value)
 
void setHeader (const std::string &name, size_t value)
 
void setHeader (HTTPHeader *header)
 
const char * getHeaderValue (const std::string &name)
 
void setStringHeader (const std::string &name, const std::string &value, const char startWith, const char endWith)
 
void setStringHeader (const std::string &name, const std::string &value)
 
const char * getStringHeaderValue (const std::string &name, const char startWith, const char endWith, std::string &buf)
 
const char * getStringHeaderValue (const std::string &name, std::string &buf)
 
void setIntegerHeader (const std::string &name, int value)
 
void setLongHeader (const std::string &name, long value)
 
void setSizetHeader (const std::string &name, size_t value)
 
int getIntegerHeaderValue (const std::string &name)
 
long getLongHeaderValue (const std::string &name)
 
size_t getLongLongHeaderValue (const std::string &name)
 
const char * getHeaderString (std::string &headerStr)
 
void setContent (const std::string &data, bool updateWithContentLength=true)
 
void setContent (std::string &data, bool updateWithContentLength=true)
 
const char * getContent ()
 
bool hasContent ()
 
void setContentInputStream (uHTTP::InputStream *in)
 
uHTTP::InputStreamgetContentInputStream ()
 
bool hasContentInputStream ()
 
void setContentType (const std::string &type)
 
const char * getContentType ()
 
const char * getCharSet (std::string &buf)
 
void setContentLength (size_t len)
 
size_t getContentLength ()
 
bool hasConnection ()
 
void setConnection (const std::string &value)
 
const char * getConnection ()
 
bool isCloseConnection ()
 
bool isKeepAliveConnection ()
 
bool hasContentRange ()
 
void setContentRange (long firstPos, long lastPos, long length)
 
void getContentRange (long range[])
 
long getContentRangeFirstPosition ()
 
long getContentRangeLastPosition ()
 
long getContentRangeInstanceLength ()
 
void setCacheControl (const std::string &directive)
 
void setCacheControl (const std::string &directive, int value)
 
void setCacheControl (int value)
 
const char * getCacheControl ()
 
void setUserAgent (const std::string &name)
 
const char * getUserAgent ()
 
void setAccept (const std::string &name)
 
const char * getAccept ()
 
void setServer (const std::string &name)
 
const char * getServer ()
 
void setHost (const std::string &host, int port)
 
void setHost (const std::string &host)
 
const char * getHost ()
 
void setDate (HTTPDate *date)
 
const char * getDate ()
 
bool hasTransferEncoding ()
 
void setTransferEncoding (const std::string &value)
 
const char * getTransferEncoding ()
 
bool isChunked ()
 
void clear ()
 

Private Member Functions

const char * getHTTPVersion (std::string &verBuf)
 

Private Attributes

std::string method
 
std::string version
 
std::string uri
 
std::string requestHost
 
int requestPort
 
uhttp_shared_ptr< HTTPSockethttpSocket
 
SocketpostSocket
 
HTTPResponse httpRes
 

Constructor & Destructor Documentation

◆ HTTPRequest() [1/2]

uHTTP::HTTPRequest::HTTPRequest ( )

◆ HTTPRequest() [2/2]

uHTTP::HTTPRequest::HTTPRequest ( uhttp_shared_ptr< HTTPSocket > httpSock)

◆ ~HTTPRequest()

uHTTP::HTTPRequest::~HTTPRequest ( )

Member Function Documentation

◆ getHeader()

const char * uHTTP::HTTPRequest::getHeader ( std::string & headerBuf)

◆ getHTTPVersion()

const char * uHTTP::HTTPRequest::getHTTPVersion ( std::string & verBuf)
private

◆ getLocalAddress()

const char * uHTTP::HTTPRequest::getLocalAddress ( )
inline

◆ getLocalPort()

int uHTTP::HTTPRequest::getLocalPort ( )
inline

◆ getMethod()

const char * uHTTP::HTTPRequest::getMethod ( std::string & methodBuf)
inline

◆ getParameterList()

ParameterList * uHTTP::HTTPRequest::getParameterList ( ParameterList & paramList)

◆ getParameterValue()

bool uHTTP::HTTPRequest::getParameterValue ( const std::string & name,
std::string * paramBuf )
inline

◆ getRequestHost()

const char * uHTTP::HTTPRequest::getRequestHost ( )
inline

◆ getRequestLine()

const char * uHTTP::HTTPRequest::getRequestLine ( std::string & requestLineBuf)

◆ getRequestPort()

int uHTTP::HTTPRequest::getRequestPort ( )
inline

◆ getSocket()

uhttp_shared_ptr< HTTPSocket > uHTTP::HTTPRequest::getSocket ( )
inline

◆ getURI() [1/2]

const char * uHTTP::HTTPRequest::getURI ( std::string & uriBuf)

◆ getURI() [2/2]

void uHTTP::HTTPRequest::getURI ( URI & uri)

◆ isDeleteRequest()

bool uHTTP::HTTPRequest::isDeleteRequest ( )
inline

◆ isGetRequest()

bool uHTTP::HTTPRequest::isGetRequest ( )
inline

◆ isHeadRequest()

bool uHTTP::HTTPRequest::isHeadRequest ( )
inline

◆ isKeepAlive()

bool uHTTP::HTTPRequest::isKeepAlive ( )

◆ isMethod()

bool uHTTP::HTTPRequest::isMethod ( const std::string & value)

◆ isNotifyRequest()

bool uHTTP::HTTPRequest::isNotifyRequest ( )
inline

◆ isPostRequest()

bool uHTTP::HTTPRequest::isPostRequest ( )
inline

◆ isPutRequest()

bool uHTTP::HTTPRequest::isPutRequest ( )
inline

◆ isSOAPAction()

bool uHTTP::HTTPRequest::isSOAPAction ( )
inline

◆ isSubscribeRequest()

bool uHTTP::HTTPRequest::isSubscribeRequest ( )
inline

◆ isUnsubscribeRequest()

bool uHTTP::HTTPRequest::isUnsubscribeRequest ( )
inline

◆ isUpdateRequest()

bool uHTTP::HTTPRequest::isUpdateRequest ( )
inline

◆ parseRequestLine()

bool uHTTP::HTTPRequest::parseRequestLine ( const std::string & lineStr)

◆ post() [1/6]

HTTPResponse * uHTTP::HTTPRequest::post ( bool isKeepAlive = false)
inline

◆ post() [2/6]

HTTPResponse * uHTTP::HTTPRequest::post ( const std::string & host,
int port )
inline

◆ post() [3/6]

HTTPResponse * uHTTP::HTTPRequest::post ( const std::string & host,
int port,
bool isKeepAlive )
inline

◆ post() [4/6]

HTTPResponse * uHTTP::HTTPRequest::post ( const std::string & host,
int port,
HTTPResponse * httpRes )
inline

◆ post() [5/6]

HTTPResponse * uHTTP::HTTPRequest::post ( const std::string & host,
int port,
HTTPResponse * httpRes,
bool isKeepAlive )

◆ post() [6/6]

HTTP::StatusCode uHTTP::HTTPRequest::post ( HTTPResponse * httpRes,
bool isOnlyHeader = false )

◆ print()

void uHTTP::HTTPRequest::print ( )

◆ read()

bool uHTTP::HTTPRequest::read ( )
inline

◆ returnBadRequest()

HTTP::StatusCode uHTTP::HTTPRequest::returnBadRequest ( )
inline

◆ returnNotFound()

HTTP::StatusCode uHTTP::HTTPRequest::returnNotFound ( )
inline

◆ returnOK()

HTTP::StatusCode uHTTP::HTTPRequest::returnOK ( )
inline

◆ returnResponse()

HTTP::StatusCode uHTTP::HTTPRequest::returnResponse ( int statusCode)

◆ set()

void uHTTP::HTTPRequest::set ( HTTPRequest * httpReq)
inline

◆ setMethod()

void uHTTP::HTTPRequest::setMethod ( const std::string & value)
inline

◆ setRequestHost()

void uHTTP::HTTPRequest::setRequestHost ( const std::string & host)
inline

◆ setRequestPort()

void uHTTP::HTTPRequest::setRequestPort ( int host)
inline

◆ setSocket()

void uHTTP::HTTPRequest::setSocket ( uhttp_shared_ptr< HTTPSocket > socket)
inline

◆ setURI()

void uHTTP::HTTPRequest::setURI ( const std::string & value)

◆ setURL() [1/2]

void uHTTP::HTTPRequest::setURL ( const std::string & value)

◆ setURL() [2/2]

void uHTTP::HTTPRequest::setURL ( URL * url)

◆ toString()

const char * uHTTP::HTTPRequest::toString ( std::string & buf)

Field Documentation

◆ httpRes

HTTPResponse uHTTP::HTTPRequest::httpRes
private

◆ httpSocket

uhttp_shared_ptr<HTTPSocket> uHTTP::HTTPRequest::httpSocket
private

◆ method

std::string uHTTP::HTTPRequest::method
private

◆ postSocket

Socket* uHTTP::HTTPRequest::postSocket
private

◆ requestHost

std::string uHTTP::HTTPRequest::requestHost
private

◆ requestPort

int uHTTP::HTTPRequest::requestPort
private

◆ uri

std::string uHTTP::HTTPRequest::uri
private

◆ version

std::string uHTTP::HTTPRequest::version
private

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