Merge branch 'mp-564'
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 21 Oct 2014 07:07:32 +0000 (09:07 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 21 Oct 2014 07:07:32 +0000 (09:07 +0200)
IDMETA
NEWS
etc/config1.xml
src/filter_http_file.cpp
src/filter_z3950_client.cpp
win/makefile
xml/schema/filter_z3950_client.rnc

diff --git a/IDMETA b/IDMETA
index 403f7fa..3d169e6 100644 (file)
--- a/IDMETA
+++ b/IDMETA
@@ -1,4 +1,4 @@
 DEBIAN_DIST="jessie wheezy squeeze"
 UBUNTU_DIST="trusty saucy precise"
 CENTOS_DIST="centos5 centos6"
-VERSION=1.5.10
+VERSION=1.5.11
diff --git a/NEWS b/NEWS
index 8daa661..a73460c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+--- 1.5.11 2014/10/20
+
+http_file: add include of sys/stat.h fixes MP-576
+
+Fix documentation about SRU client support MP-572
+
+Initialize Libxml2 - for threaded operation MP-571
+
 --- 1.5.10 2014/08/26
 
 On SIGTERM shut down connection+listening sockets MP-568
index 11a9fec..1ad1be8 100644 (file)
@@ -15,6 +15,7 @@
      <default_target>localhost:9999</default_target>
      <force_close>true</force_close>
      <client_ip>true</client_ip>
+     <charset>utf-8</charset>
     </filter>
   </filters>
   <routes>
index 997b627..500cdc1 100644 (file)
@@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <metaproxy/package.hpp>
 #include <metaproxy/util.hpp>
 #include "filter_http_file.hpp"
+#include <sys/stat.h>
 
 #include <yaz/zgdu.h>
 #include <yaz/log.h>
index 343e33d..eef55ad 100644 (file)
@@ -36,6 +36,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <yaz/otherinfo.h>
 #include <yaz/diagbib1.h>
 #include <yaz/oid_db.h>
+#include <yaz/charneg.h>
 
 #include <yazpp/socket-manager.h>
 #include <yazpp/pdu-assoc.h>
@@ -85,6 +86,7 @@ namespace metaproxy_1 {
             int m_max_sockets;
             bool m_force_close;
             bool m_client_ip;
+            std::string m_charset;
             std::string m_default_target;
             std::string m_force_target;
             boost::mutex m_mutex;
@@ -464,6 +466,35 @@ yf::Z3950Client::Assoc *yf::Z3950Client::Rep::get_assoc(Package &package)
     return as;
 }
 
+static void set_charset_proposal(ODR odr, Z_InitRequest *req, const char *charset)
+{
+    Z_OtherInformation **p = &req->otherInfo;
+    Z_OtherInformationUnit *oi;
+
+    if (*p)
+    {
+        int i;
+        for (i = 0; i < (*p)->num_elements; i++)
+        {
+            Z_External *ext = (*p)->list[i]->information.externallyDefinedInfo;
+            if ((*p)->list[i]->which == Z_OtherInfo_externallyDefinedInfo
+                && ext &&
+                ext->which == Z_External_charSetandLanguageNegotiation)
+                return;
+        }
+    }
+    if ((oi = yaz_oi_update(p, odr, 0, 0, 0)))
+    {
+        ODR_MASK_SET(req->options, Z_Options_negotiationModel);
+        oi->which = Z_OtherInfo_externallyDefinedInfo;
+        oi->information.externallyDefinedInfo =
+            yaz_set_proposal_charneg_list(odr, ",",
+                                          charset,
+                                          0 /* lang */,
+                                          1 /* records included */);
+    }
+}
+
 void yf::Z3950Client::Rep::send_and_receive(Package &package,
                                             yf::Z3950Client::Assoc *c)
 {
@@ -536,6 +567,9 @@ void yf::Z3950Client::Rep::send_and_receive(Package &package,
                                   1, pcomb.c_str());
         }
     }
+    if (apdu->which == Z_APDU_initRequest && m_charset.length() > 0)
+        set_charset_proposal(odr, apdu->u.initRequest, m_charset.c_str());
+
     // prepare response
     c->m_time_elapsed = 0;
     c->m_waiting = true;
@@ -626,6 +660,10 @@ void yf::Z3950Client::configure(const xmlNode *ptr, bool test_only,
         {
             m_p->m_client_ip = mp::xml::get_bool(ptr, 0);
         }
+        else if (!strcmp((const char *) ptr->name, "charset"))
+        {
+            m_p->m_charset = mp::xml::get_text(ptr);
+        }
         else
         {
             throw mp::filter::FilterException("Bad element "
index 93286f0..20fb95c 100644 (file)
@@ -8,7 +8,7 @@
 DEBUG=0   # 0 for release, 1 for debug
 
 # Metaproxy version
-VERSION=1.5.10
+VERSION=1.5.11
 
 # YAZ and YAZ++ directories
 YAZ_DIR=..\..\yaz
index 04c6b64..929e0f0 100644 (file)
@@ -10,5 +10,6 @@ filter_z3950_client =
   element mp:default_target { xsd:string }?,
   element mp:force_target { xsd:string }?,
   element mp:force_close { xsd:boolean }?,
-  element mp:client_ip { xsd:boolean }?
+  element mp:client_ip { xsd:boolean }?,
+  element mp:charset { xsd:string }?