25 #include <sys/types.h>
29 #include <yaz/matchstr.h>
35 #include <sys/types.h>
49 host = xmalloc(
sizeof(
struct host));
53 host->
proxy = xstrdup(proxy);
57 host->
tproxy = xstrdup(tproxy);
80 const char *
proxy,
int port,
86 if (!proxy || !*proxy)
90 tproxy = xmalloc (strlen(url) + 10);
92 if (!strncmp(tproxy,
"http://", 7))
94 else if (!strncmp(tproxy,
"https://", 8))
99 if (strchr(
"/?#~", *cp))
104 if (!strchr(tproxy,
':'))
105 sprintf(cp,
":%d", port);
107 yaz_mutex_enter(hosts->
mutex);
110 if (!yaz_strcmp_null(p->
tproxy, tproxy) &&
111 !yaz_strcmp_null(p->
proxy, proxy))
127 yaz_mutex_leave(hosts->
mutex);
145 struct host *p = (*pp)->hosts;
149 yaz_mutex_destroy(&p->
mutex);
155 yaz_mutex_destroy(&(*pp)->mutex);
struct host * find_host(database_hosts_t hosts, const char *url, const char *proxy, int port, iochan_man_t iochan_man)
void database_hosts_destroy(database_hosts_t *pp)
struct connection * connections
database_hosts_t database_hosts_create(void)
Represents a host (irrespective of databases)
static struct host * create_host(const char *proxy, const char *tproxy, iochan_man_t iochan_man)
int host_getaddrinfo(struct host *host, iochan_man_t iochan_man)
void pazpar2_mutex_create(YAZ_MUTEX *p, const char *name)