From 9c16e53767bd8849846ca807fb15303782c062d2 Mon Sep 17 00:00:00 2001 From: renaud gaudin Date: Thu, 28 Jul 2022 11:30:48 +0000 Subject: [PATCH] Default kiwix-serve's rootLocation to "/"" Usage mentions that the rootLocation defaults to `/` while it was not. It defaulted to an empty string. While it defaulting to "" or "/" has no technical consequence: libkiwix's server normalizes the requested rootLocation ; it leads to users setting a "/"-prefixed rootLocation when customizing it, resulting in double-slashed print of the URL to access kiwix-serve at. This harmonizes usage and actual default, fixing the URL print. --- src/server/kiwix-serve.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index 8f9431b..4dd091c 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -186,7 +186,7 @@ int main(int argc, char** argv) setup_sighandlers(); #endif - std::string rootLocation = ""; + std::string rootLocation = "/"; kiwix::Library library; unsigned int nb_threads = DEFAULT_THREADS; std::vector zimPathes; @@ -393,7 +393,7 @@ int main(int argc, char** argv) exit(1); } - std::string url = "http://" + server.getAddress() + ":" + std::to_string(server.getPort()) + "/" + rootLocation; + std::string url = "http://" + server.getAddress() + ":" + std::to_string(server.getPort()) + rootLocation; std::cout << "The Kiwix server is running and can be accessed in the local network at: " << url << std::endl;