MXS-1220: Add self links to all resources

A self link to the resource itself provides a convenient way for the
client to request a resource, modify it and call the self link to update
it. This removes some of the burden on the client to keep track of the
resource links by placing these in the resource itself.
This commit is contained in:
Markus Mäkelä
2017-04-21 08:28:35 +03:00
committed by Markus Mäkelä
parent ac7ec04af1
commit 50eafe19fe
8 changed files with 60 additions and 53 deletions

View File

@ -19,6 +19,11 @@
using std::string;
using std::deque;
#define HTTP_HOST_HEADER "Host"
const std::string HttpRequest::HTTP_PREFIX = "http://";
const std::string HttpRequest::HTTPS_PREFIX = "https://";
/** TODO: Move this to a C++ string utility header */
namespace maxscale
{
@ -93,7 +98,9 @@ HttpRequest::HttpRequest(struct MHD_Connection *connection, string url, string m
m_connection(connection)
{
process_uri(url, m_resource_parts);
m_hostname = get_header("Host");
// TODO: Add https support
m_hostname = HttpRequest::HTTP_PREFIX;
m_hostname += get_header(HTTP_HOST_HEADER);
}
HttpRequest::~HttpRequest()