1
0

Fixed warnings in HTTP parser.

This commit is contained in:
madmaxoft 2013-12-20 16:20:54 +01:00
parent 812375fab1
commit b66722f735
4 changed files with 15 additions and 5 deletions

View File

@ -39,7 +39,7 @@ public:
} ; } ;
cHTTPConnection(cHTTPServer & a_HTTPServer); cHTTPConnection(cHTTPServer & a_HTTPServer);
~cHTTPConnection(); virtual ~cHTTPConnection();
/// Sends HTTP status code together with a_Reason (used for HTTP errors) /// Sends HTTP status code together with a_Reason (used for HTTP errors)
void SendStatusAndReason(int a_StatusCode, const AString & a_Reason); void SendStatusAndReason(int a_StatusCode, const AString & a_Reason);

View File

@ -109,6 +109,11 @@ bool cHTTPFormParser::Finish(void)
ParseFormUrlEncoded(); ParseFormUrlEncoded();
break; break;
} }
default:
{
// Nothing needed for other formats
break;
}
} }
return (m_IsValid && m_IncomingData.empty()); return (m_IsValid && m_IncomingData.empty());
} }

View File

@ -32,6 +32,9 @@ public:
cHTTPMessage(eKind a_Kind); cHTTPMessage(eKind a_Kind);
// 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 AddHeader(const AString & a_Key, const AString & a_Value);

View File

@ -97,15 +97,17 @@ void cNameValueParser::Parse(const char * a_Data, int a_Size)
{ {
ASSERT(m_State != psFinished); // Calling Parse() after Finish() is wrong! ASSERT(m_State != psFinished); // Calling Parse() after Finish() is wrong!
if ((m_State == psInvalid) || (m_State == psFinished))
{
return;
}
int Last = 0; int Last = 0;
for (int i = 0; i < a_Size;) for (int i = 0; i < a_Size;)
{ {
switch (m_State) switch (m_State)
{ {
case psInvalid:
case psFinished:
{
return;
}
case psKeySpace: case psKeySpace:
{ {
// Skip whitespace until a non-whitespace is found, then start the key: // Skip whitespace until a non-whitespace is found, then start the key: