Fixes for URL path not being propagated for SRU requests
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 2 Sep 2008 09:19:07 +0000 (11:19 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 2 Sep 2008 09:19:07 +0000 (11:19 +0200)
src/client.c
src/connection.c
src/database.c

index daf5f57..37cef18 100644 (file)
@@ -466,9 +466,8 @@ void client_start_search(struct client *cl)
         sprintf(n, "%d", global_parameters.toget);
         ZOOM_connection_option_set(link, "count", n);
     }
-    if (!databaseName || !*databaseName)
-        databaseName = "Default";
-    ZOOM_connection_option_set(link, "databaseName", databaseName);
+    if (databaseName)
+        ZOOM_connection_option_set(link, "databaseName", databaseName);
 
     ZOOM_connection_option_set(link, "presentChunk", "20");
 
index 08d80e6..32bafb5 100644 (file)
@@ -135,10 +135,8 @@ static void remove_connection_from_host(struct connection *con)
 
 void connection_continue(struct connection *co)
 {
-#if 1
     yaz_log(YLOG_LOG, "connection_continue");
     iochan_setevent(co->iochan, EVENT_OUTPUT);
-#endif
 }
 
 // Close connection and recycle structure
@@ -391,7 +389,16 @@ int connection_connect(struct connection *con)
     if (sru && *sru)
         strcpy(ipport, "http://");
     strcat(ipport, host->ipport);
-
+    /* deal with SRU path here because databaseName option is not read in
+       ZOOM in SRU mode */
+    if (sru && *sru)
+    {
+        if (*sdb->database->databases[0])
+        {
+            strcat(ipport, "/");
+            strcat(ipport, sdb->database->databases[0]);
+        }
+    }
     ZOOM_connection_connect(link, ipport, 0);
     
     con->link = link;
index 9069791..fab9249 100644 (file)
@@ -134,7 +134,7 @@ static struct database *load_database(const char *id)
     if ((dbname = strchr(hostport, '/')))
         *(dbname++) = '\0';
     else
-        dbname = "Default";
+        dbname = "";
     if (!(host = find_host(hostport)))
         return 0;
     db = nmem_malloc(nmem, sizeof(*db));