X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhost.c;h=5c7c15f0aa96f5a45359a780c53a154c88338acd;hb=57890a3d7d0eded2e7619cb1edaae129d7c8cb1d;hp=82b94bab6d4f5b2c0398e47b295af6dc419e44c8;hpb=817e3ec506c4095bc4fcc1923cee36153ef4ee43;p=pazpar2-moved-to-github.git diff --git a/src/host.c b/src/host.c index 82b94ba..5c7c15f 100644 --- a/src/host.c +++ b/src/host.c @@ -59,6 +59,7 @@ static struct host *create_host(const char *proxy, host->connections = 0; host->ipport = 0; host->mutex = 0; + host->error = 0; if (host_getaddrinfo(host, iochan_man)) { @@ -88,7 +89,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'; @@ -115,6 +122,8 @@ struct host *find_host(database_hosts_t hosts, const char *url, hosts->hosts = p; } } + if (p && p->error) /* already resolved error */ + p = 0; yaz_mutex_leave(hosts->mutex); xfree(tproxy); return p;