File tree Expand file tree Collapse file tree 2 files changed +7
-17
lines changed Expand file tree Collapse file tree 2 files changed +7
-17
lines changed Original file line number Diff line number Diff line change @@ -75,12 +75,12 @@ void Server::stop() {
7575void Server::setRoot (const std::string& root)
7676{
7777 m_root = root;
78- if ( m_root[ 0 ] != ' /' ) {
79- m_root = " / " + m_root ;
80- }
81- if ( m_root.back () == ' /' ) {
82- m_root. erase ( m_root.size () - 1 );
83- }
78+ while (! m_root. empty () && m_root. back () == ' /' )
79+ m_root. pop_back () ;
80+
81+ while (! m_root.empty () && m_root. front () == ' /' )
82+ m_root = m_root.substr ( 1 );
83+ m_root = m_root. empty () ? m_root : " / " + m_root;
8484}
8585
8686void Server::setAddress (const std::string& addr)
Original file line number Diff line number Diff line change @@ -100,16 +100,6 @@ bool ipAvailable(const std::string addr)
100100 return false ;
101101}
102102
103- inline std::string normalizeRootUrl (std::string rootUrl)
104- {
105- while ( !rootUrl.empty () && rootUrl.back () == ' /' )
106- rootUrl.pop_back ();
107-
108- while ( !rootUrl.empty () && rootUrl.front () == ' /' )
109- rootUrl = rootUrl.substr (1 );
110- return rootUrl.empty () ? rootUrl : " /" + rootUrl;
111- }
112-
113103std::string
114104fullURL2LocalURL (const std::string& fullUrl, const std::string& rootLocation)
115105{
@@ -444,7 +434,7 @@ InternalServer::InternalServer(LibraryPtr library,
444434 std::string contentServerUrl) :
445435 m_addr(addr),
446436 m_port(port),
447- m_root(normalizeRootUrl( root) ),
437+ m_root(root),
448438 m_rootPrefixOfDecodedURL(m_root),
449439 m_nbThreads(nbThreads),
450440 m_multizimSearchLimit(multizimSearchLimit),
You can’t perform that action at this time.
0 commit comments