From 3c287bc1d48ee6a1f300054c2cebd0ba312bd5b9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 9 Nov 2011 15:56:04 +0100 Subject: [PATCH] New ZOOM connection setting: tproxy It's like proxy, but does not set Z39.50 proxy OID or change HTTP for proxy behavior. Can be used to set resolved address + port for a connection outside ZOOM itself. --- src/zoom-c.c | 15 ++++++++++++++- src/zoom-p.h | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/zoom-c.c b/src/zoom-c.c index 8d97e0f..3615ed9 100644 --- a/src/zoom-c.c +++ b/src/zoom-c.c @@ -267,6 +267,7 @@ ZOOM_API(ZOOM_connection) c->host_port = 0; c->proxy = 0; + c->tproxy = 0; c->charset = c->lang = 0; @@ -389,6 +390,16 @@ ZOOM_API(void) c->proxy = xstrdup(val); } + xfree(c->tproxy); + c->tproxy = 0; + val = ZOOM_options_get(c->options, "tproxy"); + if (val && *val) + { + yaz_log(c->log_details, "%p ZOOM_connection_connect tproxy=%s", c, val); + c->tproxy = xstrdup(val); + } + + xfree(c->charset); c->charset = 0; val = ZOOM_options_get(c->options, "charset"); @@ -591,6 +602,7 @@ ZOOM_API(void) ZOOM_connection_remove_events(c); xfree(c->host_port); xfree(c->proxy); + xfree(c->tproxy); xfree(c->charset); xfree(c->lang); xfree(c->cookie_out); @@ -1045,7 +1057,8 @@ static zoom_ret do_connect_host(ZOOM_connection c, const char *logical_url) if (c->cs) cs_close(c->cs); - c->cs = cs_create_host_proxy(logical_url, 0, &add, c->proxy); + c->cs = cs_create_host_proxy(logical_url, 0, &add, + c->tproxy ? c->tproxy : c->proxy); if (c->cs && c->cs->protocol == PROTO_HTTP) { diff --git a/src/zoom-p.h b/src/zoom-p.h index 6daf6d1..e8c58b5 100644 --- a/src/zoom-p.h +++ b/src/zoom-p.h @@ -78,6 +78,7 @@ struct ZOOM_connection_p { char *buf_out; int len_out; char *proxy; + char *tproxy; char *charset; char *lang; char *cookie_out; -- 1.7.10.4