From: Adam Dickmeiss Date: Mon, 6 Aug 2012 09:20:10 +0000 (+0200) Subject: Avoid using unix path as "database name" for virt_db X-Git-Tag: v1.3.40~3 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=db015fa75ee1f475040dba0512fc;p=metaproxy-moved-to-github.git Avoid using unix path as "database name" for virt_db Fix split_zurl to use cs_get_host_args which considers unix sockets as well. --- diff --git a/src/util.cpp b/src/util.cpp index 3ab3033..4d433a5 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 + 1; + 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(