string. Settings returned are strictly read-only.
-/* $Id: client.c,v 1.17 2007-08-17 12:25:26 adam Exp $
+/* $Id: client.c,v 1.18 2007-08-17 12:39:11 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
char **databaselist;
Z_Query *zquery;
int ssub = 0, lslb = 100000, mspn = 10;
- char *piggyback = 0;
- char *queryenc = session_setting_oneval(sdb, PZ_QUERYENCODING);
+ const char *piggyback = session_setting_oneval(sdb, PZ_PIGGYBACK);
+ const char *queryenc = session_setting_oneval(sdb, PZ_QUERYENCODING);
yaz_log(YLOG_DEBUG, "Sending search to %s", sdb->database->url);
for (ndb = 0; sdb->database->databases[ndb]; ndb++)
databaselist[ndb] = sdb->database->databases[ndb];
- if (!(piggyback = session_setting_oneval(sdb, PZ_PIGGYBACK))
- || *piggyback == '1')
+ if (!piggyback || *piggyback == '1')
{
const char *elements = session_setting_oneval(sdb, PZ_ELEMENTS);
const char *recsyn = session_setting_oneval(sdb, PZ_REQUESTSYNTAX);
static void init_authentication(struct client *cl, Z_InitRequest *req)
{
struct session_database *sdb = client_get_database(cl);
- char *auth = session_setting_oneval(sdb, PZ_AUTHENTICATION);
+ const char *auth = session_setting_oneval(sdb, PZ_AUTHENTICATION);
if (*auth)
{
Z_IdAuthentication *idAuth = odr_malloc(global_parameters.odr_out,
sizeof(*idAuth));
idAuth->which = Z_IdAuthentication_open;
- idAuth->u.open = auth;
+ idAuth->u.open = odr_strdup(global_parameters.odr_out, auth);
req->idAuthentication = idAuth;
connection_set_authentication(co, nmem_strdup(se->session_nmem, auth));
}
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);
-
+ const char *zproxy = session_setting_oneval(sdb, PZ_ZPROXY);
+
if (*zproxy)
yaz_oi_set_string_oid(&req->otherInfo,
global_parameters.odr_out,
-/* $Id: http_command.c,v 1.57 2007-07-16 17:01:46 adam Exp $
+/* $Id: http_command.c,v 1.58 2007-08-17 12:39:11 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
*/
/*
- * $Id: http_command.c,v 1.57 2007-07-16 17:01:46 adam Exp $
+ * $Id: http_command.c,v 1.58 2007-08-17 12:39:11 adam Exp $
*/
#include <stdio.h>
static void write_subrecord(struct record *r, WRBUF w,
struct conf_service *service, int show_details)
{
- char *name = session_setting_oneval(client_get_database(r->client), PZ_NAME);
+ const char *name = session_setting_oneval(
+ client_get_database(r->client), PZ_NAME);
wrbuf_puts(w, "<location id=\"");
wrbuf_xmlputs(w, client_get_database(r->client)->database->url);
-/* $Id: logic.c,v 1.61 2007-08-16 11:30:45 adam Exp $
+/* $Id: logic.c,v 1.62 2007-08-17 12:39:11 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
if (md->setting == Metadata_setting_parameter &&
(setting = settings_offset(md->name)) > 0)
{
- char *val = session_setting_oneval(sdb, setting);
+ const char *val = session_setting_oneval(sdb, setting);
if (val && nparms < MAX_XSLT_ARGS)
{
char *buf;
if (md->setting == Metadata_setting_postproc &&
(offset = settings_offset(md->name)) > 0)
{
- char *val = session_setting_oneval(sdb, offset);
+ const char *val = session_setting_oneval(sdb, offset);
if (val)
{
xmlNode *r = xmlDocGetRootElement(doc);
// Retrieve first defined value for 'name' for given database.
// Will be extended to take into account user associated with session
-char *session_setting_oneval(struct session_database *db, int offset)
+const char *session_setting_oneval(struct session_database *db, int offset)
{
if (!db->settings[offset])
return "";
// Initialize YAZ Map structures for MARC-based targets
static int prepare_yazmarc(struct session_database *sdb)
{
- char *s;
+ const char *s;
if (!sdb->settings)
{
// setting. However, this is not a realistic use scenario.
static int prepare_map(struct session *se, struct session_database *sdb)
{
- char *s;
+ const char *s;
if (!sdb->settings)
{
if (!strcmp(s, "auto"))
{
- char *request_syntax = session_setting_oneval(sdb,
- PZ_REQUESTSYNTAX);
+ const char *request_syntax = session_setting_oneval(
+ sdb, PZ_REQUESTSYNTAX);
if (request_syntax)
{
char *cp;
*count = 0;
for (cl = se->clients; cl; cl = client_next_in_session(cl))
{
- char *name = session_setting_oneval(client_get_database(cl), PZ_NAME);
+ const char *name = session_setting_oneval(client_get_database(cl),
+ PZ_NAME);
res[*count].id = client_get_database(cl)->database->url;
res[*count].name = *name ? name : "Unknown";
-/* $Id: pazpar2.h,v 1.46 2007-07-30 23:16:33 quinn Exp $
+/* $Id: pazpar2.h,v 1.47 2007-08-17 12:39:11 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
struct hitsbytarget {
char *id;
- char *name;
+ const char *name;
int hits;
int diagnostic;
int records;
int session_set_watch(struct session *s, int what, session_watchfun fun, void *data, struct http_channel *c);
int session_active_clients(struct session *s);
void session_apply_setting(struct session *se, char *dbname, char *setting, char *value);
-char *session_setting_oneval(struct session_database *db, int offset);
+const char *session_setting_oneval(struct session_database *db, int offset);
void start_http_listener(void);
void start_proxy(void);