MXS-1220: Take the resource handler into use

The resource handler system is now usable but it doesn't perform anything
useful. Although, this will allows it to be tested for correctness.

Minor fixes to HttpResponse output and renaming of functions.
This commit is contained in:
Markus Mäkelä
2017-04-17 10:36:33 +03:00
committed by Markus Mäkelä
parent 8b1c0cd1a1
commit 900bf2db5a
6 changed files with 46 additions and 38 deletions

View File

@ -23,11 +23,11 @@
using std::string;
using std::stringstream;
HttpResponse::HttpResponse(string response, enum http_code code):
HttpResponse::HttpResponse(enum http_code code, string response):
m_body(response),
m_code(code)
{
m_headers["Date"] = get_http_date();
m_headers["Date"] = http_get_date();
// TODO: Add proper modification timestamps
m_headers["Last-Modified"] = m_headers["Date"];
@ -54,7 +54,7 @@ void HttpResponse::add_header(string name, string value)
string HttpResponse::get_response() const
{
stringstream response;
response << "HTTP/1.1 " << http_code_to_string(m_code);
response << "HTTP/1.1 " << http_code_to_string(m_code) << "\r\n";
for (map<string, string>::const_iterator it = m_headers.begin();
it != m_headers.end(); it++)