diff --git a/src/tawashi_implem/cgi_env.cpp b/src/tawashi_implem/cgi_env.cpp index d769f56..eac8ace 100644 --- a/src/tawashi_implem/cgi_env.cpp +++ b/src/tawashi_implem/cgi_env.cpp @@ -31,6 +31,7 @@ #include #include #include +#include BOOST_FUSION_ADAPT_STRUCT( tawashi::cgi::Env::VersionInfo, @@ -88,10 +89,18 @@ namespace cgi { { const std::string& path = m_cgi_env[CGIVars::PATH_INFO]; assert(parBasePath.size() <= path.size()); - if (boost::starts_with(path, parBasePath)) + + if (boost::starts_with(path, parBasePath)) { m_skip_path_info = parBasePath.size(); - else - m_skip_path_info = 0; + } + else { + auto statuslog = spdlog::get("statuslog"); + assert(statuslog); + std::string str_base_path(parBasePath.begin(), parBasePath.end()); + std::string str_path(path.begin(), path.end()); + statuslog->error("base path is not a prefix of PATH_INFO: base path={}, PATH_INFO={}, tawashi will most likely malfunction", str_base_path, str_path); + m_skip_path_info = 1; //try with the default, maybe the user is lucky and it will work (ie base path = /) + } } Env::~Env() noexcept = default;