Fix incorrect parsing of URLs @:9999/somebase&url=http://some.host YAZ-842
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 22 May 2015 08:45:28 +0000 (10:45 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 22 May 2015 08:45:28 +0000 (10:45 +0200)
src/comstack.c

index 3948cc5..066fafd 100644 (file)
@@ -55,7 +55,6 @@ const char *cs_strerror(COMSTACK h)
 
 void cs_get_host_args(const char *type_and_host, const char **args)
 {
-
     *args = "";
     if (!strncmp(type_and_host, "unix:", 5))
     {
@@ -67,13 +66,12 @@ void cs_get_host_args(const char *type_and_host, const char **args)
     }
     if (*type_and_host)
     {
-        const char *cp;
-        cp = strstr(type_and_host, "://");
+        const char *cp = strchr(type_and_host, '/');
         if (cp)
-            cp = cp+3;
-        else
-            cp = type_and_host;
-        cp = strchr(cp, '/');
+        {
+            if (cp > type_and_host && !memcmp(cp - 1, "://", 3))
+                cp = strchr(cp + 2, '/');
+        }
         if (cp)
             *args = cp+1;
     }