mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-26 10:11:30 +00:00
Preparing to save a few CPU cycles
This commit is contained in:
@ -97,8 +97,9 @@ inline std::string normalizeRootUrl(std::string rootUrl)
|
||||
std::string
|
||||
fullURL2LocalURL(const std::string& fullUrl, const std::string& rootLocation)
|
||||
{
|
||||
if ( kiwix::startsWith(fullUrl, rootLocation + "/") ) {
|
||||
return fullUrl.substr(rootLocation.size());
|
||||
assert(rootLocation.size() > 0 && rootLocation.back() == '/');
|
||||
if ( kiwix::startsWith(fullUrl, rootLocation) ) {
|
||||
return fullUrl.substr(rootLocation.size() - 1);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
@ -518,7 +519,7 @@ MHD_Result InternalServer::handlerCallback(struct MHD_Connection* connection,
|
||||
printf("full_url : %s\n", fullUrl);
|
||||
}
|
||||
|
||||
const auto url = fullURL2LocalURL(fullUrl, m_root);
|
||||
const auto url = fullURL2LocalURL(fullUrl, m_root + "/");
|
||||
RequestContext request(connection, m_root, url, method, version);
|
||||
|
||||
if (m_verbose.load() ) {
|
||||
|
Reference in New Issue
Block a user