document http_rewrite, present_chunk, sd_remove MP-468
authorAdam Dickmeiss <adam@indexdata.dk>
Fri, 15 Nov 2013 12:48:33 +0000 (13:48 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Fri, 15 Nov 2013 12:48:33 +0000 (13:48 +0100)
doc/Makefile.am
doc/http_rewrite.xml [new file with mode: 0644]
doc/present_chunk.xml [new file with mode: 0644]
doc/sd_remove.xml [new file with mode: 0644]

index 5cf88df..282122d 100644 (file)
@@ -2,7 +2,7 @@ SUBDIRS = common
 
 INKSCAPE=inkscape
 
-SUFFIXES=.3mp .1 .pdf .tkl .esp .xml 
+SUFFIXES=.3mp .1 .pdf .tkl .esp .xml
 
 XMLFILES = book.xml manref.xml copyright.xml gpl-2.0.xml local.ent
 
@@ -18,20 +18,23 @@ XMLMAN = metaproxy.xml \
        frontend_net.xml \
        http_client.xml \
        http_file.xml \
+       http_rewrite.xml \
        limit.xml \
        load_balance.xml \
        log.xml \
        multi.xml \
+       present_chunk.xml \
        query_rewrite.xml \
-        record_transform.xml\
+       record_transform.xml\
+       sd_remove.xml \
        session_shared.xml \
        sort.xml \
         sru_z3950.xml\
        template.xml \
        virt_db.xml \
        z3950_client.xml \
-       zoom.xml \
-        zeerex_explain.xml
+        zeerex_explain.xml \
+       zoom.xml
 
 MANFILES = metaproxy.1 \
        metaproxy-config.1 \
@@ -43,11 +46,15 @@ MANFILES = metaproxy.1 \
         frontend_net.3mp \
        http_client.3mp \
        http_file.3mp \
+       http_rewrite.3mp \
        limit.3mp \
        load_balance.3mp \
        log.3mp \
-       multi.3mp query_rewrite.3mp \
-        record_transform.3mp\
+       multi.3mp
+       present_chunk.3mp \
+       query_rewrite.3mp \
+        record_transform.3mp \
+       sd_remove.3mp \
        session_shared.3mp \
        sort.3mp \
         sru_z3950.3mp \
@@ -55,11 +62,11 @@ MANFILES = metaproxy.1 \
        virt_db.3mp \
        z3950_client.3mp \
        zeerex_explain.3mp \
-       zoom.3mp 
+       zoom.3mp
 
 HTMLFILES = index.html
 
-# testing if this does the job of collecting up the unnamed '*.html' files 
+# testing if this does the job of collecting up the unnamed '*.html' files
 #UNLISTEDHTML = $(wildcard *.html)
 
 PNGFILES = multi.png
@@ -67,7 +74,7 @@ PNGFILES = multi.png
 doc_DATA = $(HTMLFILES) $(PNGFILES)
 man_MANS = $(MANFILES)
 
-EXTRA_DIST = $(XMLFILES) $(XMLMAN) $(doc_DATA) $(man_MANS) multi.svg 
+EXTRA_DIST = $(XMLFILES) $(XMLMAN) $(doc_DATA) $(man_MANS) multi.svg
 
 $(MANFILES): local.ent
 
diff --git a/doc/http_rewrite.xml b/doc/http_rewrite.xml
new file mode 100644 (file)
index 0000000..dbbcfc6
--- /dev/null
@@ -0,0 +1,133 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
+    "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+ <!ENTITY copyright SYSTEM "copyright.xml">
+ <!ENTITY % idcommon SYSTEM "common/common.ent">
+     %idcommon;
+]>
+<refentry id="ref-http_rewrite">
+ <refmeta>
+  <refentrytitle>http_rewrite</refentrytitle>
+  <manvolnum>3mp</manvolnum>
+  <refmiscinfo>Metaproxy Module</refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+  <refname>http_rewrite</refname>
+  <refpurpose>Module for rewriting HTTP content and headers</refpurpose>
+ </refnamediv>
+
+ <refsect1><title>DESCRIPTION</title>
+  <para>
+   The primary purpose of this module is to rewrite links (URLs) for
+   proxying. The configuration is divided in two sections:
+   request and response for dealing with the HTTP request and response
+   respectively.
+  </para>
+  <para>
+   Each section consists of rule and content elements. Each rule must be
+   given a name (attribute "name") and these are referred to from
+   content elements. The content defines what rules are invoked.
+  </para>
+  <para>
+   Each rule consists of one or more rewrite elements. The rewrite
+   specifies a regular expression for matching content in the attribute
+   "from" and the corresponding attribute "from" specifies the result.
+   The "to" result may refer to named groups in any "from" pattern already
+   executed. For example, in the response section a rule may refer to both
+   groups in the response already executed and all rules exectuted in the
+   request section.
+  </para>
+  <para>
+   Each content section takes exactly one "type" attribute, which specifies
+   what area is inspected for rewriting. Type may be one of
+   "html" (for HTML content), "headers" for HTTP headers or
+   "quoted-literal" for Java Script type of content.
+   The content section takes one or more "within" elements. That specifies
+   where inside the content, each rule is being exectuted. All within
+   must have a "rule" attribtue that specifies the rule section to be
+   invoked (rule@name as mentioned earlier).
+  </para>
+  <para>
+   For "html" content, the within element takes also attributes "tag"
+   and "attr",that specifies tag and attributes to be inspected.
+   The attr attributes takes one or more attributes (comma separated).
+   If no "tag" is given, the rule is performed on all attributes
+   with the name given.
+  </para>
+  <para>
+   For "headers" content the within element takes "header" or "reqline" +
+   the "rule" attribute. For "header", the rule is performed on all
+   HTTP headers with the name in header. For "reqline", the
+   HTTP Request line is rewritten.
+  </para>
+  <para>
+   For "quoted-literal" content, the within element takes only a
+   "rule" attribute and the rule is performed on all content.
+  </para>
+ </refsect1>
+
+ <refsect1><title>SCHEMA</title>
+   <literallayout><xi:include
+                    xi:href="../xml/schema/filter_http_rewrite.rnc"
+                    xi:parse="text"
+                    xmlns:xi="http://www.w3.org/2001/XInclude" />
+   </literallayout>
+ </refsect1>
+
+ <refsect1><title>EXAMPLES</title>
+  <para>
+   Configuration:
+   <screen><![CDATA[
+   <filter type="http_rewrite">
+     <request>
+       <!-- save pxhost and pxpath for later -->
+       <rule name="url">
+         <rewrite
+            from='(?&lt;proto>https?://)(?&lt;pxhost>[^ /?#]+)/(?&lt;pxpath>[^ /]+)/(?&lt;host>[^ /]+)(?&lt;path>[^ ]*)'
+            to='${proto}${host}${path}' />
+         <rewrite from='(?:Host: )(.*)' to='Host: ${host}' />
+       </rule>
+       <content type="headers">
+         <within reqline="1" rule="url"/>
+       </content>
+     </request>
+     <response>
+       <!-- rewrite "back" - using pxhost and pxpath -->
+       <rule name="url">
+         <rewrite
+           from='(?&lt;proto>https?://)(?&lt;host>[^/?# &quot;&apos;>]+)/(?&lt;path>[^  &quot;&apos;>]+)'
+           to='${proto}${pxhost}/${pxpath}/${host}/${path}' />
+       </rule>
+       <content type="headers"
+         <within header="link" rule="url"/>
+       </content>
+       <content type="html">
+         <within tag="script" attr="#text" type="quoted-literal" rule="url"/>
+         <within attr="href,src" rule="url"/>
+         <within attr="onclick" type="quoted-literal" rule="url"/>
+       </content>
+     </response>
+   </filter>
+]]>
+   </screen>
+  </para>
+ </refsect1>
+
+ <refsect1><title>SEE ALSO</title>
+  <para>
+   <citerefentry>
+    <refentrytitle>metaproxy</refentrytitle>
+    <manvolnum>1</manvolnum>
+   </citerefentry>
+  </para>
+ </refsect1>
+
+ &copyright;
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: nxml
+nxml-child-indent: 1
+End:
+-->
diff --git a/doc/present_chunk.xml b/doc/present_chunk.xml
new file mode 100644 (file)
index 0000000..b57332d
--- /dev/null
@@ -0,0 +1,66 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
+    "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+ <!ENTITY copyright SYSTEM "copyright.xml">
+ <!ENTITY % idcommon SYSTEM "common/common.ent">
+     %idcommon;
+]>
+<refentry id="ref-present_chunk">
+ <refmeta>
+  <refentrytitle>present_chunk</refentrytitle>
+  <manvolnum>3mp</manvolnum>
+  <refmiscinfo>Metaproxy Module</refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+  <refname>present_chunk</refname>
+  <refpurpose>Splits Z39.50 Present Request into chunks</refpurpose>
+ </refnamediv>
+
+ <refsect1><title>DESCRIPTION</title>
+  <para>
+   This module converts a present requests to one or more present
+   requests (chunks). Some Z39.50 server software may crash or large
+   present requests (number of records requested).
+   This module tries to fix that. It takes a "chunk" element in
+   configuration that specifies the maximum number of records to fetch
+   in each chunk.
+  </para>
+ </refsect1>
+
+ <refsect1><title>SCHEMA</title>
+   <literallayout><xi:include
+                    xi:href="../xml/schema/filter_present_chunk.rnc"
+                    xi:parse="text"
+                    xmlns:xi="http://www.w3.org/2001/XInclude" />
+   </literallayout>
+ </refsect1>
+
+ <refsect1><title>EXAMPLES</title>
+  <para>
+   Configuration:
+   <screen><![CDATA[
+    <filter type="present_chunk">
+    </filter>
+]]>
+   </screen>
+  </para>
+ </refsect1>
+
+ <refsect1><title>SEE ALSO</title>
+  <para>
+   <citerefentry>
+    <refentrytitle>metaproxy</refentrytitle>
+    <manvolnum>1</manvolnum>
+   </citerefentry>
+  </para>
+ </refsect1>
+
+ &copyright;
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: nxml
+nxml-child-indent: 1
+End:
+-->
diff --git a/doc/sd_remove.xml b/doc/sd_remove.xml
new file mode 100644 (file)
index 0000000..b44b848
--- /dev/null
@@ -0,0 +1,64 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
+    "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+ <!ENTITY copyright SYSTEM "copyright.xml">
+ <!ENTITY % idcommon SYSTEM "common/common.ent">
+     %idcommon;
+]>
+<refentry id="ref-sd_remove">
+ <refmeta>
+  <refentrytitle>sd_remove</refentrytitle>
+  <manvolnum>3mp</manvolnum>
+  <refmiscinfo>Metaproxy Module</refmiscinfo>
+ </refmeta>
+
+ <refnamediv>
+  <refname>sd_remove</refname>
+  <refpurpose>Removes Surrogate Diagnostics</refpurpose>
+ </refnamediv>
+
+ <refsect1><title>DESCRIPTION</title>
+  <para>
+   This filter removes surrogate-diagnostics from Z39.50 records. It
+   replaces the surrogate diagnostics records with SUTRS records. This
+   module has no general use. It was only implemented to avoid a particualr
+   Z39.50 from crashing.
+  </para>
+ </refsect1>
+
+ <refsect1><title>SCHEMA</title>
+   <literallayout><xi:include
+                    xi:href="../xml/schema/filter_sd_remove.rnc"
+                    xi:parse="text"
+                    xmlns:xi="http://www.w3.org/2001/XInclude" />
+   </literallayout>
+ </refsect1>
+
+ <refsect1><title>EXAMPLES</title>
+  <para>
+   Configuration:
+   <screen><![CDATA[
+    <filter type="sd_remove">
+    </filter>
+]]>
+   </screen>
+  </para>
+ </refsect1>
+
+ <refsect1><title>SEE ALSO</title>
+  <para>
+   <citerefentry>
+    <refentrytitle>metaproxy</refentrytitle>
+    <manvolnum>1</manvolnum>
+   </citerefentry>
+  </para>
+ </refsect1>
+
+ &copyright;
+</refentry>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: nxml
+nxml-child-indent: 1
+End:
+-->