mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2025-08-03 12:50:02 +00:00
Decompose the base_uri option.
This allows support for having tawashi in a subdirectory of your domain, eg http://example.com/tawashi
This commit is contained in:
parent
c5f3b3cbcc
commit
34daf8e411
9 changed files with 58 additions and 20 deletions
|
@ -77,7 +77,7 @@ TEST_CASE ("Index response", "[index][response]") {
|
|||
const char* const env_raw[] = {
|
||||
"AUTH_TYPE=",
|
||||
"CONTENT_TYPE=",
|
||||
"PATH_INFO=",
|
||||
"PATH_INFO=/",
|
||||
"PATH_TRANSLATED=",
|
||||
"QUERY_STRING=index.cgi"
|
||||
"REMOTE_ADDR=",
|
||||
|
@ -90,16 +90,19 @@ TEST_CASE ("Index response", "[index][response]") {
|
|||
"SERVER_SOFTWARE=",
|
||||
"CONTENT_LENGTH=",
|
||||
"SERVER_PORT=80",
|
||||
"HTTPS=",
|
||||
nullptr
|
||||
};
|
||||
SafeStackObject<tawashi::cgi::Env> fake_env(env_raw);
|
||||
SafeStackObject<tawashi::cgi::Env> fake_env(env_raw, "/");
|
||||
|
||||
std::string tawashi_settings(
|
||||
"[tawashi]\n"
|
||||
" base_uri = http://127.0.0.1\n"
|
||||
" host_name = 127.0.0.1\n"
|
||||
" website_root = /home/michele/dev/code/cpp/tawashi/html\n"
|
||||
" logging_level = debug\n"
|
||||
" langmap_dir = /usr/share/source-highlight\n"
|
||||
" host_path = /\n"
|
||||
" host_port =\n"
|
||||
);
|
||||
SafeStackObject<tawashi::IniFile> ini(std::move(tawashi_settings));
|
||||
SafeStackObject<tawashi::SettingsBag> settings(ini);
|
||||
|
|
|
@ -49,10 +49,11 @@ TEST_CASE ("Retrieve and sanitize invalid an invalid utf-8 text", "[utf8][securi
|
|||
|
||||
const char* const fake_env[] = {
|
||||
content_length.c_str(),
|
||||
"PATH_INFO=/",
|
||||
nullptr
|
||||
};
|
||||
|
||||
tawashi::cgi::Env env(fake_env);
|
||||
tawashi::cgi::Env env(fake_env, "/");
|
||||
const PostMapType& post_data = read_post(iss, env);
|
||||
|
||||
CHECK(g_utf8_validate(post_data.at("invalid_text").data(), post_data.at("invalid_text").size(), nullptr));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue