Merge branch 'master' into sru_2_0
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 23 Sep 2013 13:41:46 +0000 (15:41 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 23 Sep 2013 13:41:46 +0000 (15:41 +0200)
Conflicts:
IDMETA
debian/changelog
debian/rules

NEWS
debian/changelog
debian/control
doc/zoom.xml
src/srwutil.c
src/zoom-c.c
src/zoom-p.h
src/zoom-sru.c
test/test_rpn2cql.c
test/test_rpn2solr.c

diff --git a/NEWS b/NEWS
index f67c855..c403130 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,18 @@
+--- 4.2.68 2013/09/23 
+
+GFS: pass additionalSearchInfo to search memeber search_input if
+given. Otherwise pass otherInfo. Request for facets and other search
+related things will be passed there in future versions of YAZ.
+
+New ZOOM setting, authenticationMode, which allows authentication
+paramters to be encoded in the URL rather than via HTTP Basic auth.
+YAZ-686
+
+rpn2solr: fix nested AND/OR handling. YAZ-685
+
+Add comparison routines for some Z-types, such as NamePlusRecord,
+RPNQuery, Query, RecordComposition and OtherInformation.
+
 --- 4.2.67 2013/09/19 
 
 Don't decode MAB as MARC. Just like we don't attempt to decode
index 5f2412f..7f3b93f 100644 (file)
@@ -4,6 +4,12 @@ yaz (5.0.0-1indexdata) unstable; urgency=low
 
  -- Adam Dickmeiss <adam@indexdata.dk>  Wed, 11 Sep 2013 09:26:11 +0200
 
+yaz (4.2.68-1indexdata) unstable; urgency=low
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Mon, 23 Sep 2013 10:10:59 +0200
+
 yaz (4.2.67-1indexdata) unstable; urgency=low
 
   * Upstram.
index ef506e8..eb4e1eb 100644 (file)
@@ -9,7 +9,7 @@ Build-Depends: debhelper (>= 5),
        libgnutls-dev,
        libreadline-dev|libreadline5-dev,
        libwrap0-dev,
-       libicu36-dev | libicu-dev
+       libicu-dev
 
 Package: libyaz5
 Section: libs
@@ -55,8 +55,8 @@ Description: documentation for the Z39.50 toolkit
 Package: libyaz5-dev
 Depends: libyaz5 (= ${Source-Version}),
        libxslt1-dev,
-       libicu36-dev|libicu-dev,
-       tcl8.3|tclsh
+       libicu-dev,
+       tclsh
 Provides: libyaz-dev
 Replaces: libyaz-dev
 Conflicts: libyaz2-dev, libyaz3-dev, libyaz-dev
index 930d979..1261c4e 100644 (file)
@@ -190,6 +190,9 @@ ZOOM_options_set_int(opt, name, value)
         password</entry><entry>Authentication password.
        </entry><entry>none</entry></row>
       <row><entry>
+        authenticationMode</entry><entry>How authentication is encoded.
+       </entry><entry>basic</entry></row>
+      <row><entry>
         host</entry><entry>Target host. This setting is "read-only".
         It's automatically set internally when connecting to a target.
        </entry><entry>none</entry></row>
@@ -390,9 +393,9 @@ ZOOM_options_set_int(opt, name, value)
    <sect2 id="zoom.sru.init.behavior">
     <title>SRU/Solr Protocol behavior</title>
     <para>
-     The HTTP based protocols (SRU, SRW, Solr) doesn't feature an Inititialize Request, so
-     the connection phase merely establishes a TCP/IP connection
-     with the SOAP service.
+     The HTTP based protocols (SRU, SRW, Solr) doesn't feature an
+     Inititialize Request, so  the connection phase merely establishes a
+     TCP/IP connection with the HTTP server.
     </para>
     <para>Most of the ZOOM connection options do not
      affect SRU/Solr and they are ignored. However, future versions
@@ -403,6 +406,19 @@ ZOOM_options_set_int(opt, name, value)
      The <literal>charset</literal> is used in the Content-Type header
      of HTTP requests.
     </para>
+    <para>
+     Setting <literal>authentcationMode</literal> specifies how
+     authentication parameters are encoded for HTTP. The default is
+     "<literal>basic</literal>" where <literal>user</literal> and
+     <literal>password</literal> are encoded by using HTTP basic
+     authentication.
+     </para>
+    <para>
+     If <literal>authentcationMode</literal> is "<literal>url</literal>", then
+     user and password are encoded in the URL by parameters
+     <literal>x-username</literal> and <literal>x-password</literal> as
+     given by the SRU standard.
+    </para>
    </sect2>
   </sect1>
   <sect1 id="zoom.query"><title>Queries</title>
index 2591fc9..83172d5 100644 (file)
@@ -1182,6 +1182,9 @@ void yaz_encode_sru_extra(Z_SRW_PDU *sr, ODR odr, const char *extra_args)
         Z_SRW_extra_arg **ea = &sr->extra_args;
         yaz_uri_to_array(extra_args, odr, &name, &val);
 
+        /** append rather than override */
+        while (*ea)
+            ea = &(*ea)->next;
         while (*name)
         {
             *ea = (Z_SRW_extra_arg *) odr_malloc(odr, sizeof(**ea));
index 03e6fe3..5f52d7c 100644 (file)
@@ -287,6 +287,7 @@ ZOOM_API(ZOOM_connection)
     c->user = 0;
     c->group = 0;
     c->password = 0;
+    c->url_authentication = 0;
 
     c->maximum_record_size = 0;
     c->preferred_message_size = 0;
@@ -525,10 +526,15 @@ ZOOM_API(void)
     val = ZOOM_options_get(c->options, "password");
     if (!val)
         val = ZOOM_options_get(c->options, "pass");
-
     if (val && *val)
         c->password = xstrdup(val);
 
+    val = ZOOM_options_get(c->options, "authenticationMode");
+    if (val && !strcmp(val, "url"))
+        c->url_authentication = 1;
+    else
+        c->url_authentication = 0;
+
     c->maximum_record_size =
         ZOOM_options_get_int(c->options, "maximumRecordSize", 64*1024*1024);
     c->preferred_message_size =
index 0f53b04..3be4591 100644 (file)
@@ -91,6 +91,7 @@ struct ZOOM_connection_p {
     char *user;
     char *group;
     char *password;
+    int url_authentication;
 
     int async;
     int support_named_resultsets;
index b3c34cb..22ac8c3 100644 (file)
@@ -62,8 +62,29 @@ static zoom_ret send_srw(ZOOM_connection c, Z_SRW_PDU *sr)
 static Z_SRW_PDU *ZOOM_srw_get_pdu(ZOOM_connection c, int type)
 {
     Z_SRW_PDU *sr = yaz_srw_get_pdu(c->odr_out, type, c->sru_version);
-    sr->username = c->user;
-    sr->password = c->password;
+    if (c->url_authentication && c->user)
+    {
+        Z_SRW_extra_arg **ea = &sr->extra_args;
+        while (*ea)
+            ea = &(*ea)->next;
+        *ea = (Z_SRW_extra_arg *) odr_malloc(c->odr_out, sizeof(**ea));
+        (*ea)->name = "x-username";
+        (*ea)->value = c->user;
+        ea = &(*ea)->next;
+        if (c->password)
+        {
+            *ea = (Z_SRW_extra_arg *) odr_malloc(c->odr_out, sizeof(**ea));
+            (*ea)->name = "x-password";
+            (*ea)->value = c->password;
+            ea = &(*ea)->next;
+        }
+        *ea = 0;
+    }
+    else
+    {
+        sr->username = c->user;
+        sr->password = c->password;
+    }
     return sr;
 }
 #endif
index b7a5114..9a717c1 100644 (file)
@@ -59,6 +59,11 @@ static void tst1(void)
     YAZ_CHECK(compare(ct, "abc", "abc"));
     YAZ_CHECK(compare(ct, "\"a b c\"", "\"a b c\""));
     YAZ_CHECK(compare(ct, "@and a b", "a and b"));
+    YAZ_CHECK(compare(ct, "@or a @and b c", "a or (b and c)"));
+    YAZ_CHECK(compare(ct, "@or @and a b @and c d", "(a and b) or (c and d)"));
+    YAZ_CHECK(compare(ct, "@or @or a b @or c d", "(a or b) or (c or d)"));
+    YAZ_CHECK(compare(ct, "@and @and a b @and c d", "(a and b) and (c and d)"));
+
     YAZ_CHECK(compare(ct, "@attr 1=field abc", "field=abc"));
     YAZ_CHECK(compare(ct, "@attr 1=4 abc", 0)); /* should fail */
 
index 0b0ddde..dfaad4a 100644 (file)
@@ -39,7 +39,10 @@ static int compare(solr_transform_t ct, const char *pqf, const char *solr)
             if (solr && !strcmp(wrbuf_cstr(w), solr))
                 ret = 1;
             else
-                yaz_log(YLOG_LOG, "Exp: %s", solr);
+            {
+                yaz_log(YLOG_WARN, " expected: %s", solr ? solr : "null");
+                yaz_log(YLOG_WARN, " got:      %s", wrbuf_cstr(w));
+            }
         }
     }
     wrbuf_destroy(w);
@@ -58,6 +61,11 @@ static void tst1(void)
     YAZ_CHECK(compare(ct, "@and @or a b c", "(a OR b) AND c"));
     YAZ_CHECK(compare(ct, "@and a b", "a AND b"));
     YAZ_CHECK(compare(ct, "@or a b", "a OR b"));
+    YAZ_CHECK(compare(ct, "@or a @and b c", "a OR (b AND c)"));
+    YAZ_CHECK(compare(ct, "@or @and a b @and c d", "(a AND b) OR (c AND d)"));
+    YAZ_CHECK(compare(ct, "@or @or a b @or c d", "(a OR b) OR (c OR d)"));
+    YAZ_CHECK(compare(ct, "@or @or @or a b @or c d @or e f", "((a OR b) OR (c OR d)) OR (e OR f)"));
+    YAZ_CHECK(compare(ct, "@and @and a b @and c d", "(a AND b) AND (c AND d)"));
     YAZ_CHECK(compare(ct, "@attr 1=field abc", "field:abc"));
     YAZ_CHECK(compare(ct, "@attr 1=field \"a b c\"", "field:\"a b c\""));
     YAZ_CHECK(compare(ct, "@attr 1=4 abc", 0)); /* should fail */
@@ -135,7 +143,6 @@ static void tst2(void)
     YAZ_CHECK(compare(ct, "@attr 1=4 @attr 4=1 @attr 6=1 abc", "dc.title:abc"));
 
     YAZ_CHECK(compare(ct, "@attr 1=1016 abc", "abc"));
-
     /* Date check */ 
     YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=1 1980", "dc.date:[* TO 1980}"));
     YAZ_CHECK(compare(ct, "@attr 1=30 @attr 2=2 1980", "dc.date:[* TO 1980]"));