Added UserData to cHTTPRequest.
Callbacks may store one pointer of per-request data in the cHTTPRequest object. The object doesn't touch this data (doesn't own it).
This commit is contained in:
parent
5cf8fc12ae
commit
c22ea7efff
@ -55,7 +55,8 @@ void cHTTPMessage::AddHeader(const AString & a_Key, const AString & a_Value)
|
||||
// cHTTPRequest:
|
||||
|
||||
cHTTPRequest::cHTTPRequest(void) :
|
||||
super(mkRequest)
|
||||
super(mkRequest),
|
||||
m_UserData(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,12 @@ public:
|
||||
/// Returns true if the request did contain a Content-Length header
|
||||
bool HasReceivedContentLength(void) const { return (m_ContentLength >= 0); }
|
||||
|
||||
/// Sets the UserData pointer that is stored within this request. The request doesn't touch this data (doesn't delete it)!
|
||||
void SetUserData(void * a_UserData) { m_UserData = a_UserData; }
|
||||
|
||||
/// Retrieves the UserData pointer that has been stored within this request.
|
||||
void * GetUserData(void) const { return m_UserData; }
|
||||
|
||||
protected:
|
||||
/// Method of the request (GET / PUT / POST / ...)
|
||||
AString m_Method;
|
||||
@ -78,6 +84,10 @@ protected:
|
||||
/// Full URL of the request
|
||||
AString m_URL;
|
||||
|
||||
/// Data that the HTTPServer callbacks are allowed to store.
|
||||
void * m_UserData;
|
||||
|
||||
|
||||
/** Parses the RequestLine out of a_Data, up to index a_IdxEnd
|
||||
Returns the index to the next line, or npos if invalid request
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user