From 05ee6a02d78ff422ddb63bb4ebbc2f5988d9a121 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 19 Jul 2011 16:03:32 +0200 Subject: [PATCH] Add cs_create_host_proxy This is similar to cs_create_host but allows a proxy to be given. Comstack type is still taken from vhost (logical host). --- include/yaz/comstack.h | 4 ++++ src/comstack.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/include/yaz/comstack.h b/include/yaz/comstack.h index ed5065b..6aef53e 100644 --- a/include/yaz/comstack.h +++ b/include/yaz/comstack.h @@ -122,6 +122,10 @@ YAZ_EXPORT const char *cs_strerror(COMSTACK h); YAZ_EXPORT const char *cs_errmsg(int n); YAZ_EXPORT COMSTACK cs_create_host(const char *type_and_host, int blocking, void **vp); + +YAZ_EXPORT COMSTACK cs_create_host_proxy(const char *vhost, + int blocking, void **vp, + const char *proxy_host); YAZ_EXPORT void cs_get_host_args(const char *type_and_host, const char **args); YAZ_EXPORT int cs_complete_auto_head(const char *buf, int len); YAZ_EXPORT int cs_complete_auto(const char *buf, int len); diff --git a/src/comstack.c b/src/comstack.c index 669117d..b81e89c 100644 --- a/src/comstack.c +++ b/src/comstack.c @@ -157,6 +157,12 @@ static int cs_parse_host(const char *uri, const char **host, COMSTACK cs_create_host(const char *vhost, int blocking, void **vp) { + return cs_create_host_proxy(vhost, blocking, vp, 0); +} + +COMSTACK cs_create_host_proxy(const char *vhost, int blocking, void **vp, + const char *proxy_host) +{ enum oid_proto proto = PROTO_Z3950; const char *host = 0; COMSTACK cs; @@ -175,6 +181,8 @@ COMSTACK cs_create_host(const char *vhost, int blocking, void **vp) } if (cs) { + if (proxy_host) + host = proxy_host; if (!(*vp = cs_straddr(cs, connect_host ? connect_host : host))) { cs_close (cs); -- 1.7.10.4