diff options
author | madmaxoft <github@xoft.cz> | 2013-10-06 16:40:28 +0200 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2013-10-06 16:40:28 +0200 |
commit | f55b77a98a41ba784109842cde39ba0e1d2bc262 (patch) | |
tree | 89c1b144d1a224c24bc7ae79e9b0304766e01a8f /source/HTTPServer/HTTPConnection.cpp | |
parent | cListenThread: Fixed thread termination. (diff) | |
download | cuberite-f55b77a98a41ba784109842cde39ba0e1d2bc262.tar cuberite-f55b77a98a41ba784109842cde39ba0e1d2bc262.tar.gz cuberite-f55b77a98a41ba784109842cde39ba0e1d2bc262.tar.bz2 cuberite-f55b77a98a41ba784109842cde39ba0e1d2bc262.tar.lz cuberite-f55b77a98a41ba784109842cde39ba0e1d2bc262.tar.xz cuberite-f55b77a98a41ba784109842cde39ba0e1d2bc262.tar.zst cuberite-f55b77a98a41ba784109842cde39ba0e1d2bc262.zip |
Diffstat (limited to 'source/HTTPServer/HTTPConnection.cpp')
-rw-r--r-- | source/HTTPServer/HTTPConnection.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/HTTPServer/HTTPConnection.cpp b/source/HTTPServer/HTTPConnection.cpp index 2addf4cfc..68afdfc11 100644 --- a/source/HTTPServer/HTTPConnection.cpp +++ b/source/HTTPServer/HTTPConnection.cpp @@ -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); } |