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 @@ -99,16 +99,6 @@ bool ipAvailable(const std::string addr)
9999 return false ;
100100}
101101
102- inline std::string normalizeRootUrl (std::string rootUrl)
103- {
104- while ( !rootUrl.empty () && rootUrl.back () == ' /' )
105- rootUrl.pop_back ();
106-
107- while ( !rootUrl.empty () && rootUrl.front () == ' /' )
108- rootUrl = rootUrl.substr (1 );
109- return rootUrl.empty () ? rootUrl : " /" + rootUrl;
110- }
111-
112102std::string
113103fullURL2LocalURL (const std::string& fullUrl, const std::string& rootLocation)
114104{
@@ -440,7 +430,7 @@ InternalServer::InternalServer(LibraryPtr library,
440430 std::string contentServerUrl) :
441431 m_addr(addr),
442432 m_port(port),
443- m_root(normalizeRootUrl( root) ),
433+ m_root(root),
444434 m_rootPrefixOfDecodedURL(m_root),
445435 m_nbThreads(nbThreads),
446436 m_multizimSearchLimit(multizimSearchLimit),
You can’t perform that action at this time.
0 commit comments