X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fclient.c;h=2cd35409c907df442863c27c3257010c2b602773;hb=da186c5b5656cd210b2a8a8d9c75d2af0c8c3f66;hp=e0b9ee1c0fd438be8462f86745bdf09bd2dcfa7b;hpb=648b84d69294f138c3513992322813b94ed88c17;p=pazpar2-moved-to-github.git diff --git a/src/client.c b/src/client.c index e0b9ee1..2cd3540 100644 --- a/src/client.c +++ b/src/client.c @@ -119,7 +119,6 @@ struct client { ZOOM_resultset resultset; YAZ_MUTEX mutex; int ref_count; - /* copy of database->url */ char *url; }; @@ -671,7 +670,6 @@ void client_start_search(struct client *cl) struct connection *co = client_get_connection(cl); ZOOM_connection link = connection_get_link(co); ZOOM_resultset rs; - char *databaseName = sdb->database->databases[0]; const char *opt_piggyback = session_setting_oneval(sdb, PZ_PIGGYBACK); const char *opt_queryenc = session_setting_oneval(sdb, PZ_QUERYENCODING); const char *opt_elements = session_setting_oneval(sdb, PZ_ELEMENTS); @@ -729,9 +727,6 @@ void client_start_search(struct client *cl) sprintf(startrecs_str, "%d", cl->startrecs); ZOOM_connection_option_set(link, "start", startrecs_str); - if (databaseName) - ZOOM_connection_option_set(link, "databaseName", databaseName); - /* TODO Verify does it break something for CQL targets(non-SOLR) ? */ /* facets definition is in PQF */ client_set_facets_request(cl, link); @@ -756,7 +751,7 @@ void client_start_search(struct client *cl) connection_continue(co); } -struct client *client_create(void) +struct client *client_create(const char *url) { struct client *cl = xmalloc(sizeof(*cl)); cl->maxrecs = 100; @@ -776,7 +771,8 @@ struct client *client_create(void) pazpar2_mutex_create(&cl->mutex, "client"); cl->preferred = 0; cl->ref_count = 1; - cl->url = 0; + assert(url); + cl->url = xstrdup(url); client_use(1); return cl; @@ -1130,7 +1126,6 @@ int client_is_active_preferred(struct client *cl) return 0; } - Odr_int client_get_hits(struct client *cl) { return cl->hits; @@ -1154,24 +1149,11 @@ int client_get_diagnostic(struct client *cl) void client_set_database(struct client *cl, struct session_database *db) { cl->database = db; - /* Copy the URL for safe logging even after session is gone */ - if (db) { - cl->url = xstrdup(db->database->url); - } -} - -struct host *client_get_host(struct client *cl) -{ - return client_get_database(cl)->database->host; } const char *client_get_url(struct client *cl) { - if (cl->url) - return cl->url; - else - /* This must not happen anymore, as the url is present until destruction of client */ - return "NOURL"; + return cl->url; } void client_set_maxrecs(struct client *cl, int v)