Rebuild docs
[privoxy.git] / doc / webserver / user-manual / filter-file.html
index f07dbd3..1d37d8e 100644 (file)
@@ -4,18 +4,18 @@
 <head>
   <title>Filter Files</title>
   <meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.79">
-  <link rel="HOME" title="Privoxy 3.0.27 User Manual" href="index.html">
+  <link rel="HOME" title="Privoxy 3.0.34 User Manual" href="index.html">
   <link rel="PREVIOUS" title="Actions Files" href="actions-file.html">
   <link rel="NEXT" title="Privoxy's Template Files" href="templates.html">
   <link rel="STYLESHEET" type="text/css" href="../p_doc.css">
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <link rel="STYLESHEET" type="text/css" href="p_doc.css">
 </head>
 <body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink="#840084" alink="#0000FF">
   <div class="NAVHEADER">
     <table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
       <tr>
-        <th colspan="3" align="center">Privoxy 3.0.27 User Manual</th>
+        <th colspan="3" align="center">Privoxy 3.0.34 User Manual</th>
       </tr>
       <tr>
         <td width="10%" align="left" valign="bottom"><a href="actions-file.html" accesskey="P">Prev</a></td>
     <h1 class="SECT1"><a name="FILTER-FILE" id="FILTER-FILE">9. Filter Files</a></h1>
     <p>On-the-fly text substitutions need to be defined in a <span class="QUOTE">"filter file"</span>. Once defined,
     they can then be invoked as an <span class="QUOTE">"action"</span>.</p>
-    <p><span class="APPLICATION">Privoxy</span> supports three different pcrs-based filter actions: <tt class=
+    <p><span class="APPLICATION">Privoxy</span> supports four different pcrs-based filter actions: <tt class=
     "LITERAL"><a href="actions-file.html#FILTER">filter</a></tt> to rewrite the content that is send to the client,
     <tt class="LITERAL"><a href="actions-file.html#CLIENT-HEADER-FILTER">client-header-filter</a></tt> to rewrite
-    headers that are send by the client, and <tt class="LITERAL"><a href=
+    headers that are send by the client, <tt class="LITERAL"><a href=
     "actions-file.html#SERVER-HEADER-FILTER">server-header-filter</a></tt> to rewrite headers that are send by the
-    server.</p>
-    <p><span class="APPLICATION">Privoxy</span> also supports two tagger actions: <tt class="LITERAL"><a href=
-    "actions-file.html#CLIENT-HEADER-TAGGER">client-header-tagger</a></tt> and <tt class="LITERAL"><a href=
+    server, and <tt class="LITERAL"><a href="actions-file.html#CLIENT-BODY-FILTER">client-body-filter</a></tt> to
+    rewrite client request body.</p>
+    <p><span class="APPLICATION">Privoxy</span> also supports three tagger actions: <tt class="LITERAL"><a href=
+    "actions-file.html#CLIENT-HEADER-TAGGER">client-header-tagger</a></tt>, <tt class="LITERAL"><a href=
+    "actions-file.html#CLIENT-BODY-TAGGER">client-body-tagger</a></tt> and <tt class="LITERAL"><a href=
     "actions-file.html#SERVER-HEADER-TAGGER">server-header-tagger</a></tt>. Taggers and filters use the same syntax in
     the filter files, the difference is that taggers don't modify the text they are filtering, but use a rewritten
     version of the filtered text as tag. The tags can then be used to change the applying actions through sections with
@@ -59,9 +61,9 @@
     <p>Just like the <a href="actions-file.html">actions files</a>, the filter file is organized in sections, which are
     called <span class="emphasis"><i class="EMPHASIS">filters</i></span> here. Each filter consists of a heading line,
     that starts with one of the <span class="emphasis"><i class="EMPHASIS">keywords</i></span> <tt class=
-    "LITERAL">FILTER:</tt>, <tt class="LITERAL">CLIENT-HEADER-FILTER:</tt> or <tt class=
-    "LITERAL">SERVER-HEADER-FILTER:</tt> followed by the filter's <span class="emphasis"><i class=
-    "EMPHASIS">name</i></span>, and a short (one line) <span class="emphasis"><i class=
+    "LITERAL">FILTER:</tt>, <tt class="LITERAL">CLIENT-HEADER-FILTER:</tt>, <tt class=
+    "LITERAL">SERVER-HEADER-FILTER:</tt> or <tt class="LITERAL">CLIENT-BODY-FILTER:</tt> followed by the filter's
+    <span class="emphasis"><i class="EMPHASIS">name</i></span>, and a short (one line) <span class="emphasis"><i class=
     "EMPHASIS">description</i></span> of what it does. Below that line come the <span class="emphasis"><i class=
     "EMPHASIS">jobs</i></span>, i.e. lines that define the actual text substitutions. By convention, the name of a
     filter should describe what the filter <span class="emphasis"><i class="EMPHASIS">eliminates</i></span>. The
@@ -76,7 +78,7 @@
     <table border="0" bgcolor="#E0E0E0" width="100%">
       <tr>
         <td>
-          <pre class="SCREEN">FILTER: foo Replace all "foo" with "bar"</pre>
+          <pre class="SCREEN">  FILTER: foo Replace all "foo" with "bar"</pre>
         </td>
       </tr>
     </table>
     <p>Note that '$' is a bad choice for a delimiter in a dynamic filter as you might end up with unintended variables
     if you use a variable name directly after the delimiter. Variables will be resolved without escaping anything,
     therefore you also have to be careful not to chose delimiters that appear in the replacement text. For example
-    '&lt;' should be save, while '?' will sooner or later cause conflicts with $url.</p>
+    '&#60;' should be save, while '?' will sooner or later cause conflicts with $url.</p>
     <p>The non-standard option letter <tt class="LITERAL">T</tt> (trivial) prevents parsing for backreferences in the
-    substitute. Use it if you want to include text like '$&amp;' in your substitute without quoting.</p>
-    <p>If you are new to <a href="http://en.wikipedia.org/wiki/Regular_expressions" target="_top"><span class=
+    substitute. Use it if you want to include text like '$&#38;' in your substitute without quoting.</p>
+    <p>If you are new to <a href="https://en.wikipedia.org/wiki/Regular_expressions" target="_top"><span class=
     "QUOTE">"Regular Expressions"</span></a>, you might want to take a look at the <a href=
     "appendix.html#REGEX">Appendix on regular expressions</a>, and see the <a href=
     "http://perldoc.perl.org/perlre.html" target="_top">Perl manual</a> for <a href=
       <table border="0" bgcolor="#E0E0E0" width="100%">
         <tr>
           <td>
-            <pre class="SCREEN">s/foo/bar/</pre>
+            <pre class="SCREEN">  s/foo/bar/</pre>
           </td>
         </tr>
       </table>
       <table border="0" bgcolor="#E0E0E0" width="100%">
         <tr>
           <td>
-            <pre class="SCREEN">s/foo/bar/g</pre>
+            <pre class="SCREEN">  s/foo/bar/g</pre>
           </td>
         </tr>
       </table>
       <table border="0" bgcolor="#E0E0E0" width="100%">
         <tr>
           <td>
-            <pre class="SCREEN">FILTER: foo Replace all "foo" with "bar"
-s/foo/bar/g</pre>
+            <pre class="SCREEN">  FILTER: foo Replace all "foo" with "bar"
+  s/foo/bar/g</pre>
           </td>
         </tr>
       </table>
@@ -140,11 +142,11 @@ s/foo/bar/g</pre>
       <table border="0" bgcolor="#E0E0E0" width="100%">
         <tr>
           <td>
-            <pre class="SCREEN">FILTER: js-annoyances Get rid of particularly annoying JavaScript abuse
+            <pre class="SCREEN">  FILTER: js-annoyances Get rid of particularly annoying JavaScript abuse
 
-# Get rid of JavaScript referrer tracking. Test page: http://www.randomoddness.com/untitled.htm
-#
-s|(&lt;script.*)document\.referrer(.*&lt;/script&gt;)|$1"Not Your Business!"$2|Usg</pre>
+  # Get rid of JavaScript referrer tracking. Test page: http://www.randomoddness.com/untitled.htm
+  #
+  s|(&lt;script.*)document\.referrer(.*&lt;/script&gt;)|$1"Not Your Business!"$2|Usg</pre>
           </td>
         </tr>
       </table>
@@ -197,9 +199,9 @@ s|(&lt;script.*)document\.referrer(.*&lt;/script&gt;)|$1"Not Your Business!"$2|U
       <table border="0" bgcolor="#E0E0E0" width="100%">
         <tr>
           <td>
-            <pre class="SCREEN"># The status bar is for displaying link targets, not pointless blahblah
-#
-s/window\.status\s*=\s*(['"]).*?\1/dUmMy=1/ig</pre>
+            <pre class="SCREEN">  # The status bar is for displaying link targets, not pointless blahblah
+  #
+  s/window\.status\s*=\s*(['"]).*?\1/dUmMy=1/ig</pre>
           </td>
         </tr>
       </table>
@@ -219,9 +221,9 @@ s/window\.status\s*=\s*(['"]).*?\1/dUmMy=1/ig</pre>
       <table border="0" bgcolor="#E0E0E0" width="100%">
         <tr>
           <td>
-            <pre class="SCREEN"># Kill OnUnload popups. Yummy. Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
-#
-s/(&lt;body [^&gt;]*)onunload(.*&gt;)/$1never$2/iU</pre>
+            <pre class="SCREEN">  # Kill OnUnload popups. Yummy. Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
+  #
+  s/(&lt;body [^&gt;]*)onunload(.*&gt;)/$1never$2/iU</pre>
           </td>
         </tr>
       </table>
@@ -239,11 +241,11 @@ s/(&lt;body [^&gt;]*)onunload(.*&gt;)/$1never$2/iU</pre>
       <table border="0" bgcolor="#E0E0E0" width="100%">
         <tr>
           <td>
-            <pre class="SCREEN">FILTER: fun Fun text replacements
+            <pre class="SCREEN">  FILTER: fun Fun text replacements
 
-# Spice the daily news:
-#
-s/microsoft(?!\.com)/MicroSuck/ig</pre>
+  # Spice the daily news:
+  #
+  s/microsoft(?!\.com)/MicroSuck/ig</pre>
           </td>
         </tr>
       </table>
@@ -254,20 +256,20 @@ s/microsoft(?!\.com)/MicroSuck/ig</pre>
       <table border="0" bgcolor="#E0E0E0" width="100%">
         <tr>
           <td>
-            <pre class="SCREEN"># Buzzword Bingo (example for extended regex syntax)
-#
-s* industry[ -]leading \
-|  cutting[ -]edge \
-|  customer[ -]focused \
-|  market[ -]driven \
-|  award[ -]winning # Comments are OK, too! \
-|  high[ -]performance \
-|  solutions[ -]based \
-|  unmatched \
-|  unparalleled \
-|  unrivalled \
-*&lt;font color="red"&gt;&lt;b&gt;BINGO!&lt;/b&gt;&lt;/font&gt; \
-*igx</pre>
+            <pre class="SCREEN">  # Buzzword Bingo (example for extended regex syntax)
+  #
+  s* industry[ -]leading \
+  |  cutting[ -]edge \
+  |  customer[ -]focused \
+  |  market[ -]driven \
+  |  award[ -]winning # Comments are OK, too! \
+  |  high[ -]performance \
+  |  solutions[ -]based \
+  |  unmatched \
+  |  unparalleled \
+  |  unrivalled \
+  *&lt;font color="red"&gt;&lt;b&gt;BINGO!&lt;/b&gt;&lt;/font&gt; \
+  *igx</pre>
           </td>
         </tr>
       </table>
@@ -527,29 +529,30 @@ s* industry[ -]leading \
       <table border="0" bgcolor="#E0E0E0" width="100%">
         <tr>
           <td>
-            <pre class="SCREEN">EXTERNAL-FILTER: cat Pointless example filter that doesn't actually modify the content
-/bin/cat
+            <pre class=
+            "SCREEN">  EXTERNAL-FILTER: cat Pointless example filter that doesn't actually modify the content
+  /bin/cat
 
-# Incorrect reimplementation of the filter above in POSIX shell.
-#
-# Note that it's a single job that spans multiple lines, the line
-# breaks are not passed to the shell, thus the semicolons are required.
-#
-# If the script isn't trivial, it is recommended to put it into an external file.
-#
-# In general, writing external filters entirely in POSIX shell is not
-# considered a good idea.
-EXTERNAL-FILTER: cat2 Pointless example filter that despite its name may actually modify the content
-while read line; \
-do \
-  echo "$line"; \
-done
+  # Incorrect reimplementation of the filter above in POSIX shell.
+  #
+  # Note that it's a single job that spans multiple lines, the line
+  # breaks are not passed to the shell, thus the semicolons are required.
+  #
+  # If the script isn't trivial, it is recommended to put it into an external file.
+  #
+  # In general, writing external filters entirely in POSIX shell is not
+  # considered a good idea.
+  EXTERNAL-FILTER: cat2 Pointless example filter that despite its name may actually modify the content
+  while read line; \
+  do \
+    echo "$line"; \
+  done
 
-EXTERNAL-FILTER: rotate-image Rotate an image by 180 degree. Test filter with limited value.
-/usr/local/bin/convert - -rotate 180 -
+  EXTERNAL-FILTER: rotate-image Rotate an image by 180 degree. Test filter with limited value.
+  /usr/local/bin/convert - -rotate 180 -
 
-EXTERNAL-FILTER: citation-needed Adds a "[citation needed]" tag to an image. The coordinates may need adjustment.
-/usr/local/bin/convert - -pointsize 16 -fill white  -annotate +17+418 "[citation needed]" -</pre>
+  EXTERNAL-FILTER: citation-needed Adds a "[citation needed]" tag to an image. The coordinates may need adjustment.
+  /usr/local/bin/convert - -pointsize 16 -fill white  -annotate +17+418 "[citation needed]" -</pre>
           </td>
         </tr>
       </table>