diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-04-06 21:43:23 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-04-06 21:43:23 +0200 |
commit | 7da308a7e158542fba0b28d3ad0e865b9e60bfc4 (patch) | |
tree | 84e11eab9c0608e71acedae999bbc3fba9c95d2a /src/HTTPServer/HTTPMessage.h | |
parent | Add CanChangeDirtToGrass function to Block Handlers. (diff) | |
parent | Updated cWorld::CreateProjectile() documentation (diff) | |
download | cuberite-7da308a7e158542fba0b28d3ad0e865b9e60bfc4.tar cuberite-7da308a7e158542fba0b28d3ad0e865b9e60bfc4.tar.gz cuberite-7da308a7e158542fba0b28d3ad0e865b9e60bfc4.tar.bz2 cuberite-7da308a7e158542fba0b28d3ad0e865b9e60bfc4.tar.lz cuberite-7da308a7e158542fba0b28d3ad0e865b9e60bfc4.tar.xz cuberite-7da308a7e158542fba0b28d3ad0e865b9e60bfc4.tar.zst cuberite-7da308a7e158542fba0b28d3ad0e865b9e60bfc4.zip |
Diffstat (limited to 'src/HTTPServer/HTTPMessage.h')
-rw-r--r-- | src/HTTPServer/HTTPMessage.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/HTTPServer/HTTPMessage.h b/src/HTTPServer/HTTPMessage.h index ab3338db7..dab942136 100644 --- a/src/HTTPServer/HTTPMessage.h +++ b/src/HTTPServer/HTTPMessage.h @@ -39,10 +39,10 @@ public: void AddHeader(const AString & a_Key, const AString & a_Value); void SetContentType (const AString & a_ContentType) { m_ContentType = a_ContentType; } - void SetContentLength(int a_ContentLength) { m_ContentLength = a_ContentLength; } + void SetContentLength(size_t a_ContentLength) { m_ContentLength = a_ContentLength; } const AString & GetContentType (void) const { return m_ContentType; } - int GetContentLength(void) const { return m_ContentLength; } + size_t GetContentLength(void) const { return m_ContentLength; } protected: typedef std::map<AString, AString> cNameValueMap; @@ -54,8 +54,10 @@ protected: /** 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() */ - int m_ContentLength; + /** Length of the content that is to be received. + AString::npos when the object is created. + Parsed by AddHeader() or set directly by SetContentLength() */ + size_t m_ContentLength; } ; @@ -72,12 +74,12 @@ public: cHTTPRequest(void); /** Parses the request line and then headers from the received data. - Returns the number of bytes consumed or a negative number for error + Returns the number of bytes consumed or AString::npos number for error */ - int ParseHeaders(const char * a_Data, int a_Size); + size_t ParseHeaders(const char * a_Data, size_t a_Size); /** Returns true if the request did contain a Content-Length header */ - bool HasReceivedContentLength(void) const { return (m_ContentLength >= 0); } + bool HasReceivedContentLength(void) const { return (m_ContentLength != AString::npos); } /** Returns the method used in the request */ const AString & GetMethod(void) const { return m_Method; } @@ -145,7 +147,7 @@ protected: /** Parses the incoming data for the first line (RequestLine) Returns the number of bytes consumed, or -1 for an error */ - int ParseRequestLine(const char * a_Data, int a_Size); + size_t ParseRequestLine(const char * a_Data, size_t a_Size); // cEnvelopeParser::cCallbacks overrides: virtual void OnHeaderLine(const AString & a_Key, const AString & a_Value) override; |