From bc950407cb37e19d833dd9900137be41f7af4d03 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 8 May 2020 17:31:07 +0200 Subject: Bugfix: Path matching --- TODO | 1 - config.cpp | 5 ++++- debian/changelog | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index a44b624..7866813 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ -Match prefix Speed up config.GetPath weblog: link consistency check (cron?) Integrate into Debian: WNPP diff --git a/config.cpp b/config.cpp index a805028..a2ff24c 100644 --- a/config.cpp +++ b/config.cpp @@ -256,7 +256,10 @@ const Path& Config::GetPath(const Socket& socket, const std::string& requested_h for (const auto& m_host: site.hosts) { if (m_host == host) { for (const auto& path: site.paths) { - if (boost::starts_with(requested_path, path.requested) && path.requested.size() > path_len) { + if (boost::starts_with(requested_path, path.requested) && + "/&\0"s.find(requested_path[path.requested.size()]) != std::string::npos && + path.requested.size() > path_len) + { path_len = path.requested.size(); result = &path; } diff --git a/debian/changelog b/debian/changelog index 7f7ebb9..aea89e7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ webserver (1.5) unstable; urgency=medium + * Bugfix: Path matching * Minor fixes -- Roland Reichwein Fri, 08 May 2020 11:39:09 +0200 -- cgit v1.2.3