New ZOOM connection setting: tproxy
[yaz-moved-to-github.git] / src / zoom-c.c
index 8d97e0f..3615ed9 100644 (file)
@@ -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)
     {