From 17c29c7ff55b762c4e35e54e043a04b33fe35369 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 22 Mar 2010 12:57:00 +0100 Subject: [PATCH] Do not mess with databaseName for HTTP redirect --- client/client.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/client/client.c b/client/client.c index 45eb69d..3c68c58 100644 --- a/client/client.c +++ b/client/client.c @@ -666,11 +666,10 @@ static int cmd_base(const char *arg) return set_base(arg); } -int session_connect(const char *arg) +static int session_connect_base(const char *arg, const char **basep) { void *add; char type_and_host[101]; - const char *basep = 0; if (conn) { cs_close(conn); @@ -682,7 +681,7 @@ int session_connect(const char *arg) session_mem = NULL; session_initResponse = 0; } - cs_get_host_args(arg, &basep); + cs_get_host_args(arg, basep); strncpy(type_and_host, arg, sizeof(type_and_host)-1); type_and_host[sizeof(type_and_host)-1] = '\0'; @@ -718,11 +717,6 @@ int session_connect(const char *arg) } printf("OK.\n"); cs_print_session_info(conn); - if (basep && *basep) - set_base(basep); - else if (protocol == PROTO_Z3950) - set_base("Default"); - if (protocol == PROTO_Z3950) { send_initRequest(type_and_host); @@ -731,6 +725,19 @@ int session_connect(const char *arg) return 0; } +static int session_connect(const char *arg) +{ + int r; + const char *basep = 0; + + r = session_connect_base(arg, &basep); + if (basep && *basep) + set_base(basep); + else if (protocol == PROTO_Z3950) + set_base("Default"); + return r; +} + int cmd_open(const char *arg) { int r; @@ -4422,7 +4429,8 @@ static void wait_and_handle_response(int one_response_only) && !yaz_matchstr(sru_method, "get") && (location = z_HTTP_header_lookup(hres->headers, "Location"))) { - session_connect(location); + const char *base_tmp; + session_connect_base(location, &base_tmp); no_redirects++; if (conn) { -- 1.7.10.4