Fixed memory leaks in the HTTP framework
This commit is contained in:
@@ -17,11 +17,22 @@ cHTTPConnection::cHTTPConnection(cHTTPServer & a_HTTPServer) :
|
||||
m_State(wcsRecvHeaders),
|
||||
m_CurrentRequest(NULL)
|
||||
{
|
||||
// LOGD("HTTP: New connection at %p", this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cHTTPConnection::~cHTTPConnection()
|
||||
{
|
||||
// LOGD("HTTP: Del connection at %p", this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cHTTPConnection::SendStatusAndReason(int a_StatusCode, const AString & a_Response)
|
||||
{
|
||||
AppendPrintf(m_OutgoingData, "%d %s\r\nContent-Length: 0\r\n\r\n", a_StatusCode, a_Response.c_str());
|
||||
@@ -120,6 +131,19 @@ void cHTTPConnection::AwaitNextRequest(void)
|
||||
|
||||
|
||||
|
||||
void cHTTPConnection::Terminate(void)
|
||||
{
|
||||
if (m_CurrentRequest != NULL)
|
||||
{
|
||||
m_HTTPServer.RequestFinished(*this, *m_CurrentRequest);
|
||||
}
|
||||
m_HTTPServer.CloseConnection(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cHTTPConnection::DataReceived(const char * a_Data, int a_Size)
|
||||
{
|
||||
switch (m_State)
|
||||
@@ -214,6 +238,7 @@ void cHTTPConnection::SocketClosed(void)
|
||||
{
|
||||
m_HTTPServer.RequestFinished(*this, *m_CurrentRequest);
|
||||
}
|
||||
m_HTTPServer.CloseConnection(*this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user