X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Futil.cpp;h=97b11257c02be5c75f3097bb613a6233aaee4e75;hb=fb8cc0b693613d65043352b90089c8938cd39703;hp=3ab3033d2e5caefd413956dd6494c98fe5b35291;hpb=dc0a7b40ef2cc8138c93e078dd8c34de64460ebe;p=metaproxy-moved-to-github.git diff --git a/src/util.cpp b/src/util.cpp index 3ab3033..97b1125 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include #include +#include #include #include #include @@ -406,14 +407,15 @@ void mp_util::split_zurl(std::string zurl, std::string &host, std::list &db) { const char *zurl_cstr = zurl.c_str(); - const char *sep = strchr(zurl_cstr, '/'); - - if (sep) - { - host = std::string(zurl_cstr, sep - zurl_cstr); + const char *args = 0; + cs_get_host_args(zurl_cstr, &args); + + if (args && *args) + { + host = std::string(zurl_cstr, args - zurl_cstr); - const char *cp1 = sep+1; - while(1) + const char *cp1 = args; + while (1) { const char *cp2 = strchr(cp1, '+'); if (cp2) @@ -427,9 +429,7 @@ void mp_util::split_zurl(std::string zurl, std::string &host, } } else - { host = zurl; - } } bool mp_util::set_databases_from_zurl(