From fab726282c5d2e04cdc9daa88b5d0a05ead8cf33 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 18 Jan 2014 20:20:56 +0100 Subject: HTTP connections aren't kept alive unless explicitly enabled. Only the client can decide that the connection can be kept alive, we must close the socket if the client doesn't indicate keepalive support. This will provide a fix for #390 when #560 is fixed; until then the issue remains, just it's no longer HTTPServer's fault. --- src/HTTPServer/HTTPConnection.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/HTTPServer/HTTPConnection.cpp') diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp index 3d30ab177..a4af706f2 100644 --- a/src/HTTPServer/HTTPConnection.cpp +++ b/src/HTTPServer/HTTPConnection.cpp @@ -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; } -- cgit v1.2.3 From 3c0e8c8da0e397f3fda6b1565e7b2e9eeb4a747b Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 19 Jan 2014 19:31:43 +0100 Subject: Rewritten SocketThreads for proper shutdown scenario. This fixes #560 and #390. --- src/HTTPServer/HTTPConnection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/HTTPServer/HTTPConnection.cpp') diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp index a4af706f2..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; } -- cgit v1.2.3