summaryrefslogtreecommitdiffstats
path: root/src/HTTPServer/HTTPConnection.cpp
diff options
context:
space:
mode:
authorSamuel Barney <samjbarney@gmail.com>2014-01-29 21:31:15 +0100
committerSamuel Barney <samjbarney@gmail.com>2014-01-29 21:31:15 +0100
commitb35b8d1749335527a7cebea9d1034ecdd83237a5 (patch)
tree1129ab2aa2b0a86f328183fde6e9949629656b41 /src/HTTPServer/HTTPConnection.cpp
parentAdded line endings for *nix (diff)
parentMerge pull request #599 from tonibm19/master (diff)
downloadcuberite-b35b8d1749335527a7cebea9d1034ecdd83237a5.tar
cuberite-b35b8d1749335527a7cebea9d1034ecdd83237a5.tar.gz
cuberite-b35b8d1749335527a7cebea9d1034ecdd83237a5.tar.bz2
cuberite-b35b8d1749335527a7cebea9d1034ecdd83237a5.tar.lz
cuberite-b35b8d1749335527a7cebea9d1034ecdd83237a5.tar.xz
cuberite-b35b8d1749335527a7cebea9d1034ecdd83237a5.tar.zst
cuberite-b35b8d1749335527a7cebea9d1034ecdd83237a5.zip
Diffstat (limited to 'src/HTTPServer/HTTPConnection.cpp')
-rw-r--r--src/HTTPServer/HTTPConnection.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp
index 68afdfc11..78b7ce4d9 100644
--- a/src/HTTPServer/HTTPConnection.cpp
+++ b/src/HTTPServer/HTTPConnection.cpp
@@ -26,7 +26,7 @@ cHTTPConnection::cHTTPConnection(cHTTPServer & a_HTTPServer) :
cHTTPConnection::~cHTTPConnection()
{
- // LOGD("HTTP: Del connection at %p", this);
+ delete m_CurrentRequest;
}
@@ -57,7 +57,7 @@ void cHTTPConnection::SendNeedAuth(const AString & a_Realm)
void cHTTPConnection::Send(const cHTTPResponse & a_Response)
{
- ASSERT(m_State = wcsRecvIdle);
+ ASSERT(m_State == wcsRecvIdle);
a_Response.AppendToData(m_OutgoingData);
m_State = wcsSendingResp;
m_HTTPServer.NotifyConnectionWrite(*this);
@@ -205,6 +205,12 @@ void cHTTPConnection::DataReceived(const char * a_Data, int a_Size)
{
m_State = wcsRecvIdle;
m_HTTPServer.RequestFinished(*this, *m_CurrentRequest);
+ if (!m_CurrentRequest->DoesAllowKeepAlive())
+ {
+ m_State = wcsInvalid;
+ m_HTTPServer.CloseConnection(*this);
+ return;
+ }
delete m_CurrentRequest;
m_CurrentRequest = NULL;
}