summaryrefslogtreecommitdiffstats
path: root/src/HTTPServer/HTTPMessage.h
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-01-18 20:20:56 +0100
committermadmaxoft <github@xoft.cz>2014-01-18 20:20:56 +0100
commitfab726282c5d2e04cdc9daa88b5d0a05ead8cf33 (patch)
tree17d996a93bdc3bf1adb0eb58f48fbaa9514da3ad /src/HTTPServer/HTTPMessage.h
parentAlpha-sorted the finishers. (diff)
downloadcuberite-fab726282c5d2e04cdc9daa88b5d0a05ead8cf33.tar
cuberite-fab726282c5d2e04cdc9daa88b5d0a05ead8cf33.tar.gz
cuberite-fab726282c5d2e04cdc9daa88b5d0a05ead8cf33.tar.bz2
cuberite-fab726282c5d2e04cdc9daa88b5d0a05ead8cf33.tar.lz
cuberite-fab726282c5d2e04cdc9daa88b5d0a05ead8cf33.tar.xz
cuberite-fab726282c5d2e04cdc9daa88b5d0a05ead8cf33.tar.zst
cuberite-fab726282c5d2e04cdc9daa88b5d0a05ead8cf33.zip
Diffstat (limited to '')
-rw-r--r--src/HTTPServer/HTTPMessage.h51
1 files changed, 29 insertions, 22 deletions
diff --git a/src/HTTPServer/HTTPMessage.h b/src/HTTPServer/HTTPMessage.h
index 2a4c2879e..ab3338db7 100644
--- a/src/HTTPServer/HTTPMessage.h
+++ b/src/HTTPServer/HTTPMessage.h
@@ -35,7 +35,7 @@ public:
// Force a virtual destructor in all descendants
virtual ~cHTTPMessage() {};
- /// Adds a header into the internal map of headers. Recognizes special headers: Content-Type and Content-Length
+ /** Adds a header into the internal map of headers. Recognizes special headers: Content-Type and Content-Length */
void AddHeader(const AString & a_Key, const AString & a_Value);
void SetContentType (const AString & a_ContentType) { m_ContentType = a_ContentType; }
@@ -51,10 +51,10 @@ protected:
cNameValueMap m_Headers;
- /// Type of the content; parsed by AddHeader(), set directly by SetContentLength()
+ /** Type of the content; parsed by AddHeader(), set directly by SetContentLength() */
AString m_ContentType;
- /// Length of the content that is to be received. -1 when the object is created, parsed by AddHeader() or set directly by SetContentLength()
+ /** Length of the content that is to be received. -1 when the object is created, parsed by AddHeader() or set directly by SetContentLength() */
int m_ContentLength;
} ;
@@ -76,64 +76,71 @@ public:
*/
int ParseHeaders(const char * a_Data, int a_Size);
- /// Returns true if the request did contain a Content-Length header
+ /** Returns true if the request did contain a Content-Length header */
bool HasReceivedContentLength(void) const { return (m_ContentLength >= 0); }
- /// Returns the method used in the request
+ /** Returns the method used in the request */
const AString & GetMethod(void) const { return m_Method; }
- /// Returns the URL used in the request
+ /** Returns the URL used in the request */
const AString & GetURL(void) const { return m_URL; }
- /// Returns the URL used in the request, without any parameters
+ /** Returns the URL used in the request, without any parameters */
AString GetBareURL(void) const;
- /// Sets the UserData pointer that is stored within this request. The request doesn't touch this data (doesn't delete it)!
+ /** 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.
+ /** Retrieves the UserData pointer that has been stored within this request. */
void * GetUserData(void) const { return m_UserData; }
- /// Returns true if more data is expected for the request headers
+ /** Returns true if more data is expected for the request headers */
bool IsInHeaders(void) const { return m_EnvelopeParser.IsInHeaders(); }
- /// Returns true if the request did present auth data that was understood by the parser
+ /** Returns true if the request did present auth data that was understood by the parser */
bool HasAuth(void) const { return m_HasAuth; }
- /// Returns the username that the request presented. Only valid if HasAuth() is true
+ /** Returns the username that the request presented. Only valid if HasAuth() is true */
const AString & GetAuthUsername(void) const { return m_AuthUsername; }
- /// Returns the password that the request presented. Only valid if HasAuth() is true
+ /** Returns the password that the request presented. Only valid if HasAuth() is true */
const AString & GetAuthPassword(void) const { return m_AuthPassword; }
+ bool DoesAllowKeepAlive(void) const { return m_AllowKeepAlive; }
+
protected:
- /// Parser for the envelope data
+ /** Parser for the envelope data */
cEnvelopeParser m_EnvelopeParser;
- /// True if the data received so far is parsed successfully. When false, all further parsing is skipped
+ /** True if the data received so far is parsed successfully. When false, all further parsing is skipped */
bool m_IsValid;
- /// Bufferred incoming data, while parsing for the request line
+ /** Bufferred incoming data, while parsing for the request line */
AString m_IncomingHeaderData;
- /// Method of the request (GET / PUT / POST / ...)
+ /** Method of the request (GET / PUT / POST / ...) */
AString m_Method;
- /// Full URL of the request
+ /** Full URL of the request */
AString m_URL;
- /// Data that the HTTPServer callbacks are allowed to store.
+ /** Data that the HTTPServer callbacks are allowed to store. */
void * m_UserData;
- /// Set to true if the request contains auth data that was understood by the parser
+ /** Set to true if the request contains auth data that was understood by the parser */
bool m_HasAuth;
- /// The username used for auth
+ /** The username used for auth */
AString m_AuthUsername;
- /// The password used for auth
+ /** The password used for auth */
AString m_AuthPassword;
+ /** Set to true if the request indicated that it supports keepalives.
+ If false, the server will close the connection once the request is finished */
+ bool m_AllowKeepAlive;
+
/** Parses the incoming data for the first line (RequestLine)
Returns the number of bytes consumed, or -1 for an error