From d40078d163036fbc2207bf2f5a9fbf7eeaa44fc1 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 19 Apr 2015 17:32:44 +0200 Subject: HTTP: Error message is sent as the payload as well. This shows the error message in the browsers. Before, the browsers would display just a blank page. --- src/HTTPServer/HTTPConnection.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/HTTPServer/HTTPConnection.cpp') diff --git a/src/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp index de12b36ce..a5c6afd18 100644 --- a/src/HTTPServer/HTTPConnection.cpp +++ b/src/HTTPServer/HTTPConnection.cpp @@ -38,7 +38,9 @@ cHTTPConnection::~cHTTPConnection() void cHTTPConnection::SendStatusAndReason(int a_StatusCode, const AString & a_Response) { - SendData(Printf("%d %s\r\nContent-Length: 0\r\n\r\n", a_StatusCode, a_Response.c_str())); + SendData(Printf("HTTP/1.1 %d %s\r\n", a_StatusCode, a_Response.c_str())); + SendData(Printf("Content-Length: %u\r\n\r\n", static_cast(a_Response.size()))); + SendData(a_Response.data(), a_Response.size()); m_State = wcsRecvHeaders; } -- cgit v1.2.3