summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-09-27 21:38:54 +0200
committermadmaxoft <github@xoft.cz>2013-09-27 21:38:54 +0200
commitc22ea7efff5d611d8293eff895b2ff1b234aa5a6 (patch)
treea420bad7404a3a8d097ac6def11dbde87edc384d /source
parentAdded cHTTPServer callbacks; fixed keep-alives. (diff)
downloadcuberite-c22ea7efff5d611d8293eff895b2ff1b234aa5a6.tar
cuberite-c22ea7efff5d611d8293eff895b2ff1b234aa5a6.tar.gz
cuberite-c22ea7efff5d611d8293eff895b2ff1b234aa5a6.tar.bz2
cuberite-c22ea7efff5d611d8293eff895b2ff1b234aa5a6.tar.lz
cuberite-c22ea7efff5d611d8293eff895b2ff1b234aa5a6.tar.xz
cuberite-c22ea7efff5d611d8293eff895b2ff1b234aa5a6.tar.zst
cuberite-c22ea7efff5d611d8293eff895b2ff1b234aa5a6.zip
Diffstat (limited to '')
-rw-r--r--source/HTTPServer/HTTPMessage.cpp3
-rw-r--r--source/HTTPServer/HTTPMessage.h10
2 files changed, 12 insertions, 1 deletions
diff --git a/source/HTTPServer/HTTPMessage.cpp b/source/HTTPServer/HTTPMessage.cpp
index b2e21c712..3ad838ac0 100644
--- a/source/HTTPServer/HTTPMessage.cpp
+++ b/source/HTTPServer/HTTPMessage.cpp
@@ -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)
{
}
diff --git a/source/HTTPServer/HTTPMessage.h b/source/HTTPServer/HTTPMessage.h
index fc7b621fe..7b1a27eaa 100644
--- a/source/HTTPServer/HTTPMessage.h
+++ b/source/HTTPServer/HTTPMessage.h
@@ -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
*/