@ -103,6 +103,16 @@ std::string loadCustomTemplate (std::string customIndexPath) {
return indexTemplateString ;
return indexTemplateString ;
}
}
inline std : : string normalizeRootUrl ( std : : string rootUrl )
{
while ( ! rootUrl . empty ( ) & & rootUrl . back ( ) = = ' / ' )
rootUrl . pop_back ( ) ;
while ( ! rootUrl . empty ( ) & & rootUrl . front ( ) = = ' / ' )
rootUrl = rootUrl . substr ( 1 ) ;
return rootUrl . empty ( ) ? rootUrl : " / " + rootUrl ;
}
volatile sig_atomic_t waiting = false ;
volatile sig_atomic_t waiting = false ;
volatile sig_atomic_t libraryMustBeReloaded = false ;
volatile sig_atomic_t libraryMustBeReloaded = false ;
@ -393,7 +403,7 @@ int main(int argc, char** argv)
exit ( 1 ) ;
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 ( ) ) + normalizeRootUrl( rootLocation) ;
std : : cout < < " The Kiwix server is running and can be accessed in the local network at: "
std : : cout < < " The Kiwix server is running and can be accessed in the local network at: "
< < url < < std : : endl ;
< < url < < std : : endl ;