mirror of https://github.com/kiwix/libkiwix.git
Ensure that the root is correctly formatted.
This commit is contained in:
parent
c890e1c87e
commit
e452f5cf36
|
@ -50,7 +50,7 @@ namespace kiwix
|
||||||
*/
|
*/
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void set_root(const std::string& root) { m_root = root; }
|
void set_root(const std::string& root);
|
||||||
void set_addr(const std::string& addr) { m_addr = addr; }
|
void set_addr(const std::string& addr) { m_addr = addr; }
|
||||||
void set_port(int port) { m_port = port; }
|
void set_port(int port) { m_port = port; }
|
||||||
void set_nbThreads(int threads) { m_nbThreads = threads; }
|
void set_nbThreads(int threads) { m_nbThreads = threads; }
|
||||||
|
|
|
@ -172,6 +172,17 @@ void Server::stop() {
|
||||||
mp_server.reset(nullptr);
|
mp_server.reset(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Server::set_root(const std::string& root)
|
||||||
|
{
|
||||||
|
m_root = root;
|
||||||
|
if (m_root[0] != '/') {
|
||||||
|
m_root = "/" + m_root;
|
||||||
|
}
|
||||||
|
if (m_root.back() == '/') {
|
||||||
|
m_root.erase(m_root.size() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
InternalServer::InternalServer(Library& library,
|
InternalServer::InternalServer(Library& library,
|
||||||
NameMapper* nameMapper,
|
NameMapper* nameMapper,
|
||||||
|
|
Loading…
Reference in New Issue