Merge remote-tracking branch 'origin/master' into rewrite-filter
authorHeikki Levanto <heikki@indexdata.dk>
Wed, 29 May 2013 11:12:49 +0000 (13:12 +0200)
committerHeikki Levanto <heikki@indexdata.dk>
Wed, 29 May 2013 11:13:10 +0000 (13:13 +0200)
Conflicts:
src/Makefile.am

Signed-off-by: Heikki Levanto <heikki@indexdata.dk>

45 files changed:
IDMETA
NEWS
configure.ac
debian/changelog
doc/http_client.xml
etc/Makefile.am
etc/config-proxy-with-loggging.xml [deleted file]
etc/config-proxy.xml [new file with mode: 0644]
etc/config1.xml
example-module/Makefile
example-module/mytest.cpp [new file with mode: 0644]
include/metaproxy/Makefile.am
include/metaproxy/router_chain.hpp [new file with mode: 0644]
m4
metaproxy-config.in
src/Makefile.am
src/ex_filter_frontend_net.cpp [deleted file]
src/ex_router_flexml.cpp [deleted file]
src/factory_filter.cpp
src/factory_static.cpp
src/filter_http_client.cpp
src/filter_present_chunk.cpp [new file with mode: 0644]
src/filter_present_chunk.hpp [new file with mode: 0644]
src/filter_sd_remove.cpp [new file with mode: 0644]
src/filter_sd_remove.hpp [new file with mode: 0644]
src/router_chain.cpp
src/router_chain.hpp [deleted file]
src/test_filter2.cpp
src/test_filter_auth_simple.cpp
src/test_filter_backend_test.cpp
src/test_filter_bounce.cpp
src/test_filter_frontend_net.cpp
src/test_filter_log.cpp
src/test_filter_multi.cpp
src/test_filter_query_rewrite.cpp
src/test_filter_record_transform.cpp
src/test_filter_rewrite.cpp
src/test_filter_sru_to_z3950.cpp
src/test_filter_virt_db.cpp
src/test_filter_z3950_client.cpp
win/makefile
xml/schema/Makefile.am
xml/schema/filter_present_chunk.rnc [new file with mode: 0644]
xml/schema/filter_sd_remove.rnc [new file with mode: 0644]
xml/schema/metaproxy.rnc

diff --git a/IDMETA b/IDMETA
index 3863584..e466914 100644 (file)
--- a/IDMETA
+++ b/IDMETA
@@ -1,4 +1,4 @@
 DEBIAN_DIST="wheezy squeeze"
 UBUNTU_DIST="quantal precise oneiric natty lucid"
 CENTOS_DIST="centos5 centos6"
-VERSION=1.3.55
+VERSION=1.3.56
diff --git a/NEWS b/NEWS
index df28d02..0aa1719 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,23 @@
+--- 1.3.56 2013/05/27
+
+New filter present_chunk. This filter allows splitting of present requests into smaller chunks.
+
+New filter sd_remove, which replaces surrogate diagnostics with
+SUTRS records. This filter tries to deal with clients that breaks
+when receiving surrogate diagnostics.
+
+new filter http_client. Same role as z3950_client, but just for
+HTTP. Allows Metaproxy to operate as a HTTP proxy.
+
+New filter http_rewrite1, which serves as purpose on how to rewrite
+HTTP content with Metaproxy.
+
+Use libboost-system if available, because newer versions of libboost-threads
+requires libboost-system.
+
+Allow frontend_net to serve SSL/HTTPS, because we can specify a server
+certificate now.
+
 --- 1.3.55 2013/04/10
 
 zoom: Torus setting: authenticationMode which may hold values "basic"
index 75858ed..6f870a0 100644 (file)
@@ -59,7 +59,7 @@ AC_COMPILE_IFELSE(
 )
 YAZ_DOC
 
-ID_BOOST([thread test regex],[1.33])
+ID_BOOST([system thread test regex],[1.33])
 if test -z "${BOOST_THREAD_LIB}"; then
     AC_MSG_ERROR([Boost thread development libraries required])
 fi
index 9659d7b..095e8ad 100644 (file)
@@ -1,3 +1,9 @@
+metaproxy (1.3.56-1indexdata) unstable; urgency=low
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Mon, 27 May 2013 13:14:23 +0200
+
 metaproxy (1.3.55-1indexdata) unstable; urgency=low
 
   * Upstream.
index 17d2355..30fd3f8 100644 (file)
 
  <refsect1><title>DESCRIPTION</title>
   <para>
-   This module implements HTTP client functionality. By default,
-   if proxy element is not given, it should be used as an explicit
-   proxy (non-transparent mode). If proxy element is set, requests
-   will be relayed to the proxy given (transparent mode for HTTP clients
-   accessing this module).
+   This module implements HTTP client functionality. Filter rontend_net
+   + http_client in combo - acts as a normal, non-transparent, proxy.
+  </para>
+  <para>
+   The element default-host of configuration specifies the default host
+   in remote URL. If this is set, frontend_net + http_client acts as a
+   transparent HTTP proxy as well.
+  </para>
+  <para>
+   The configuration element, proxy, is optional and enables a remote
+   HTTP proxy to be in use.
   </para>
  </refsect1>
 
@@ -44,7 +50,7 @@
    A typical configuration looks like this:
    <screen><![CDATA[
    <filter type="http_client">
-    <proxy>localhost:9999</proxy>
+    <proxy>localhost:3128</proxy>
    </filter>
 ]]>
    </screen>
index 2b75022..50e4d4c 100644 (file)
@@ -22,6 +22,7 @@ xmlconfig = $(srcdir)/config-bytarget.xml \
     $(srcdir)/config-cgi.xml \
     $(srcdir)/config-solr.xml \
     $(srcdir)/config-zoom.xml \
+    $(srcdir)/config-proxy.xml \
     $(srcdir)/retrieval-info.xml
 
 config = example.simple-auth example.target-auth pqf2pqf.xsl explain.xml \
diff --git a/etc/config-proxy-with-loggging.xml b/etc/config-proxy-with-loggging.xml
deleted file mode 100644 (file)
index 0e28ab6..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
-  <start route="start"/>
-  <!-- sample config which illustrates the use of http_file filter.. -->
-  <filters>
-    <filter id="frontend" type="frontend_net">
-      <threads>20</threads>
-      <port>@:9000</port> 
-      <message>FN</message>
-      <stat-req>/fn_stat</stat-req>
-    </filter>
-  </filters>
-  <routes>
-    <route id="start">
-      <filter refid="frontend"/>
-      <filter type="http_file">
-       <mimetypes>/etc/mime.types</mimetypes>
-       <area>
-         <documentroot>.</documentroot>
-         <prefix>/etc</prefix>
-       </area>
-      </filter>
-      <filter type="log"><category access="false" line="true" apdu="true" /></filter>
-<!--
-      <filter type="http_rewrite1">
-        <replace content-type="text/html" pattern="YAZ" replacement="yaz"/>
-      </filter>
--->
-      <filter type="http_client">
-<!--
-       <proxy>localhost:9999</proxy>
--->
-      </filter>
-      <filter type="bounce"/>
-    </route>
-  </routes>
-</metaproxy>
-
diff --git a/etc/config-proxy.xml b/etc/config-proxy.xml
new file mode 100644 (file)
index 0000000..f3b522d
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<metaproxy xmlns="http://indexdata.com/metaproxy" version="1.0">
+  <start route="start"/>
+  <!-- sample config which illustrates the use of http_file filter.. -->
+  <routes>
+    <route id="start">
+      <filter type="frontend_net">
+        <threads>10</threads>
+        <port>tcp:@:9000</port>
+        <port cert_fname="ztest.pem">ssl:@:9001</port>
+      </filter>
+      <filter type="log">
+        <message>M</message>
+        <category apdu="true"/>
+      </filter>
+      <filter type="http_client">
+        <!-- <default-host>https://localhost:9999</default-host> -->
+        <!-- <proxy>localhost:3128</proxy> -->
+      </filter>
+    </route>
+  </routes>
+</metaproxy>
+
index dd91ae4..583a508 100644 (file)
       <filter type="log">
         <message>log</message>
       </filter>
+      <filter type="sd_remove"/>
+      <filter type="present_chunk">
+        <chunk>2</chunk>
+      </filter>
       <filter refid="backend"/>
       <filter type="bounce"/>
     </route>
index a352aed..c73d362 100644 (file)
@@ -1,15 +1,18 @@
 CONFIG=../metaproxy-config
 SO=metaproxy_filter_myfilter.so
 
-all: $(SO)
+all: $(SO) mytest
 
 $(SO): filter_myfilter.cpp
-       echo $(LIBS)
-       $(CXX) -shared `$(CONFIG) --cflags` -fPIC -I ../src $< \
-               -o $(SO) `$(CONFIG) --libs`
+       $(CXX) -shared `$(CONFIG) --cflags` -fPIC $< \
+               -o $@ `$(CONFIG) --libs`
+
+mytest: mytest.cpp
+       $(CXX) `$(CONFIG) --cflags` $< \
+               -o $@ `$(CONFIG) --libs`
 
 clean:
-       rm -f *.so
+       rm -f *.so mytest
 
 run: all
        ../src/metaproxy -c config.xml
diff --git a/example-module/mytest.cpp b/example-module/mytest.cpp
new file mode 100644 (file)
index 0000000..d4bdf0e
--- /dev/null
@@ -0,0 +1,53 @@
+/* This file is part of Metaproxy.
+   Copyright (C) 2005-2013 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
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include <yaz/log.h>
+#include <yaz/diagbib1.h>
+
+#include <metaproxy/router_chain.hpp>
+#include <yaz/test.h>
+
+namespace mp = metaproxy_1;
+
+void tst(void)
+{
+    try {
+        mp::RouterChain router;
+    }
+    catch ( ... ) {
+        YAZ_CHECK(0);
+    }
+
+}
+
+int main(int argc, char **argv)
+{
+    YAZ_CHECK_INIT(argc, argv);
+    tst();
+    YAZ_CHECK_TERM;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index d5ecded..0f38914 100644 (file)
@@ -2,5 +2,5 @@
 ## Copyright (C) 2005-2013 Index Data
 
 pkginclude_HEADERS= filter.hpp origin.hpp package.hpp \
-       router.hpp session.hpp util.hpp xmlutil.hpp
+       router.hpp session.hpp util.hpp xmlutil.hpp router_chain.hpp
 
diff --git a/include/metaproxy/router_chain.hpp b/include/metaproxy/router_chain.hpp
new file mode 100644 (file)
index 0000000..2d83729
--- /dev/null
@@ -0,0 +1,58 @@
+/* This file is part of Metaproxy.
+   Copyright (C) 2005-2013 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
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef ROUTER_CHAIN_HPP
+#define ROUTER_CHAIN_HPP
+
+
+#include <metaproxy/router.hpp>
+
+#include <boost/scoped_ptr.hpp>
+#include <stdexcept>
+
+namespace metaproxy_1 {
+    class RouterChain : public Router {
+        class Rep;
+        class Pos;
+    public:
+        RouterChain();
+        virtual ~RouterChain();
+        virtual RoutePos *createpos() const;
+        RouterChain & append(const filter::Base &filter);
+        void start();
+        void stop();
+    private:
+        boost::scoped_ptr<Rep> m_p;
+        /// disabled because class is singleton
+        RouterChain(const RouterChain &);
+
+        /// disabled because class is singleton
+        RouterChain& operator=(const RouterChain &);
+    };
+}
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
diff --git a/m4 b/m4
index 12f3277..06ec18f 160000 (submodule)
--- a/m4
+++ b/m4
@@ -1 +1 @@
-Subproject commit 12f3277de6a4c46c27835d45890ab1732e3dab81
+Subproject commit 06ec18fbfaad00e4aaf915a2704c4b04c6f2924d
index 7d90136..dc56b44 100644 (file)
@@ -12,7 +12,7 @@ echo_lalibs=no
 src_root=@abs_top_srcdir@
 build_root=@abs_top_builddir@
 
-libs="@BOOST_LIB@ @BOOST_REGEX_LIB@ @BOOST_THREAD_LIB@ @YAZPPLIB@ @LIBS@"
+libs="@BOOST_LIB@ @BOOST_SYSTEM_LIB@ @BOOST_REGEX_LIB@ @BOOST_THREAD_LIB@ @YAZPPLIB@ @LIBS@"
 lalibs="@YAZPPLALIB@ @LIBS@"
 VERSION=@VERSION@
 
index e5c40aa..42bb6b3 100644 (file)
@@ -9,19 +9,11 @@ AM_CXXFLAGS = $(BOOST_CPPFLAGS)
 
 AM_CPPFLAGS = -I$(top_srcdir)/include $(USEMARCONINC)
 
-AM_LDFLAGS =
-
 bin_SCRIPTS = metaproxy-config
 
-# Rules for the library..
-
-lib_LTLIBRARIES = libmetaproxy.la
-libmetaproxy_la_LDFLAGS = -version-info 4:0:0 -export-dynamic
-
-libmetaproxy_la_SOURCES = \
+filter_src = \
        factory_filter.cpp factory_filter.hpp \
        factory_static.cpp factory_static.hpp \
-       filter.cpp \
        filter_auth_simple.cpp filter_auth_simple.hpp \
        filter_backend_test.cpp filter_backend_test.hpp \
        filter_bounce.cpp filter_bounce.hpp \
@@ -37,8 +29,10 @@ libmetaproxy_la_SOURCES = \
        filter_log.cpp filter_log.hpp \
        filter_multi.cpp filter_multi.hpp \
        filter_query_rewrite.cpp filter_query_rewrite.hpp \
+       filter_present_chunk.cpp filter_present_chunk.hpp \
        filter_record_transform.cpp filter_record_transform.hpp \
        filter_session_shared.cpp filter_session_shared.hpp \
+       filter_sd_remove.cpp filter_sd_remove.hpp \
        filter_sort.cpp filter_sort.hpp \
         filter_sru_to_z3950.cpp  filter_sru_to_z3950.hpp \
        filter_template.cpp filter_template.hpp \
@@ -46,13 +40,18 @@ libmetaproxy_la_SOURCES = \
        filter_z3950_client.cpp filter_z3950_client.hpp \
        filter_zeerex_explain.cpp  filter_zeerex_explain.hpp \
        filter_zoom.cpp filter_zoom.hpp \
+        router_flexml.hpp router_flexml.cpp
+
+lib_LTLIBRARIES = libmetaproxy.la
+libmetaproxy_la_LDFLAGS = -version-info 4:0:0 -export-dynamic
+
+libmetaproxy_la_SOURCES = \
+       filter.cpp \
        gduutil.cpp gduutil.hpp \
        origin.cpp \
        package.cpp \
        pipe.cpp pipe.hpp \
        plainfile.cpp \
-       router_chain.hpp router_chain.cpp \
-        router_flexml.hpp router_flexml.cpp \
        session.cpp \
        sru_util.cpp sru_util.hpp \
        thread_pool_observer.cpp thread_pool_observer.hpp \
@@ -60,23 +59,27 @@ libmetaproxy_la_SOURCES = \
        url_recipe.cpp \
        util.cpp \
        html_parser.hpp html_parser.cpp \
-       xmlutil.cpp 
+       router_chain.cpp \
+       xmlutil.cpp
 
+libmetaproxy_la_LIBADD = $(YAZPPLALIB) \
+       $(BOOST_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_THREAD_LIB) \
+       $(BOOST_REGEX_LIB)
 
-libmetaproxy_la_LIBADD = $(YAZPPLALIB) $(BOOST_LIB) $(BOOST_THREAD_LIB) $(BOOST_REGEX_LIB)
+metaproxy_LDADD = libmetaproxy.la $(YAZPPLALIB) \
+       $(BOOST_LIB) $(BOOST_SYSTEM_LIB) $(BOOST_THREAD_LIB) \
+       $(BOOST_REGEX_LIB) $(USEMARCONLALIB)
 
-# Rules for lib
+tstdl_LDADD = $(metaproxy_LDADD)
 
-LDADD = libmetaproxy.la $(YAZPPLALIB) $(BOOST_LIB) $(BOOST_THREAD_LIB) \
-       $(BOOST_REGEX_LIB) $(USEMARCONLALIB)
+LDADD = $(metaproxy_LDADD) $(BOOST_TEST_LIB)
+AM_LDFLAGS = -export-dynamic
 
 bin_PROGRAMS = metaproxy
-noinst_PROGRAMS = ex_filter_frontend_net ex_router_flexml tstdl
+noinst_PROGRAMS = tstdl
 
-ex_filter_frontend_net_SOURCES = ex_filter_frontend_net.cpp
-ex_router_flexml_SOURCES =  ex_router_flexml.cpp
 tstdl_SOURCES = tstdl.cpp
-metaproxy_SOURCES = metaproxy_prog.cpp
+metaproxy_SOURCES = metaproxy_prog.cpp $(filter_src)
 
 # Rules for dl programs
 pkglib_LTLIBRARIES = metaproxy_filter_dl.la
@@ -116,57 +119,31 @@ TESTS=$(check_PROGRAMS)
 
 test_package1_SOURCES=test_package1.cpp
 test_pipe_SOURCES=test_pipe.cpp
-test_filter1_SOURCES=test_filter1.cpp
-test_filter2_SOURCES=test_filter2.cpp
+test_filter1_SOURCES=test_filter1.cpp $(filter_src)
+test_filter2_SOURCES=test_filter2.cpp $(filter_src)
 test_session1_SOURCES=test_session1.cpp
 test_session2_SOURCES=test_session2.cpp
 test_boost_threads_SOURCES=test_boost_threads.cpp
 test_thread_pool_observer_SOURCES = test_thread_pool_observer.cpp
-test_filter_auth_simple_SOURCES = test_filter_auth_simple.cpp
-test_filter_factory_SOURCES = test_filter_factory.cpp
-test_filter_frontend_net_SOURCES = test_filter_frontend_net.cpp
-test_filter_log_SOURCES = test_filter_log.cpp
-test_filter_multi_SOURCES = test_filter_multi.cpp
-test_filter_query_rewrite_SOURCES = test_filter_query_rewrite.cpp
-test_filter_z3950_client_SOURCES = test_filter_z3950_client.cpp
-test_filter_backend_test_SOURCES = test_filter_backend_test.cpp
-test_filter_bounce_SOURCES = test_filter_bounce.cpp
-test_filter_record_transform_SOURCES = test_filter_record_transform.cpp
-test_filter_sru_to_z3950_SOURCES = test_filter_sru_to_z3950.cpp
-test_filter_virt_db_SOURCES = test_filter_virt_db.cpp
-test_filter_rewrite_SOURCES = test_filter_rewrite.cpp
+test_filter_auth_simple_SOURCES = test_filter_auth_simple.cpp $(filter_src)
+test_filter_factory_SOURCES = test_filter_factory.cpp $(filter_src)
+test_filter_frontend_net_SOURCES = test_filter_frontend_net.cpp $(filter_src)
+test_filter_log_SOURCES = test_filter_log.cpp $(filter_src)
+test_filter_multi_SOURCES = test_filter_multi.cpp $(filter_src)
+test_filter_query_rewrite_SOURCES = test_filter_query_rewrite.cpp $(filter_src)
+test_filter_z3950_client_SOURCES = test_filter_z3950_client.cpp $(filter_src)
+test_filter_backend_test_SOURCES = test_filter_backend_test.cpp $(filter_src)
+test_filter_bounce_SOURCES = test_filter_bounce.cpp $(filter_src)
+test_filter_record_transform_SOURCES = test_filter_record_transform.cpp \
+       $(filter_src)
+test_filter_sru_to_z3950_SOURCES = test_filter_sru_to_z3950.cpp $(filter_src)
+test_filter_virt_db_SOURCES = test_filter_virt_db.cpp $(filter_src)
 test_ses_map_SOURCES = test_ses_map.cpp
-test_router_flexml_SOURCES = test_router_flexml.cpp
-test_html_parser_SOURCES = test_html_parser.cpp
+test_router_flexml_SOURCES = test_router_flexml.cpp $(filter_src)
 test_xmlutil_SOURCES = test_xmlutil.cpp
 
-TESTLDADD = $(LDADD) $(BOOST_TEST_LIB)
-
-test_package1_LDADD = $(TESTLDADD)
-test_pipe_LDADD = $(TESTLDADD)
-test_filter1_LDADD = $(TESTLDADD)
-test_filter2_LDADD = $(TESTLDADD)
-test_session1_LDADD = $(TESTLDADD)
-test_session2_LDADD = $(TESTLDADD)
-test_boost_threads_LDADD = $(TESTLDADD)
-test_filter_auth_simple_LDADD = $(TESTLDADD)
-test_filter_factory_LDADD = $(TESTLDADD)
-test_filter_frontend_net_LDADD = $(TESTLDADD)
-test_filter_log_LDADD = $(TESTLDADD)
-test_filter_multi_LDADD = $(TESTLDADD)
-test_filter_query_rewrite_LDADD = $(TESTLDADD)
-test_filter_z3950_client_LDADD = $(TESTLDADD)
-test_filter_backend_test_LDADD = $(TESTLDADD)
-test_filter_bounce_LDADD = $(TESTLDADD)
-test_filter_record_transform_LDADD = $(TESTLDADD)
-test_filter_sru_to_z3950_LDADD = $(TESTLDADD)
-test_filter_virt_db_LDADD = $(TESTLDADD)
-test_filter_rewrite_LDADD = $(TESTLDADD)
-test_router_flexml_LDADD = $(TESTLDADD)
-test_ses_map_LDADD = $(TESTLDADD)
-test_thread_pool_observer_LDADD = $(TESTLDADD)
-test_html_parser_LDADD = $(TESTLDADD)
-test_xmlutil_LDADD = $(TESTLDADD)
+test_html_parser_SOURCES = test_html_parser.cpp $(filter_src)
+test_filter_rewrite_SOURCES = test_filter_rewrite.cpp $(filter_src)
 
 # doxygen target
 dox:
diff --git a/src/ex_filter_frontend_net.cpp b/src/ex_filter_frontend_net.cpp
deleted file mode 100644 (file)
index f5c16ed..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/* This file is part of Metaproxy.
-   Copyright (C) 2005-2013 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
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#include "config.hpp"
-
-#include <cstdlib>
-#include <iostream>
-#include <stdexcept>
-
-#include <yaz/options.h>
-#include <metaproxy/util.hpp>
-#include "filter_frontend_net.hpp"
-#include "filter_z3950_client.hpp"
-#include "filter_virt_db.hpp"
-#include "filter_session_shared.hpp"
-#include "filter_log.hpp"
-
-#include "router_chain.hpp"
-#include <metaproxy/package.hpp>
-
-namespace mp = metaproxy_1;
-
-class HTTPFilter: public mp::filter::Base {
-public:
-    void process(mp::Package & package) const {
-        if (package.session().is_closed())
-        {
-            // std::cout << "Got Close.\n";
-        }
-
-        Z_GDU *gdu = package.request().get();
-        if (gdu && gdu->which == Z_GDU_HTTP_Request)
-        {
-            mp::odr odr;
-            Z_GDU *gdu = z_get_HTTP_Response(odr, 200);
-            Z_HTTP_Response *http_res = gdu->u.HTTP_Response;
-
-            z_HTTP_header_add(odr, &http_res->headers,
-                              "Content-Type", "text/plain");
-
-            http_res->content_buf =
-                odr_strdup(odr, "Welcome to Metaproxy");
-            http_res->content_len = strlen(http_res->content_buf);
-
-            package.response() = gdu;
-        }
-        return package.move();
-    };
-    void configure(const xmlNode * ptr, bool test_only,
-                   const char *path) { };
-};
-
-int main(int argc, char **argv)
-{
-    try
-    {
-        std::vector<std::string> ports;
-        int duration = -1;
-        int ret;
-        char *arg;
-
-        while ((ret = options("h{help}d{duration}:p{port}:",
-                              argv, argc, &arg)) != -2)
-        {
-            switch(ret)
-            {
-            case -1:
-                std::cerr << "bad option " << arg << std::endl;
-            case 'h':
-                std::cerr << "ex_filter_frontend_net\n"
-                    " -h|--help       help\n"
-                    " -d|--duration n duration\n"
-                    " -p|--port n     port number\n"
-                          << std::endl;
-                break;
-            case 'p':
-                ports.push_back(arg);
-                break;
-            case 'd':
-                duration = atoi(arg);
-                break;
-            }
-        }
-        {
-            for (size_t i = 0; i<ports.size(); i++)
-                std::cout << "port " << i << " " << ports[i] << "\n";
-
-           mp::RouterChain router;
-
-            // put frontend filter in router
-            mp::filter::FrontendNet filter_front;
-            filter_front.set_ports(ports);
-
-            // 0=no time, >0 timeout in seconds
-            if (duration != -1)
-                filter_front.set_listen_duration(duration);
-
-           router.append(filter_front);
-
-            // put log filter in router
-            mp::filter::Log filter_log_front("FRONT");
-            router.append(filter_log_front);
-
-            // put Virt db filter in router
-            mp::filter::VirtualDB filter_virt_db;
-            filter_virt_db.add_map_db2target("gils", "indexdata.dk/gils",
-                                            "");
-            filter_virt_db.add_map_db2target("Default", "localhost:9999/Default",
-                                            "");
-            filter_virt_db.add_map_db2target("2", "localhost:9999/Slow", "");
-           router.append(filter_virt_db);
-
-            mp::filter::SessionShared filter_session_shared;
-            //router.append(filter_session_shared);
-
-            mp::filter::Log filter_log_back("BACK");
-            router.append(filter_log_back);
-
-            // put HTTP backend filter in router
-            HTTPFilter filter_init;
-           router.append(filter_init);
-
-            // put Z39.50 backend filter in router
-            mp::filter::Z3950Client z3950_client;
-           router.append(z3950_client);
-
-            mp::Session session;
-            mp::Origin origin;
-           mp::Package pack(session, origin);
-
-           pack.router(router).move();
-        }
-    }
-    catch ( ... ) {
-        std::cerr << "unknown exception\n";
-        std::exit(1);
-    }
-    std::exit(0);
-}
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
diff --git a/src/ex_router_flexml.cpp b/src/ex_router_flexml.cpp
deleted file mode 100644 (file)
index 7916540..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/* This file is part of Metaproxy.
-   Copyright (C) 2005-2013 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
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#include "config.hpp"
-
-#include <yaz/options.h>
-
-#include <iostream>
-#include <stdexcept>
-
-#include <metaproxy/filter.hpp>
-#include <metaproxy/package.hpp>
-#include "router_flexml.hpp"
-#include "factory_static.hpp"
-
-namespace mp = metaproxy_1;
-
-int main(int argc, char **argv)
-{
-    try
-    {
-        int ret;
-        char *arg;
-        char *fname = 0;
-
-        while ((ret = options("h{help}c{config}:",
-                              argv, argc, &arg)) != -2)
-        {
-            switch(ret)
-            {
-            case -1:
-                std::cerr << "bad option " << arg << std::endl;
-            case 'h':
-                std::cerr << "ex_router_flexml\n"
-                    " -h|--help         help\n"
-                    " -c|--config fname configuation\n"
-                          << std::endl;
-                std::exit(1);
-            case 'c':
-                fname = arg;
-            }
-        }
-
-        xmlDocPtr doc = 0;
-        if (fname)
-        {
-            doc = xmlParseFile(fname);
-            if (!doc)
-            {
-                std::cerr << "xmlParseFile failed\n";
-                std::exit(1);
-            }
-        }
-        else
-        {
-            std::cerr << "No configuration given\n";
-            std::exit(1);
-        }
-        if (doc)
-        {
-            mp::FactoryStatic factory;
-            mp::RouterFleXML router(doc, factory, false, 0);
-
-           mp::Package pack;
-
-            pack.router(router).move();
-
-            xmlFreeDoc(doc);
-        }
-    }
-    catch ( ... ) {
-        std::cerr << "Unknown Exception" << std::endl;
-        throw;
-        std::exit(1);
-    }
-    std::exit(0);
-}
-
-
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
index 071a7d1..7ea6d3a 100644 (file)
@@ -118,20 +118,24 @@ bool mp::FactoryFilter::add_creator_dl(const std::string &fi,
     {
         return true;
     }
-
-    std::string full_path = path + "/metaproxy_filter_" + fi + ".so";
-    void *dl_handle = dlopen(full_path.c_str(), RTLD_GLOBAL|RTLD_NOW);
-    if (!dl_handle)
-    {
-        const char *dl = dlerror();
-        std::cout << "dlopen " << full_path << " failed. dlerror=" << dl <<
-            std::endl;
-        return false;
-    }
-
     std::string full_name = "metaproxy_1_filter_" + fi;
 
+    void *dl_handle = dlopen(0, RTLD_GLOBAL|RTLD_NOW);
     void *dlsym_ptr = dlsym(dl_handle, full_name.c_str());
+
+    if (!dlsym_ptr)
+    {
+        std::string full_path = path + "/metaproxy_filter_" + fi + ".so";
+        dl_handle = dlopen(full_path.c_str(), RTLD_GLOBAL|RTLD_NOW);
+        if (!dl_handle)
+        {
+            const char *dl = dlerror();
+            std::cout << "dlopen " << full_path << " failed. dlerror=" << dl <<
+                std::endl;
+            return false;
+        }
+        dlsym_ptr = dlsym(dl_handle, full_name.c_str());
+    }
     if (!dlsym_ptr)
     {
         std::cout << "dlsym " << full_name << " failed\n";
index f0ce36c..c3adc54 100644 (file)
@@ -42,8 +42,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "filter_load_balance.hpp"
 #include "filter_log.hpp"
 #include "filter_multi.hpp"
+#include "filter_present_chunk.hpp"
 #include "filter_query_rewrite.hpp"
 #include "filter_record_transform.hpp"
+#include "filter_sd_remove.hpp"
 #include "filter_session_shared.hpp"
 #include "filter_sort.hpp"
 #include "filter_sru_to_z3950.hpp"
@@ -58,6 +60,7 @@ namespace mp = metaproxy_1;
 
 mp::FactoryStatic::FactoryStatic()
 {
+#ifdef HAVE_DLFCN_H
     struct metaproxy_1_filter_struct *buildins[] = {
         &metaproxy_1_filter_auth_simple,
         &metaproxy_1_filter_backend_test,
@@ -74,8 +77,10 @@ mp::FactoryStatic::FactoryStatic()
         &metaproxy_1_filter_load_balance,
         &metaproxy_1_filter_log,
         &metaproxy_1_filter_multi,
+        &metaproxy_1_filter_present_chunk,
         &metaproxy_1_filter_query_rewrite,
         &metaproxy_1_filter_record_transform,
+        &metaproxy_1_filter_sd_remove,
         &metaproxy_1_filter_session_shared,
         &metaproxy_1_filter_sort,
         &metaproxy_1_filter_sru_to_z3950,
@@ -91,6 +96,8 @@ mp::FactoryStatic::FactoryStatic()
 
     for (i = 0; buildins[i]; i++)
         add_creator(buildins[i]->type, buildins[i]->creator);
+// WIN32
+#endif
 }
 
 
index 7703a97..74a1aa8 100644 (file)
@@ -92,6 +92,14 @@ void yf::HTTPClient::Rep::proxy(mp::Package &package)
         if (http_response)
         {
             res_gdu = o.create_HTTP_Response(package.session(), hreq, 200);
+            Z_HTTP_Header **hp = &http_response->headers;
+            while (*hp)
+            {
+                if (!yaz_matchstr((*hp)->name, "Transfer-Encoding"))
+                    *hp = (*hp)->next;
+                else
+                    hp = &(*hp)->next;
+            }
             res_gdu->u.HTTP_Response = http_response;
         }
         else
diff --git a/src/filter_present_chunk.cpp b/src/filter_present_chunk.cpp
new file mode 100644 (file)
index 0000000..c2dc859
--- /dev/null
@@ -0,0 +1,211 @@
+/* This file is part of Metaproxy.
+   Copyright (C) 2005-2013 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
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include "config.hpp"
+#include "filter_present_chunk.hpp"
+
+#include <time.h>
+#include <yaz/log.h>
+#include <yaz/copy_types.h>
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
+
+namespace mp = metaproxy_1;
+namespace yf = mp::filter;
+
+namespace metaproxy_1 {
+    namespace filter {
+        class PresentChunk::Impl {
+        public:
+            Impl();
+            ~Impl();
+            void process(metaproxy_1::Package & package);
+            void configure(const xmlNode * ptr);
+            void chunk_it(metaproxy_1::Package & package, Z_APDU *apdu);
+        private:
+            Odr_int chunk_number;
+        };
+    }
+}
+
+yf::PresentChunk::PresentChunk() : m_p(new Impl)
+{
+}
+
+yf::PresentChunk::~PresentChunk()
+{  // must have a destructor because of boost::scoped_ptr
+}
+
+void yf::PresentChunk::configure(const xmlNode *xmlnode, bool test_only,
+                          const char *path)
+{
+    m_p->configure(xmlnode);
+}
+
+void yf::PresentChunk::process(mp::Package &package) const
+{
+    m_p->process(package);
+}
+
+yf::PresentChunk::Impl::Impl() : chunk_number(0)
+{
+}
+
+yf::PresentChunk::Impl::~Impl()
+{
+}
+
+void yf::PresentChunk::Impl::configure(const xmlNode *ptr)
+{
+    for (ptr = ptr->children; ptr; ptr = ptr->next)
+    {
+        if (ptr->type != XML_ELEMENT_NODE)
+            continue;
+        if (!strcmp((const char *) ptr->name, "chunk"))
+        {
+            chunk_number = mp::xml::get_int(ptr, 0);
+        }
+        else
+        {
+            throw mp::filter::FilterException("Bad element "
+                                               + std::string((const char *)
+                                                             ptr->name));
+        }
+    }
+}
+
+void yf::PresentChunk::Impl::chunk_it(mp::Package &package,
+                                      Z_APDU *apdu)
+{
+    mp::odr odr;
+    Z_PresentRequest *pr = apdu->u.presentRequest;
+
+    Odr_int total = *pr->numberOfRecordsRequested;
+    Odr_int start = *pr->resultSetStartPoint;
+    Odr_int offset = 0;
+    Z_NamePlusRecordList *npl = (Z_NamePlusRecordList *)
+        odr_malloc(odr, sizeof(*npl));
+    npl->num_records = total;
+    npl->records = (Z_NamePlusRecord **)
+        odr_malloc(odr, sizeof(*npl->records) * total);
+    while (offset < total)
+    {
+        Odr_int left = total - offset;
+
+        Package pp(package.session(), package.origin());
+
+        *pr->numberOfRecordsRequested =
+            left > chunk_number ? chunk_number : left;
+
+        *pr->resultSetStartPoint = start + offset;
+
+        pp.copy_filter(package);
+        pp.request() = apdu;
+
+        pp.move();
+
+        if (pp.session().is_closed())
+        {
+            package.session().close();
+            return;
+        }
+        Z_GDU *gdu_res = pp.response().get();
+        if (gdu_res && gdu_res->which == Z_GDU_Z3950 &&
+            gdu_res->u.z3950->which == Z_APDU_presentResponse)
+        {
+            Z_PresentResponse *pres =
+                gdu_res->u.z3950->u.presentResponse;
+            if (pres->records &&
+                pres->records->which == Z_Records_DBOSD)
+            {
+                Z_NamePlusRecordList *nprl =
+                    pres->records->u.databaseOrSurDiagnostics;
+                int i;
+                for (i = 0; i < nprl->num_records; i++)
+                {
+                    ODR o = odr;
+                    npl->records[offset+i] = yaz_clone_z_NamePlusRecord(
+                        nprl->records[i], o->mem);
+                }
+                offset += nprl->num_records;
+            }
+            else
+            {
+                package.response() = pp.response();
+                return;
+            }
+        }
+        else
+        {
+            package.response() = pp.response();
+            return;
+        }
+    }
+
+    yaz_log(YLOG_LOG, "building response . %lld", offset);
+
+    Z_APDU *a = zget_APDU(odr, Z_APDU_presentResponse);
+    Z_PresentResponse *pres = a->u.presentResponse;
+    pres->records = (Z_Records *)
+        odr_malloc(odr, sizeof(Z_Records));
+    pres->records->which = Z_Records_DBOSD;
+    pres->records->u.databaseOrSurDiagnostics = npl;
+    npl->num_records = offset;
+    *pres->numberOfRecordsReturned = offset;
+
+    package.response() = a;
+}
+
+void yf::PresentChunk::Impl::process(mp::Package &package)
+{
+    Z_GDU *gdu = package.request().get();
+    if (gdu && gdu->which == Z_GDU_Z3950)
+    {
+        Z_APDU *apdu = gdu->u.z3950;
+        if (apdu->which == Z_APDU_presentRequest && chunk_number > 0)
+            chunk_it(package, apdu);
+        else
+            package.move();
+    }
+    else
+        package.move();
+}
+
+static mp::filter::Base* filter_creator()
+{
+    return new mp::filter::PresentChunk;
+}
+
+extern "C" {
+    struct metaproxy_1_filter_struct metaproxy_1_filter_present_chunk = {
+        0,
+        "present_chunk",
+        filter_creator
+    };
+}
+
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
diff --git a/src/filter_present_chunk.hpp b/src/filter_present_chunk.hpp
new file mode 100644 (file)
index 0000000..7a17b7c
--- /dev/null
@@ -0,0 +1,55 @@
+/* This file is part of Metaproxy.
+   Copyright (C) 2005-2013 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
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef FILTER_PRESENT_CHUNK_HPP
+#define FILTER_PRESENT_CHUNK_HPP
+
+#include <boost/scoped_ptr.hpp>
+
+#include <metaproxy/filter.hpp>
+
+namespace metaproxy_1 {
+    namespace filter {
+        class PresentChunk : public Base {
+            class Impl;
+            boost::scoped_ptr<Impl> m_p;
+        public:
+            PresentChunk();
+            ~PresentChunk();
+            void process(metaproxy_1::Package & package) const;
+            void configure(const xmlNode * ptr, bool test_only,
+                           const char *path);
+        };
+    }
+}
+
+extern "C" {
+    extern struct metaproxy_1_filter_struct metaproxy_1_filter_present_chunk;
+}
+
+#endif
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
diff --git a/src/filter_sd_remove.cpp b/src/filter_sd_remove.cpp
new file mode 100644 (file)
index 0000000..3755b05
--- /dev/null
@@ -0,0 +1,164 @@
+/* This file is part of Metaproxy.
+   Copyright (C) 2005-2013 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
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#include "config.hpp"
+#include "filter_sd_remove.hpp"
+#include <metaproxy/package.hpp>
+#include <metaproxy/util.hpp>
+#include <yaz/zgdu.h>
+#include <yaz/diagbib1.h>
+#include <metaproxy/filter.hpp>
+
+namespace metaproxy_1 {
+    namespace filter {
+        class SD_Remove : public Base {
+        public:
+            SD_Remove();
+            ~SD_Remove();
+            void process(metaproxy_1::Package & package) const;
+            void configure(const xmlNode * ptr, bool test_only,
+                           const char *path);
+        };
+    }
+}
+
+namespace mp = metaproxy_1;
+namespace yf = mp::filter;
+
+yf::SD_Remove::SD_Remove()
+{
+}
+
+yf::SD_Remove::~SD_Remove()
+{
+}
+
+void yf::SD_Remove::configure(const xmlNode *xmlnode, bool test_only,
+                             const char *path)
+{
+    if (xmlnode)
+    {
+        xmlNode *ptr;
+        for (ptr = xmlnode->children; ptr; ptr = ptr->next)
+        {
+            if (ptr->type == XML_ELEMENT_NODE)
+                throw mp::filter::FilterException("Bad element "
+                                                  + std::string((const char *)
+                                                                ptr->name));
+        }
+    }
+}
+
+static void diagrec_to_sutrs(WRBUF b, Z_DiagRec *diag)
+{
+    wrbuf_puts(b," ERROR ");
+    if (diag->which != Z_DiagRec_defaultFormat)
+        wrbuf_puts(b, "diag not in default format");
+    else
+    {
+        Z_DefaultDiagFormat *e = diag->u.defaultFormat;
+        wrbuf_printf(b, ODR_INT_PRINTF ": %s", *e->condition,
+                     diagbib1_str(*e->condition));
+        if (e->u.v2Addinfo && *e->u.v2Addinfo) // v3Addinfo is same data
+        {
+            wrbuf_puts(b, " -- ");
+            wrbuf_puts(b, e->u.v2Addinfo);
+        }
+    }
+    wrbuf_puts(b, "\n");
+}
+
+void yf::SD_Remove::process(mp::Package &package) const
+{
+    package.move();
+
+    Z_GDU *gdu_res = package.response().get();
+    if (gdu_res && gdu_res->which == Z_GDU_Z3950)
+    {
+        Z_NamePlusRecordList *records = 0;
+        Z_APDU *apdu = gdu_res->u.z3950;
+        if (apdu->which == Z_APDU_presentResponse)
+        {
+            Z_PresentResponse * pr_res = apdu->u.presentResponse;
+            if (pr_res->numberOfRecordsReturned
+                && *(pr_res->numberOfRecordsReturned) > 0
+                && pr_res->records
+                && pr_res->records->which == Z_Records_DBOSD)
+            {
+                records = pr_res->records->u.databaseOrSurDiagnostics;
+            }
+        }
+        if (apdu->which == Z_APDU_searchResponse)
+        {
+            Z_SearchResponse *sr_res = apdu->u.searchResponse;
+            if (
+                sr_res->numberOfRecordsReturned
+                && *(sr_res->numberOfRecordsReturned) > 0
+                && sr_res->records
+                && sr_res->records->which == Z_Records_DBOSD)
+            {
+                records = sr_res->records->u.databaseOrSurDiagnostics;
+            }
+        }
+        if (records)
+        {
+            mp::odr odr_en(ODR_ENCODE);
+            int i;
+            for (i = 0; i < records->num_records; i++)
+            {
+                Z_NamePlusRecord *npr = records->records[i];
+                if (npr->which == Z_NamePlusRecord_surrogateDiagnostic)
+                {
+                    WRBUF w = wrbuf_alloc();
+                    diagrec_to_sutrs(w, npr->u.surrogateDiagnostic);
+                    npr->which = Z_NamePlusRecord_databaseRecord;
+                    npr->u.databaseRecord = z_ext_record_sutrs(odr_en,
+                                                               wrbuf_buf(w),
+                                                               wrbuf_len(w));
+                    wrbuf_destroy(w);
+                }
+            }
+            package.response() = gdu_res;
+        }
+    }
+}
+
+
+static mp::filter::Base* filter_creator()
+{
+    return new mp::filter::SD_Remove;
+}
+
+extern "C" {
+    struct metaproxy_1_filter_struct metaproxy_1_filter_sd_remove = {
+        0,
+        "sd_remove",
+        filter_creator
+    };
+}
+
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
diff --git a/src/filter_sd_remove.hpp b/src/filter_sd_remove.hpp
new file mode 100644 (file)
index 0000000..21cd2b0
--- /dev/null
@@ -0,0 +1,35 @@
+/* This file is part of Metaproxy.
+   Copyright (C) 2005-2013 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
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+*/
+
+#ifndef FILTER_SD_REMOVE_HPP
+#define FILTER_SD_REMOVE_HPP
+
+extern "C" {
+    extern struct metaproxy_1_filter_struct metaproxy_1_filter_sd_remove;
+}
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
index 9a3da41..dd80405 100644 (file)
@@ -16,7 +16,7 @@ along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
 
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/filter.hpp>
 
 #include <list>
diff --git a/src/router_chain.hpp b/src/router_chain.hpp
deleted file mode 100644 (file)
index 2d83729..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/* This file is part of Metaproxy.
-   Copyright (C) 2005-2013 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
-Software Foundation; either version 2, or (at your option) any later
-version.
-
-Metaproxy is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-
-#ifndef ROUTER_CHAIN_HPP
-#define ROUTER_CHAIN_HPP
-
-
-#include <metaproxy/router.hpp>
-
-#include <boost/scoped_ptr.hpp>
-#include <stdexcept>
-
-namespace metaproxy_1 {
-    class RouterChain : public Router {
-        class Rep;
-        class Pos;
-    public:
-        RouterChain();
-        virtual ~RouterChain();
-        virtual RoutePos *createpos() const;
-        RouterChain & append(const filter::Base &filter);
-        void start();
-        void stop();
-    private:
-        boost::scoped_ptr<Rep> m_p;
-        /// disabled because class is singleton
-        RouterChain(const RouterChain &);
-
-        /// disabled because class is singleton
-        RouterChain& operator=(const RouterChain &);
-    };
-}
-
-#endif
-/*
- * Local variables:
- * c-basic-offset: 4
- * c-file-style: "Stroustrup"
- * indent-tabs-mode: nil
- * End:
- * vim: shiftwidth=4 tabstop=8 expandtab
- */
-
index b6f8e21..3f93001 100644 (file)
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <libxml/tree.h>
 
 #include <metaproxy/filter.hpp>
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #include <iostream>
index 938ad58..f66445e 100644 (file)
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "filter_auth_simple.hpp"
 #include <metaproxy/util.hpp>
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #define BOOST_AUTO_TEST_MAIN
index 24ab0be..76e4730 100644 (file)
@@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "filter_backend_test.hpp"
 #include "filter_log.hpp"
 
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #include <yaz/zgdu.h>
index 3b95cea..0748a55 100644 (file)
@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "filter_bounce.hpp"
 #include <metaproxy/util.hpp>
 #include "gduutil.hpp"
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #include <iostream>
index 50b6f37..49001d7 100644 (file)
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include <metaproxy/util.hpp>
 #include "filter_frontend_net.hpp"
 
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #define BOOST_AUTO_TEST_MAIN
index 0defe85..73f637a 100644 (file)
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "filter_log.hpp"
 #include <metaproxy/util.hpp>
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #define BOOST_AUTO_TEST_MAIN
index dc9cb39..a9eefbd 100644 (file)
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "filter_multi.hpp"
 #include <metaproxy/util.hpp>
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #define BOOST_AUTO_TEST_MAIN
index cbe3441..f9234a7 100644 (file)
@@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "filter_query_rewrite.hpp"
 #include <metaproxy/util.hpp>
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #define BOOST_AUTO_TEST_MAIN
index f12be7f..8f2ffa9 100644 (file)
@@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "config.hpp"
 #include "filter_record_transform.hpp"
 
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #define BOOST_AUTO_TEST_MAIN
index 430e784..d266274 100644 (file)
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "filter_http_client.hpp"
 #include "filter_http_rewrite.hpp"
 #include <metaproxy/util.hpp>
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #include <boost/regex.hpp>
index 56216bb..7ea132b 100644 (file)
@@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "filter_sru_to_z3950.hpp"
 #include <metaproxy/util.hpp>
 #include "sru_util.hpp"
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #include <iostream>
index f8e4a78..f8f66cc 100644 (file)
@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "filter_backend_test.hpp"
 #include "filter_log.hpp"
 
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #define BOOST_AUTO_TEST_MAIN
index 03c29c7..4f001ad 100644 (file)
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "filter_z3950_client.hpp"
 #include <metaproxy/util.hpp>
 
-#include "router_chain.hpp"
+#include <metaproxy/router_chain.hpp>
 #include <metaproxy/package.hpp>
 
 #define BOOST_AUTO_TEST_MAIN
index 2c0c58e..3f9575d 100644 (file)
@@ -7,7 +7,7 @@
 DEBUG=0   # 0 for release, 1 for debug
 
 # Metaproxy version
-VERSION=1.3.55
+VERSION=1.3.56
 
 # YAZ and YAZ++ directories
 YAZ_DIR=..\..\yaz
@@ -31,7 +31,7 @@ default: all
 
 all: dirs config yaz yazpp libxslt progs
 
-progs: metaproxy ex_filter_frontend_net # test_pipe does not work
+progs: metaproxy # test_pipe does not work
 NSIS="c:\program files\nsis\makensis.exe"
 
 nsis: all
@@ -62,12 +62,10 @@ TMP=$(TMPDIR)
 ############### Targets - what to make
 ###########################################################
 
-EX_FILTER_FRONTEND_NET=$(BINDIR)\ex_filter_frontend_net.exe
 METAPROXY_PROG=$(BINDIR)\metaproxy.exe
 TEST_PIPE=$(BINDIR)\test_pipe.exe
 
 # shortcut names defined here
-ex_filter_frontend_net: $(EX_FILTER_FRONTEND_NET)
 metaproxy: $(METAPROXY_PROG)
 test_pipe: $(TEST_PIPE)
 
@@ -221,13 +219,17 @@ PROJECT_DLL_OBJS = \
         $(OBJDIR)\filter_bounce.obj \
         $(OBJDIR)\filter_cql_to_rpn.obj \
        $(OBJDIR)\filter_frontend_net.obj \
+       $(OBJDIR)\filter_http_client.obj \
        $(OBJDIR)\filter_http_file.obj \
+       $(OBJDIR)\filter_http_rewrite1.obj \
         $(OBJDIR)\filter_limit.obj \
         $(OBJDIR)\filter_load_balance.obj \
         $(OBJDIR)\filter_log.obj \
        $(OBJDIR)\filter_multi.obj \
+       $(OBJDIR)\filter_present_chunk.obj \
        $(OBJDIR)\filter_query_rewrite.obj \
         $(OBJDIR)\filter_record_transform.obj \
+        $(OBJDIR)\filter_sd_remove.obj \
         $(OBJDIR)\filter_session_shared.obj \
         $(OBJDIR)\filter_sort.obj \
         $(OBJDIR)\filter_sru_to_z3950.obj \
@@ -251,7 +253,6 @@ PROJECT_DLL_OBJS = \
         $(OBJDIR)\util.obj \
         $(OBJDIR)\xmlutil.obj 
 
-EX_FILTER_FRONTEND_NET_OBJS = $(OBJDIR)\ex_filter_frontend_net.obj
 METAPROXY_OBJS = $(OBJDIR)\metaproxy_prog.obj
 TEST_PIPE_OBJS = $(OBJDIR)\test_pipe.obj
 
@@ -291,15 +292,6 @@ $(PROJECT_RES): $(PROJECT_RC)
 ############### Linking
 ###########################################################
 
-$(EX_FILTER_FRONTEND_NET) : "$(BINDIR)" $(EX_FILTER_FRONTEND_NET_OBJS) $(PROJECT_DLL_OBJS)
-       $(LINK) \
-               $(LNKOPT) \
-               $(PROG_LINK_OPTIONS) \
-               $(LINK_LIBS) \
-               $(PROJECT_DLL_OBJS) \
-               $(EX_FILTER_FRONTEND_NET_OBJS) \
-               /out:$(EX_FILTER_FRONTEND_NET) 
-
 $(METAPROXY_PROG) : "$(BINDIR)" $(METAPROXY_OBJS) $(PROJECT_DLL_OBJS)
        $(LINK) \
                $(LNKOPT) \
index 632b4a2..a605b48 100644 (file)
@@ -18,6 +18,7 @@ filter_log.rnc \
 filter_multi.rnc \
 filter_query_rewrite.rnc \
 filter_record_transform.rnc \
+filter_sd_remove.rnc \
 filter_session_shared.rnc \
 filter_sort.rnc \
 filter_sru_z3950.rnc \
diff --git a/xml/schema/filter_present_chunk.rnc b/xml/schema/filter_present_chunk.rnc
new file mode 100644 (file)
index 0000000..877d69e
--- /dev/null
@@ -0,0 +1,10 @@
+# Metaproxy XML config file schema
+
+namespace mp = "http://indexdata.com/metaproxy"
+
+filter_present_chunk =
+  attribute type { "present_chunk" },
+  attribute id { xsd:NCName }?,
+  attribute name { xsd:NCName }?,
+  element mp:chunk { xsd:integer }?
+
diff --git a/xml/schema/filter_sd_remove.rnc b/xml/schema/filter_sd_remove.rnc
new file mode 100644 (file)
index 0000000..00ff23f
--- /dev/null
@@ -0,0 +1,9 @@
+# Metaproxy XML config file schema
+
+namespace mp = "http://indexdata.com/metaproxy"
+
+filter_sd_remove =
+  attribute type { "sd_remove" },
+  attribute id { xsd:NCName }?,
+  attribute name { xsd:NCName }?
+
index 8063d89..1562fb2 100644 (file)
@@ -35,8 +35,10 @@ include "filter_limit.rnc"
 include "filter_load_balance.rnc"
 include "filter_log.rnc"
 include "filter_multi.rnc"
+include "filter_present_chunk.rnc"
 include "filter_query_rewrite.rnc"
 include "filter_record_transform.rnc"
+include "filter_sd_remove.rnc"
 include "filter_session_shared.rnc"
 include "filter_sort.rnc"
 include "filter_sru_z3950.rnc"
@@ -85,8 +87,10 @@ filter =
     | filter_load_balance
     | filter_log
     | filter_multi
+    | filter_present_chunk
     | filter_query_rewrite
     | filter_record_transform
+    | filter_sd_remove
     | filter_session_shared
     | filter_sort
     | filter_sru_z3950