Custom session ID may be specified for SRU filter
[metaproxy-moved-to-github.git] / src / filter_sru_to_z3950.cpp
index d57c34d..17e5b55 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Metaproxy.
-   Copyright (C) 2005-2010 Index Data
+   Copyright (C) 2005-2011 Index Data
 
 Metaproxy is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -116,7 +116,8 @@ yf::SRUtoZ3950::~SRUtoZ3950()
 {  // must have a destructor because of boost::scoped_ptr
 }
 
-void yf::SRUtoZ3950::configure(const xmlNode *xmlnode, bool test_only)
+void yf::SRUtoZ3950::configure(const xmlNode *xmlnode, bool test_only,
+                               const char *path)
 {
     m_p->configure(xmlnode);
 }
@@ -222,6 +223,10 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req)
         {
             package.origin().set_max_sockets(atoi(arg->value));
         }
+        else if (!strcmp(arg->name, "x-session-id"))
+        {
+            package.origin().set_custom_session(arg->value);
+        }
 
     assert(sru_pdu_req);
 
@@ -368,6 +373,9 @@ yf::SRUtoZ3950::Impl::z3950_init_request(mp::Package &package,
     }
 
     init_req->idAuthentication = auth;
+
+    *init_req->preferredMessageSize = 10*1024*1024;
+    *init_req->maximumRecordSize = 10*1024*1024;
     
     ODR_MASK_SET(init_req->options, Z_Options_search);
     ODR_MASK_SET(init_req->options, Z_Options_present);
@@ -461,6 +469,9 @@ bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package,
     Z_APDU *apdu = zget_APDU(odr_en, Z_APDU_searchRequest);
     Z_SearchRequest *z_searchRequest = apdu->u.searchRequest;
 
+    // RecordSyntax will always be XML
+    z_searchRequest->preferredRecordSyntax
+        = odr_oiddup(odr_en, yaz_oid_recsyn_xml);
 
     if (!mp_util::set_databases_from_zurl(odr_en, zurl,
                                           &z_searchRequest->num_databaseNames,