winix/core/data.cpp

48 lines
868 B
C++
Executable File

/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008, Tomasz Sowa
* All rights reserved.
*
*/
#include "data.h"
Data::Data()
{
signal_hup = false;
stdout_is_closed = false;
// the rest will be read from a config file
}
void Data::SetAdditionalVariables()
{
SetHttpHost();
}
void Data::SetHttpHost()
{
if( strncmp(base_url.c_str(), "http://", 7) == 0 )
base_url_http_host = base_url.substr(7);
else
if( strncmp(base_url.c_str(), "https://", 8) == 0 )
base_url_http_host = base_url.substr(8);
else
base_url_http_host.clear();
if( base_url_http_host.empty() )
return;
// removing the last slash (if it is present)
if( base_url_http_host[ base_url_http_host.size() - 1 ] == '/' )
base_url_http_host.erase( base_url_http_host.end() - 1 );
}