-/* $Id: client.c,v 1.6 2007-06-02 04:32:28 quinn Exp $
+/* $Id: client.c,v 1.7 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
}
}
+static void init_zproxy(struct client *cl, Z_InitRequest *req)
+{
+ struct session_database *sdb = client_get_database(cl);
+ char *ztarget = sdb->database->url;
+ //char *ztarget = sdb->url;
+ char *zproxy = session_setting_oneval(sdb, PZ_ZPROXY);
+
+ if (*zproxy)
+#if YAZ_VERSIONL >= 0x020163
+ yaz_oi_set_string_oid(&req->otherInfo,
+ global_parameters.odr_out,
+ yaz_oid_userinfo_proxy,
+ 1, ztarget);
+#else
+ yaz_oi_set_string_oidval(&req->otherInfo,
+ global_parameters.odr_out, VAL_PROXY,
+ 1, ztarget);
+#endif
+}
+
+
static void client_init_request(struct client *cl)
{
Z_APDU *a = zget_APDU(global_parameters.odr_out, Z_APDU_initRequest);
ODR_MASK_SET(a->u.initRequest->protocolVersion, Z_ProtocolVersion_3);
init_authentication(cl, a->u.initRequest);
+ init_zproxy(cl, a->u.initRequest);
+
- /* add virtual host if tunneling through Z39.50 proxy */
-
- if (0 < strlen(global_parameters.zproxy_override)
- && 0 < strlen(client_get_database(cl)->database->url))
- {
-#if YAZ_VERSIONL >= 0x020163
- yaz_oi_set_string_oid(&a->u.initRequest->otherInfo,
- global_parameters.odr_out,
- yaz_oid_userinfo_proxy,
- 1, client_get_database(cl)->database->url);
-#else
- yaz_oi_set_string_oidval(&a->u.initRequest->otherInfo,
- global_parameters.odr_out, VAL_PROXY,
- 1, client_get_database(cl->database)->url);
-#endif
- }
if (send_apdu(cl, a) >= 0)
client_set_state(cl, Client_Initializing);
-/* $Id: config.c,v 1.34 2007-05-23 11:19:31 marc Exp $
+/* $Id: config.c,v 1.35 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
02111-1307, USA.
*/
-/* $Id: config.c,v 1.34 2007-05-23 11:19:31 marc Exp $ */
+/* $Id: config.c,v 1.35 2007-06-06 11:49:48 marc Exp $ */
#include <string.h>
server->proxy_host = 0;
server->proxy_port = 0;
server->myurl = 0;
- server->zproxy_host = 0;
- server->zproxy_port = 0;
+ //server->zproxy_host = 0;
+ //server->zproxy_port = 0;
server->service = 0;
server->next = 0;
server->settings = 0;
xmlFree(host);
xmlFree(myurl);
}
- else if (!strcmp((const char *) n->name, "zproxy"))
- {
- xmlChar *port = 0;
- xmlChar *host = 0;
-
- port = xmlGetProp(n, (xmlChar *) "port");
- host = xmlGetProp(n, (xmlChar *) "host");
-
- if (port)
- server->zproxy_port = atoi((const char *) port);
- if (host)
- server->zproxy_host = nmem_strdup(nmem, (const char *) host);
-
- xmlFree(port);
- xmlFree(host);
- }
+/* else if (!strcmp((const char *) n->name, "zproxy")) */
+/* { */
+/* xmlChar *port = 0; */
+/* xmlChar *host = 0; */
+
+/* port = xmlGetProp(n, (xmlChar *) "port"); */
+/* host = xmlGetProp(n, (xmlChar *) "host"); */
+
+/* if (port) */
+/* server->zproxy_port = atoi((const char *) port); */
+/* if (host) */
+/* server->zproxy_host = nmem_strdup(nmem, (const char *) host); */
+
+/* xmlFree(port); */
+/* xmlFree(host); */
+/* } */
else if (!strcmp((const char *) n->name, "settings"))
{
if (server->settings)
-/* $Id: config.h,v 1.23 2007-05-23 11:19:31 marc Exp $
+/* $Id: config.h,v 1.24 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
char *proxy_host;
int proxy_port;
char *myurl;
- char *zproxy_host;
- int zproxy_port;
+ //char *zproxy_host;
+ //int zproxy_port;
char *settings;
#ifdef HAVE_ICU
-/* $Id: connection.c,v 1.3 2007-06-02 04:32:28 quinn Exp $
+/* $Id: connection.c,v 1.4 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
void *addr;
int res;
+ struct session_database *sdb = client_get_database(con->client);
+ char *zproxy = session_setting_oneval(sdb, PZ_ZPROXY);
+
assert(host->ipport);
assert(con);
return -1;
}
- if (0 == strlen(global_parameters.zproxy_override)){
+ if (!zproxy || 0 == strlen(zproxy)){
/* no Z39.50 proxy needed - direct connect */
yaz_log(YLOG_DEBUG, "Connection create %s", connection_get_url(con));
} else {
/* Z39.50 proxy connect */
yaz_log(YLOG_DEBUG, "Connection create %s proxy %s",
- connection_get_url(con), global_parameters.zproxy_override);
+ connection_get_url(con), zproxy);
- if (!(addr = cs_straddr(link, global_parameters.zproxy_override)))
+ if (!(addr = cs_straddr(link, zproxy)))
{
yaz_log(YLOG_WARN|YLOG_ERRNO,
- "Lookup of IP address %s failed",
- global_parameters.zproxy_override);
+ "Lookup of ZProxy IP address %s failed",
+ zproxy);
return -1;
}
}
-/* $Id: logic.c,v 1.35 2007-06-02 04:32:28 quinn Exp $
+/* $Id: logic.c,v 1.36 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
{
"",
"",
- "",
- "",
+ /* "", */
+ "",
0,
0, /* dump_records */
0, /* debug_mode */
http_set_proxyaddr(hp, ser->myurl ? ser->myurl : "");
}
-void start_zproxy(void)
-{
- struct conf_server *ser = global_parameters.server;
-
- if (*global_parameters.zproxy_override){
- yaz_log(YLOG_LOG, "Z39.50 proxy %s",
- global_parameters.zproxy_override);
- return;
- }
-
- else if (ser->zproxy_host || ser->zproxy_port)
- {
- char hp[128] = "";
-
- strcpy(hp, ser->zproxy_host ? ser->zproxy_host : "");
- if (ser->zproxy_port)
- {
- if (*hp)
- strcat(hp, ":");
- else
- strcat(hp, "@:");
-
- sprintf(hp + strlen(hp), "%d", ser->zproxy_port);
- }
- strcpy(global_parameters.zproxy_override, hp);
- yaz_log(YLOG_LOG, "Z39.50 proxy %s",
- global_parameters.zproxy_override);
-
- }
- else
- return;
-}
+/* void start_zproxy(void) */
+/* { */
+/* struct conf_server *ser = global_parameters.server; */
+
+/* if (*global_parameters.zproxy_override){ */
+/* yaz_log(YLOG_LOG, "Z39.50 proxy %s", */
+/* global_parameters.zproxy_override); */
+/* return; */
+/* } */
+
+/* else if (ser->zproxy_host || ser->zproxy_port) */
+/* { */
+/* char hp[128] = ""; */
+
+/* strcpy(hp, ser->zproxy_host ? ser->zproxy_host : ""); */
+/* if (ser->zproxy_port) */
+/* { */
+/* if (*hp) */
+/* strcat(hp, ":"); */
+/* else */
+/* strcat(hp, "@:"); */
+
+/* sprintf(hp + strlen(hp), "%d", ser->zproxy_port); */
+/* } */
+/* strcpy(global_parameters.zproxy_override, hp); */
+/* yaz_log(YLOG_LOG, "Z39.50 proxy %s", */
+/* global_parameters.zproxy_override); */
+
+/* } */
+/* else */
+/* return; */
+/* } */
// Master list of connections we're handling events to
static IOCHAN channel_list = 0;
-/* $Id: parameters.h,v 1.2 2007-05-23 21:58:28 adam Exp $
+/* $Id: parameters.h,v 1.3 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
struct parameters {
char proxy_override[128];
char listener_override[128];
- char zproxy_override[128];
+ //char zproxy_override[128];
char settings_path_override[128];
struct conf_server *server;
int dump_records;
-/* $Id: pazpar2.c,v 1.85 2007-05-23 21:58:28 adam Exp $
+/* $Id: pazpar2.c,v 1.86 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
yaz_log_init_prefix("pazpar2");
- while ((ret = options("f:h:p:z:t:l:dX", argv, argc, &arg)) != -2)
+ //while ((ret = options("f:h:p:z:t:l:dX", argv, argc, &arg)) != -2)
+ while ((ret = options("f:h:p:t:l:dX", argv, argc, &arg)) != -2)
{
switch (ret)
{
case 'p':
strcpy(global_parameters.proxy_override, arg);
break;
- case 'z':
- strcpy(global_parameters.zproxy_override, arg);
- break;
+/* case 'z': */
+/* strcpy(global_parameters.zproxy_override, arg); */
+/* break; */
case 't':
strcpy(global_parameters.settings_path_override, arg);
break;
start_http_listener();
start_proxy();
- start_zproxy();
+ //start_zproxy();
init_settings();
if (*global_parameters.settings_path_override)
-/* $Id: pazpar2.h,v 1.36 2007-05-10 11:46:09 adam Exp $
+/* $Id: pazpar2.h,v 1.37 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
void start_http_listener(void);
void start_proxy(void);
-void start_zproxy(void);
+//void start_zproxy(void);
void pazpar2_add_channel(IOCHAN c);
void pazpar2_event_loop(void);
-/* $Id: settings.c,v 1.22 2007-05-18 19:52:52 quinn Exp $
+/* $Id: settings.c,v 1.23 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
"pz:name",
"pz:queryencoding",
"pz:ip",
+ "pz:zproxy",
0
};
-/* $Id: settings.h,v 1.17 2007-05-16 17:16:21 quinn Exp $
+/* $Id: settings.h,v 1.18 2007-06-06 11:49:48 marc Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
#define PZ_NAME 10
#define PZ_QUERYENCODING 11
#define PZ_IP 12
+#define PZ_ZPROXY 13
struct setting