mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2025-10-02 15:00:02 +00:00
Log an error if host_path looks wrong.
This commit is contained in:
parent
e84e968ff6
commit
58c3f5c224
1 changed files with 12 additions and 3 deletions
|
@ -31,6 +31,7 @@
|
||||||
#include <boost/fusion/adapted/struct.hpp>
|
#include <boost/fusion/adapted/struct.hpp>
|
||||||
#include <boost/phoenix/stl/container.hpp>
|
#include <boost/phoenix/stl/container.hpp>
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
BOOST_FUSION_ADAPT_STRUCT(
|
BOOST_FUSION_ADAPT_STRUCT(
|
||||||
tawashi::cgi::Env::VersionInfo,
|
tawashi::cgi::Env::VersionInfo,
|
||||||
|
@ -88,10 +89,18 @@ namespace cgi {
|
||||||
{
|
{
|
||||||
const std::string& path = m_cgi_env[CGIVars::PATH_INFO];
|
const std::string& path = m_cgi_env[CGIVars::PATH_INFO];
|
||||||
assert(parBasePath.size() <= path.size());
|
assert(parBasePath.size() <= path.size());
|
||||||
if (boost::starts_with(path, parBasePath))
|
|
||||||
|
if (boost::starts_with(path, parBasePath)) {
|
||||||
m_skip_path_info = parBasePath.size();
|
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;
|
Env::~Env() noexcept = default;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue