1
0

Fixed crashes in the SSL HTTP connection.

This commit is contained in:
madmaxoft
2014-05-01 15:08:15 +02:00
parent dc2d2ce53c
commit 60850fe3e8
9 changed files with 36 additions and 23 deletions

View File

@@ -145,7 +145,7 @@ void cHTTPConnection::Terminate(void)
void cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
bool cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
{
switch (m_State)
{
@@ -163,12 +163,12 @@ void cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
m_CurrentRequest = NULL;
m_State = wcsInvalid;
m_HTTPServer.CloseConnection(*this);
return;
return true;
}
if (m_CurrentRequest->IsInHeaders())
{
// The request headers are not yet complete
return;
return false;
}
// The request has finished parsing its headers successfully, notify of it:
@@ -184,13 +184,12 @@ void cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
// Process the rest of the incoming data into the request body:
if (a_Size > BytesConsumed)
{
cHTTPConnection::DataReceived(a_Data + BytesConsumed, a_Size - BytesConsumed);
return cHTTPConnection::DataReceived(a_Data + BytesConsumed, a_Size - BytesConsumed);
}
else
{
cHTTPConnection::DataReceived("", 0); // If the request has zero body length, let it be processed right-away
return cHTTPConnection::DataReceived("", 0); // If the request has zero body length, let it be processed right-away
}
break;
}
case wcsRecvBody:
@@ -210,7 +209,7 @@ void cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
{
m_State = wcsInvalid;
m_HTTPServer.CloseConnection(*this);
return;
return true;
}
delete m_CurrentRequest;
m_CurrentRequest = NULL;
@@ -224,6 +223,7 @@ void cHTTPConnection::DataReceived(const char * a_Data, size_t a_Size)
break;
}
}
return false;
}