summaryrefslogtreecommitdiffstats
path: root/source/HTTPServer/HTTPConnection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/HTTPServer/HTTPConnection.cpp')
-rw-r--r--source/HTTPServer/HTTPConnection.cpp35
1 files changed, 34 insertions, 1 deletions
diff --git a/source/HTTPServer/HTTPConnection.cpp b/source/HTTPServer/HTTPConnection.cpp
index 2265d970f..c36b07d3d 100644
--- a/source/HTTPServer/HTTPConnection.cpp
+++ b/source/HTTPServer/HTTPConnection.cpp
@@ -69,6 +69,39 @@ void cHTTPConnection::FinishResponse(void)
+void cHTTPConnection::AwaitNextRequest(void)
+{
+ switch (m_State)
+ {
+ case wcsRecvIdle:
+ {
+ // The client is waiting for a response, send an "Internal server error":
+ m_OutgoingData.append("HTTP/1.1 500 Internal Server Error\r\n\r\n");
+ m_HTTPServer.NotifyConnectionWrite(*this);
+ m_State = wcsRecvHeaders;
+ break;
+ }
+
+ case wcsSendingResp:
+ {
+ // The response headers have been sent, we need to terminate the response body:
+ m_OutgoingData.append("0\r\n\r\n");
+ m_State = wcsRecvHeaders;
+ break;
+ }
+
+ default:
+ {
+ ASSERT(!"Unhandled state recovery");
+ break;
+ }
+ }
+}
+
+
+
+
+
void cHTTPConnection::DataReceived(const char * a_Data, int a_Size)
{
switch (m_State)
@@ -128,10 +161,10 @@ void cHTTPConnection::DataReceived(const char * a_Data, int a_Size)
}
if (m_CurrentRequestBodyRemaining == 0)
{
+ m_State = wcsRecvIdle;
m_HTTPServer.RequestFinished(*this, *m_CurrentRequest);
delete m_CurrentRequest;
m_CurrentRequest = NULL;
- m_State = wcsRecvIdle;
}
break;
}