Version 1.6.43
[pazpar2-moved-to-github.git] / src / host.c
index 6978dd8..cece235 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Pazpar2.
-   Copyright (C) 2006-2013 Index Data
+   Copyright (C) Index Data
 
 Pazpar2 is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -88,7 +88,13 @@ struct host *find_host(database_hosts_t hosts, const char *url,
 
         tproxy = xmalloc (strlen(url) + 10); /* so we can add :port */
         strcpy(tproxy, url);
-        for (cp = tproxy; *cp; cp++)
+        if (!strncmp(tproxy, "http://", 7))
+            cp = tproxy + 7;
+        else if (!strncmp(tproxy, "https://", 8))
+            cp = tproxy + 8;
+        else
+            cp = tproxy;
+        for (; *cp; cp++)
             if (strchr("/?#~", *cp))
             {
                 *cp = '\0';