From 1795cca5522476006d33d0c276e27a50659c867a Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Tue, 1 Apr 2014 16:36:00 +0200 Subject: Rewritten HTTPServer to use size_t for data lengths. --- src/HTTPServer/HTTPMessage.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/HTTPServer/HTTPMessage.h') diff --git a/src/HTTPServer/HTTPMessage.h b/src/HTTPServer/HTTPMessage.h index ab3338db7..d4d96f7cb 100644 --- a/src/HTTPServer/HTTPMessage.h +++ b/src/HTTPServer/HTTPMessage.h @@ -42,7 +42,7 @@ public: void SetContentLength(int 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 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,9 +74,9 @@ 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); } @@ -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; -- cgit v1.2.3