more structure in starting section
[privoxy.git] / doc / source / user-manual.sgml
1 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
2 <!entity % dummy "IGNORE"> 
3 <!entity supported SYSTEM "supported.sgml">
4 <!entity newfeatures SYSTEM "newfeatures.sgml">
5 <!entity p-intro SYSTEM "privoxy.sgml">
6 <!entity seealso SYSTEM "seealso.sgml">
7 <!entity buildsource SYSTEM "buildsource.sgml">
8 <!entity contacting SYSTEM "contacting.sgml">
9 <!entity history SYSTEM "history.sgml">
10 <!entity copyright SYSTEM "copyright.sgml">
11 <!entity p-version "2.9.14">
12 <!entity p-status "beta">
13 <!entity % p-not-stable "INCLUDE">
14 <!entity % p-stable "IGNORE">
15 <!entity % p-text "IGNORE">        <!-- define we are not a text only doc -->
16 <!entity % p-doc "INCLUDE">        <!-- and we are a formal doc           -->
17 <!entity % p-readme "IGNORE">
18 <!entity % p-config "IGNORE">
19 <!entity % p-supp-userman "IGNORE"> <!-- Omit some from supported.sgml    -->
20 ]>
21 <!--
22  File        :  $Source: /cvsroot/ijbswa/current/doc/source/user-manual.sgml,v $
23
24  Purpose     :  user manual
25                 This file belongs into
26                 ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
27                 
28  $Id: user-manual.sgml,v 1.98 2002/04/28 05:43:59 hal9 Exp $
29
30  Written by and Copyright (C) 2001 the SourceForge
31  Privoxy team. http://www.privoxy.org/
32
33  Based on the Internet Junkbuster originally written
34  by and Copyright (C) 1997 Anonymous Coders and 
35  Junkbusters Corporation.  http://www.junkbusters.com
36
37
38  ========================================================================
39  NOTE: Please read developer-manual/documentation.html before touching 
40  anything in this, or other Privoxy documentation.
41  ========================================================================
42
43 -->
44
45 <article id="index">
46 <artheader>
47 <title>Privoxy User Manual</title>
48
49 <pubdate>$Id: user-manual.sgml,v 1.98 2002/04/28 05:43:59 hal9 Exp $</pubdate>
50
51 <authorgroup>
52  <author>
53   <affiliation>
54    <orgname>By: Privoxy Developers</orgname>
55    </affiliation>
56  </author>
57 </authorgroup>
58
59 <abstract>
60 <![%dummy;[
61  <para>
62  <comment>
63   This is here to keep vim syntax file from breaking :/
64   If I knew enough to fix it, I would.
65   PLEASE DO NOT REMOVE! HB: hal@foobox.net
66  </comment>
67  </para>
68 ]]>
69
70  <para>
71   The user manual gives users information on how to install, configure and use
72   <ulink
73   url="http://www.privoxy.org/"><application>Privoxy</application></ulink>.
74   </para>
75
76 <!-- Include privoxy.sgml boilerplate: -->
77  &p-intro;
78 <!-- end privoxy.sgml -->
79
80  <para>
81   You can find the latest version of the user manual at  <ulink
82   url="http://www.privoxy.org/user-manual/">http://www.privoxy.org/user-manual/</ulink>.
83   Please see the <ulink url="contact.html">Contact section</ulink> on how to
84   contact the developers.
85   </para>
86
87 <!--   <para> -->
88 <!--    Feel free to send a note to the developers at <email>ijbswa-developers@lists.sourceforge.net</email>. -->
89 <!--   </para> -->
90 </abstract>
91
92 </artheader>
93
94 <!--   ~~~~~       New section      ~~~~~     -->
95 <sect1 id="intro" label=""><title></title>
96 <!-- dummy section to force TOC on page by itself -->
97 <!-- DO NOT REMOVE! please ;) -->
98 <para> </para>
99 </sect1>
100
101 <!--   ~~~~~       New section      ~~~~~     -->
102 <sect1 label="1" id="introduction"><title>Introduction</title>
103 <para>
104  This documentation is included with the current &p-status; version of
105  <application>Privoxy</application>, v.&p-version;<![%p-not-stable;[, 
106  and is mostly complete at this point. The most up to date reference for the
107  time being is still the comments in the source files and in the individual
108  configuration files. Development of version 3.0 is currently nearing
109  completion, and includes many significant changes and enhancements over
110  earlier versions. The target release date for
111  stable v3.0 is <quote>soon</quote> ;-)]]>.
112 </para>
113
114 <!-- include only in non-stable versions -->
115 <![%p-not-stable;[
116 <para>
117  Since this is a &p-status; version, not all new features are well tested. This
118  documentation may be slightly out of sync as a result (especially with 
119  CVS sources). And there <emphasis>may be</emphasis> bugs, though hopefully
120  not many! 
121 </para>
122 ]]>
123
124 <!--   ~~~~~       New section      ~~~~~     -->
125 <sect2 id="features"><title>Features</title>
126 <para>
127  In addition to <application>Internet Junkbuster's</application> traditional
128  features of ad and banner blocking and cookie management,
129  <application>Privoxy</application> provides new features<![%p-not-stable;[,
130  some of them currently under development]]>:
131 </para>
132 <!-- Include newfeatures.sgml boilerplate here: -->
133  &newfeatures;
134 <!-- end boilerplate -->
135 </sect2>
136
137 </sect1>
138
139 <!--  ~  End section  ~  -->
140
141
142 <!--   ~~~~~       New section      ~~~~~     -->
143 <sect1 id="installation"><title>Installation</title>
144
145 <para>
146  <application>Privoxy</application> is available both in convenient pre-compiled
147  packages for a wide range of operating systems, and as raw source code.
148  For most users, we recommend using the packages, which can be downloaded from our
149  <ulink url="http://sourceforge.net/projects/ijbswa/">Privoxy Project
150  Page</ulink>. For installing and compiling the source code, please look 
151  into our Developer Manual.
152 </para>
153
154 <para>
155  If you like to live on the bleeding edge and are not afraid of using
156  possibly unstable development versions, you can check out the up-to-the-minute
157  version directly from <ulink url="http://sourceforge.net/cvs/?group_id=11118">the
158  CVS repository</ulink> or simply download <ulink
159  url="http://cvs.sourceforge.net/cvstarballs/ijbswa-cvsroot.tar.gz">the nightly CVS
160  tarball.</ulink> Again, we refer you to the Developer Manual.
161 </para>
162
163 <!-- Include supported.sgml boilerplate -->
164  &supported; 
165 <!-- end boilerplate -->
166
167 <para>
168  Note: If you have a previous <application>Junkbuster</application> or
169  <application>Privoxy</application> installation on your system, you
170  will need to remove it.  Some platforms do this for you as part 
171  of their installation procedure. (See below for your platform).
172 </para>
173
174 <para>
175  In any case <emphasis>be sure to backup your old configuration
176  if it is valuable to you.</emphasis> See the
177  <link linkend="upgradersnote">note to upgraders</link> section
178  below.
179 </para>
180
181 <!--   ~~~~~       New section      ~~~~~     -->
182 <sect2 id="installation-pack-rpm"><title>Red Hat and SuSE RPMs</title>
183
184 <para>
185  RPMs can be installed with <literal>rpm -Uvh privoxy-&p-version;-1.rpm</literal>,
186  and will use <filename>/etc/privoxy</filename> for the location 
187  of configuration files.
188 </para>
189
190 <para>
191  Note that on Red Hat, <application>Privoxy</application> will
192  <emphasis>not</emphasis> be automatically started on system boot. You will
193  need to enable that using <command>chkconfig</command>,
194  <command>ntsysv</command>, or similar methods. Note that SuSE will 
195 automatically start Privoxy in the boot process.
196 </para>
197
198 <para>
199  If you have problems with failed dependencies, try rebuilding the SRC RPM: 
200  <literal>rpm --rebuild privoxy-&p-version;-1.src.rpm;</literal>. This 
201  will use your locally installed libraries and RPM version. 
202 </para>
203
204 <para>
205  Also note that if you have a <application>Junkbuster</application> RPM installed
206  on your system, you need to remove it first, because the packages conflict.
207  Otherwise, RPM will try to remove <application>Junkbuster</application>
208  automatically, before installing <application>Privoxy</application>.
209 </para>
210 </sect2>
211
212 <!--   ~~~~~       New section      ~~~~~     -->
213 <sect2 id="installation-deb"><title>Debian</title>
214 <para>
215  FIXME.
216 </para>
217 </sect2>
218
219 <!--   ~~~~~       New section      ~~~~~     -->
220 <sect2 id="installation-pack-win"><title>Windows</title>
221
222 <para>
223  Just double-click the installer, which will guide you through
224  the installation process. You will find the configuration files
225  in the same directory as you installed Privoxy in. We do not
226  use the registry of Windows. 
227 </para>
228 </sect2>
229
230 <!--   ~~~~~       New section      ~~~~~     -->
231 <sect2 id="installation-pack-bintgz"><title>Solaris, NetBSD, FreeBSD, HP-UX</title>
232
233 <para>
234  Create a new directory, <literal>cd</literal> to it, then unzip and
235  untar the archive. For the most part, you'll have to figure out where
236  things go. FIXME.
237 </para>
238 </sect2>
239
240 <!--   ~~~~~       New section      ~~~~~     -->
241 <sect2 id="installation-os2"><title>OS/2</title>
242
243 <para>
244  First, make sure that no previous installations of
245  <application>Junkbuster</application> and / or 
246  <application>Privoxy</application> are left on your
247  system. You can do this by 
248 </para>
249
250 <para>
251  Then, just double-click the WarpIN self-installing archive, which will
252  guide you through the installation process. A shadow of the
253  <application>Privoxy</application> executable will be placed in your
254  startup folder so it will start automatically whenever OS/2 starts.
255 </para>
256
257 <para>
258  The directory you choose to install <application>Privoxy</application>
259  into will contain all of the configuration files.
260 </para>
261 </sect2>
262
263 <!--   ~~~~~       New section      ~~~~~     -->
264 <sect2 id="installation-mac"><title>Max OSX</title>
265 <para>
266  Unzip the downloaded package (you can either double-click on the file
267  in the finder, or on the desktop if you downloaded it there).  Then,
268  double-click on the package installer icon and follow the installation
269  process.
270  <application>Privoxy</application> will be installed in the subdirectory
271  <literal>/Applications/Privoxy.app</literal>.
272  <application>Privoxy</application> will set itself up to start 
273  automatically on system bring-up via
274  <literal>/System/Library/StartupItems/Privoxy</literal>.
275 </para>
276 </sect2>
277
278 <!--   ~~~~~       New section      ~~~~~     -->
279 <sect2 id="installation-amiga"><title>AmigaOS</title>
280 <para>
281  Copy and then unpack the <filename>lha</filename> archive to a suitable location. 
282  All necessary files will be installed into <application>Privoxy</application>
283  directory, including all configuration and log files. To uninstall, just 
284  remove this directory.
285 </para>
286 <para>
287  Start <application>Privoxy</application> (with RUN &lt;&gt;NIL:) in your
288  <filename>startnet</filename> script (AmiTCP), in
289  <filename>s:user-startup</filename> (RoadShow), as startup program in your
290  startup script (Genesis), or as startup action (Miami and MiamiDx). 
291  <application>Privoxy</application> will automatically quit when you quit your
292  TCP/IP stack (just ignore the harmless warning your TCP/IP stack may display that
293  <application>Privoxy</application> is still running).
294 </para>
295 </sect2>
296 </sect1>
297
298 <!--  ~  End section  ~  -->
299
300 <!--   ~~~~~       New section      ~~~~~     -->
301 <sect1 id="upgradersnote">
302 <title>Note to Upgraders</title>
303 <para>
304  There are very significant changes from older versions of 
305  <application>Junkbuster</application> to the current
306  <application>Privoxy</application>. Configuration is substantially 
307  changed. <application>Junkbuster 2.0.x</application> and earlier 
308  configuration files will not migrate. The functionality of the old
309  <filename>blockfile</filename>, <filename>cookiefile</filename> and
310  <filename>imagelist</filename>, are now combined into the
311  <ulink url="actions-file.html"><quote>actions files</quote></ulink>.  
312  <filename>default.action</filename>, is the main actions file. Local
313  exceptions should best be put into <filename>user.action</filename>.
314 </para>
315 <para>
316  A <ulink url="filter-file.html"><quote>filter file</quote></ulink> (typically
317  <filename>default.filter</filename>) is new as of <application>Privoxy
318  2.9.x</application>, and provides some of the new sophistication (explained
319  below). <filename>config</filename> is much the same as before.
320 </para>
321 <para>
322  If upgrading from a 2.0.x version, you will have to use the new config 
323  files, and possibly adapt any personal rules from your older files.
324  When porting personal rules over from the old <filename>blockfile</filename>
325  to the new actions files, please note that even the pattern syntax has
326  changed. If upgrading from 2.9.x development versions, it is still
327  recommended to use the new configuration files.
328 </para>
329 <para>
330  A quick list of things to be aware of before upgrading: 
331 </para>
332
333 <para>
334  <itemizedlist>
335
336  <listitem>
337   <para>
338    The default listening port is now 8118 due to a conflict with another 
339    service (NAS).
340   </para>
341  </listitem>  
342  <listitem>
343   <para>  
344     Some installers may remove earlier versions completely. Save any 
345     important configuration files!
346   </para>
347  </listitem>
348  <listitem>
349   <para>
350    <application>Privoxy</application> is controllable with a web browser 
351    at the special URL: <ulink
352    url="http://config.privoxy.org/">http://config.privoxy.org/</ulink>
353    (Shortcut: <ulink url="http://p.p/">http://p.p/</ulink>). Many
354    aspects of configuration can be done here, including temporarily disabling
355    <application>Privoxy</application>.
356   </para>
357  </listitem> 
358  <listitem>
359   <para>
360    The primary configuration file for cookie management, ad and banner 
361    blocking, and many other aspects of <application>Privoxy</application>
362    configuration is in the <ulink url="actions-file.html">actions
363    files</ulink>. It is strongly recommended to become familiar with the new
364    actions concept below, before modifying these files. Locally defined rules 
365    should go into <filename>user.action</filename>.
366   </para>
367  </listitem> 
368   <listitem>
369   <para>
370 <!-- I think it is best to keep this somewhat vague, in case  -->
371 <!-- the situation changes under our feet. -->   
372    Some installers may not automatically start
373    <application>Privoxy</application> after installation.
374   </para>
375  </listitem> 
376
377  </itemizedlist>
378 </para>
379 </sect1>
380
381 <!--   ~~~~~       New section      ~~~~~     -->
382 <sect1 id="quickstart"><title>Quickstart to Using <application>Privoxy</application></title>
383 <para>
384  <itemizedlist>
385
386  <listitem>
387   <para>
388   Install <application>Privoxy</application>. See the section <link linkend="installation">Installing</link>.
389   </para>
390  </listitem>  
391
392  <listitem>
393   <para>
394   Start <application>Privoxy</application>. See the section <link linkend="startup">Starting <application>Privoxy</application></link>.
395   </para>
396  </listitem>  
397
398  <listitem>
399   <para>
400   Change your browser's configuration to use the proxy <literal>localhost</literal> on port
401   <literal>8118</literal>. See the section <link linkend="startup">Starting <application>Privoxy</application></link>.
402   </para>
403  </listitem>  
404
405  <listitem>
406   <para>
407   Enjoy surfing with enhanced comfort and privacy. Please see the section
408   <link linkend="contact">Contacting the Developers</link> on how to report
409   bugs or problems with websites or to get help. You may want to change the
410   file <filename>user.action</filename> to further tweak your new browsing
411   experience.
412   </para>
413  </listitem>  
414
415  </itemizedlist>
416 </para>
417
418 </sect1>
419
420 <!--   ~~~~~       New section      ~~~~~     -->
421 <sect1 id="startup">
422 <title>Starting <application>Privoxy</application></title>
423 <para>
424  Before launching <application>Privoxy</application> for the first time, you
425  will want to configure your browser(s) to use
426  <application>Privoxy</application> as a HTTP and HTTPS proxy. The default is
427  localhost for the proxy address, and port 8118 (earlier versions used port
428  8000). This is the one configuration step that must be done!
429 </para>
430  
431 <para> 
432  With <application>Netscape</application> (and
433  <application>Mozilla</application>), this can be set under <literal>Edit
434  -&gt; Preferences -&gt; Advanced -&gt; Proxies -&gt; HTTP Proxy</literal>.
435  For <application>Internet Explorer</application>: <literal>Tools -&gt;
436  Internet Properties -&gt; Connections -&gt; LAN Setting</literal>. Then,
437  check <quote>Use Proxy</quote> and fill in the appropriate info (Address:
438  localhost, Port: 8118). Include if HTTPS proxy support too.
439 </para>
440
441 <para>
442  After doing this, flush your browser's disk and memory caches to force a
443  re-reading of all pages and to get rid of any ads that may be cached. You 
444  are now ready to start enjoying the benefits of using
445  <application>Privoxy</application>!
446 </para>
447
448 <para>
449  <application>Privoxy</application> is typically started by specifying the
450  main configuration file to be used on the command line. If no configuration
451  file is specified on the command line, <application>Privoxy</application>
452  will look for a file named <filename>config</filename> in the current
453  directory. Except on Win32 where it will try <filename>config.txt</filename>.
454 </para>
455
456 <sect2 id="start-redhatdebian">
457 <title>RedHat and Debian</title>
458 <para>
459 We use a script. Note that RedHat does not start Privoxy upon booting per
460 default. It will use the file <filename>/etc/privoxy/config</filename> as its
461 main configuration file. FIXME: Debian??
462 </para>
463 <para>
464  <screen>
465  # /etc/rc.d/init.d/privoxy start
466 </screen>
467 </para>
468 </sect2>
469
470 <sect2 id="start-suse">
471 <title>SuSE</title>
472 <para>
473 We use a script. It will use the file <filename>/etc/privoxy/config</filename>
474 as its main configuration file. Note that SuSE starts Privoxy upon booting
475 your PC.
476 </para>
477 <para>
478  <screen>
479  # rcprivoxy start
480 </screen>
481 </para>
482 </sect2>
483
484 <sect2 id="start-windows">
485 <title>Windows</title>
486 <para>
487 Click on the Privoxy Icon to start Privoxy. If no configuration file is
488  specified on the command line, <application>Privoxy</application> will look
489  for a file named <filename>config.txt</filename>. Note that Windows will
490  automatically start Privoxy upon booting you PC.
491 </para>
492 </sect2>
493
494 <sect2 id="start-unices">
495 <title>Solaris, NetBSD, FreeBSD, HP-UX and others</title>
496 <para>
497 Example Unix startup command:
498 </para>
499 <para>
500  <screen>
501  # /usr/sbin/privoxy /etc/privoxy/config
502 </screen>
503 </para>
504 </sect2>
505
506 <sect2 id="start-os2">
507 <title>OS/2</title>
508 <para>
509 FIXME.
510 </para>
511 </sect2>
512
513 <sect2 id="start-macosx">
514 <title>MAX OSX</title>
515 <para>
516 FIXME.
517 </para>
518 </sect2>
519
520
521 <sect2 id="start-amigaos">
522 <title>AmigaOS</title>
523 <para>
524 FIXME.
525 </para>
526 </sect2>
527
528 <!--
529
530 <para>
531  See the section <link linkend="cmdoptions">Command line options</link> for
532  furher info.
533 </para>
534
535 must find a better place for this paragraph
536
537 <para>
538  The included default configuration files should give a reasonable starting
539  point. Most of the per site configuration is done in the
540  <ulink url="actions-file.html"><quote>actions</quote></ulink> files. These are
541  where various cookie actions are defined, ad and banner blocking, and other
542  aspects of <application>Privoxy</application> configuration. There are several
543  such files included, with varying levels of aggressiveness. 
544 </para>
545
546 <para>
547  You will probably want to keep an eye out for sites for which you may prefer
548  persistent cookies, and add these to your actions configuration as needed. By
549  default, most of these will be accepted only during the current browser
550  session (aka <quote>session cookies</quote>), unless you add them to the
551  configuration. If you want the browser to handle this instead, you will need
552  to edit <filename>user.action</filename> (or through the web based interface)
553  and disable this feature. If you use more than one browser, it would make
554  more sense to let <application>Privoxy</application> handle this. In which
555  case, the browser(s) should be set to accept all cookies.
556 </para>
557
558 <para>
559  Another feature where you will probably want to define exceptions for trusted
560  sites is the popup-killing (through the <ulink
561  url="actions-file.html#KILL-POPUPS"><quote>+kill-popups</quote></ulink>and
562  <ulink
563  url="actions-file.html#FILTER-POPUPS"><quote>+filter{popups}</quote></ulink>
564  actions), because your favorite shopping, banking, or leisure site may need
565  popups (explained below). 
566 </para>
567
568 <para>
569  <application>Privoxy</application> is HTTP/1.1 compliant,  but not all of
570  the optional 1.1 features are as yet supported. In the unlikely event that
571  you experience inexplicable problems with browsers that use HTTP/1.1 per default
572  (like <application>Mozilla</application> or recent versions of I.E.), you might
573  try to force HTTP/1.0 compatibility. For Mozilla, look under <literal>Edit -&gt;
574  Preferences -&gt; Debug -&gt; Networking</literal>.
575  Alternatively, set the <quote>+downgrade-http-version</quote> config option in
576  <filename>default.action</filename> which will downgrade your browser's HTTP
577  requests from HTTP/1.1 to HTTP/1.0 before processing them.
578 </para>
579
580 <para>
581  After running <application>Privoxy</application> for a while, you can 
582  start to fine tune the configuration to suit your personal, or site, 
583  preferences and requirements. There are many, many aspects that can 
584  be customized. <quote>Actions</quote> 
585  can be adjusted by pointing your browser to 
586  <ulink url="http://config.privoxy.org/">http://config.privoxy.org/</ulink>
587  (shortcut: <ulink url="http://p.p/">http://p.p/</ulink>), 
588  and then follow the link to <quote>View &#38; Change the Current Configuration</quote>. 
589  (This is an internal page and does not require Internet access.)
590 </para>
591
592 <para>
593  In fact, various aspects of <application>Privoxy</application>
594  configuration can be viewed from this page, including 
595  current configuration parameters, source code version numbers, 
596  the browser's request headers, and <quote>actions</quote> that apply 
597  to a given URL. In addition to the actions file 
598  editor mentioned above, <application>Privoxy</application> can also 
599  be turned <quote>on</quote> and <quote>off</quote> (toggled) from this page.
600 </para>
601
602 <para>
603  If you encounter problems, try loading the page without
604  <application>Privoxy</application>. If that helps, enter the URL where
605  you have the problems into <ulink url="http://p.p/show-url-info">the browser
606  based rule tracing utility</ulink>. See which rules apply and why, and
607  then try turning them off for that site one after the other, until the problem
608  is gone. When you have found the culprit, you might want to turn the rest on
609  again.
610 </para>
611
612 <para>
613  If the above paragraph sounds gibberish to you, you might want to <ulink
614  url="actions-file.html#ACTIONSFILE">read more about the actions concept</ulink>
615  or even dive deep into the <ulink url="appendix.html#ACTIONSANAT">Appendix
616  on actions</ulink>.
617 </para>
618
619 <para>
620  If you can't get rid of the problem at all, think you've found a bug in
621  Privoxy, want to propose a new feature or smarter rules, please see the 
622  section <ulink url="contact.html"><quote>Contacting the
623  Developers</quote></ulink> below. 
624 </para>
625
626 -->
627
628 <!--   ~~~~~       New section      ~~~~~     -->
629 <sect2 id="cmdoptions">
630 <title>Command Line Options</title>
631 <para>
632  <application>Privoxy</application> may be invoked with the following
633  command-line options:
634 </para>
635
636 <para>
637  <itemizedlist>
638
639  <listitem>
640   <para>
641     <emphasis>--version</emphasis>
642   </para>
643   <para>
644      Print version info and exit. Unix only.
645   </para>
646  </listitem> 
647  <listitem>
648   <para>
649     <emphasis>--help</emphasis>
650   </para>
651   <para>
652    Print short usage info and exit. Unix only.
653   </para>
654  </listitem> 
655  <listitem>
656   <para>
657    <emphasis>--no-daemon</emphasis>
658   </para>
659   <para>
660    Don't become a daemon, i.e. don't fork and become process group
661    leader, and don't detach from controlling tty. Unix only.
662   </para>
663  </listitem> 
664  <listitem>
665   <para>
666    <emphasis>--pidfile FILE</emphasis>
667   
668   </para>
669   <para>
670    On startup, write the process ID to <emphasis>FILE</emphasis>. Delete the
671    <emphasis>FILE</emphasis> on exit. Failure to create or delete the
672    <emphasis>FILE</emphasis> is non-fatal. If no <emphasis>FILE</emphasis>
673    option is given, no PID file will be used. Unix only.
674   </para>
675  </listitem> 
676  <listitem>
677   <para>
678    <emphasis>--user USER[.GROUP]</emphasis>
679   
680   </para>
681   <para>
682    After (optionally) writing the PID file, assume the user  ID  of
683    <emphasis>USER</emphasis>, and if included the GID of GROUP.  Exit if the
684    privileges are not sufficient to do so. Unix only.
685   </para>
686  </listitem> 
687  <listitem>
688   <para>
689     <emphasis>configfile</emphasis>
690   </para>
691   <para>
692     If no <emphasis>configfile</emphasis> is included on the command line, 
693     <application>Privoxy</application> will look for a file named 
694     <quote>config</quote> in the current directory (except on Win32 
695     where it will look for <quote>config.txt</quote> instead). Specify 
696     full path to avoid confusion. If no config file is found, 
697     <application>Privoxy</application> will fail to start.
698   </para>
699  </listitem> 
700
701  </itemizedlist>
702 </para>
703
704 </sect2>
705
706 </sect1>
707
708 <!--  ~  End section  ~  -->
709
710
711 <!--   ~~~~~       New section      ~~~~~     -->
712 <sect1 id="configuration"><title><application>Privoxy</application> Configuration</title>
713  <para>
714   All <application>Privoxy</application> configuration is stored  
715   in text files. These files can be edited with a text editor.
716   Many important aspects of <application>Privoxy</application> can 
717   also be controlled easily with a web browser.
718  </para>
719
720
721 <!--   ~~~~~       New section      ~~~~~     -->
722
723 <sect2>
724 <title>Controlling <application>Privoxy</application> with Your Web Browser</title>
725 <para>
726  <application>Privoxy</application>'s user interface can be reached through the special 
727  URL <ulink url="http://config.privoxy.org/">http://config.privoxy.org/</ulink>
728  (shortcut: <ulink url="http://p.p/">http://p.p/</ulink>), 
729  which is a built-in page and works without Internet access.
730  You will see the following section:
731
732 </para>
733
734 <!-- Needs to be put in a table and colorized  -->
735 <screen>
736  <msgtext>
737  <bridgehead renderas="sect2">Privoxy Menu</bridgehead>
738
739  <simplelist>
740  <member>
741   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&squf;&nbsp;&nbsp;<ulink url="http://config.privoxy.org/show-status">View & change the current configuration</ulink>
742  </member>
743  <member>
744   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&squf;&nbsp;&nbsp;<ulink url="http://config.privoxy.org/show-version">View the source code version numbers</ulink>
745  </member>
746  <member>
747   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&squf;&nbsp;&nbsp;<ulink url="http://config.privoxy.org/show-request">View the request headers.</ulink>
748  </member>
749  <member>
750   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&squf;&nbsp;&nbsp;<ulink url="http://config.privoxy.org/show-url-info">Look up which actions apply to a URL and why</ulink>
751  </member>
752  <member>
753   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&squf;&nbsp;&nbsp;<ulink url="http://config.privoxy.org/toggle">Toggle Privoxy on or off</ulink>
754  </member>
755  </simplelist>
756  </msgtext>
757 </screen>
758
759
760 <para>
761  This should be self-explanatory. Note the first item leads to an editor for the
762  <quote>actions list</quote>, which is where the ad, banner, cookie,
763  and URL blocking magic is configured as well as other advanced features of
764  <application>Privoxy</application>. This is an easy way to adjust various
765  aspects of <application>Privoxy</application> configuration. The actions
766  file, and other configuration files, are explained in detail below. 
767 </para>
768
769 <para>
770  <quote>Toggle Privoxy On or Off</quote> is handy for sites that might 
771  have problems with your current actions and filters. You can in fact use
772  it as a test to see whether it is <application>Privoxy</application> 
773  causing the problem or not. <application>Privoxy</application> continues 
774  to run as a proxy in this case, but all filtering is disabled. There
775  is even a toggle <link linkend="bookmarklets">Bookmarklet</link> offered, so
776  that you can toggle <application>Privoxy</application> with one click from
777  your browser.
778 </para>
779
780 </sect2>
781
782 <!--  ~  End section  ~  -->
783
784
785
786
787 <!--   ~~~~~       New section      ~~~~~     -->
788
789 <sect2 id="confoverview">
790 <title>Configuration Files Overview</title>
791 <para>
792  For Unix, *BSD and Linux, all configuration files are located in
793  <filename>/etc/privoxy/</filename> by default. For MS Windows, OS/2, and
794  AmigaOS these are all in the same directory as the 
795  <application>Privoxy</application> executable. <![%p-not-stable;[ The name
796  and number of configuration files has changed from previous versions, and is
797  subject to change as development progresses.]]>
798 </para>
799
800 <para>
801  The installed defaults provide a reasonable starting point, though 
802  some settings may be aggressive by some standards. For the time being, the
803  principle configuration files are:
804 </para>
805
806 <para>
807  <itemizedlist>
808
809   <listitem>
810    <para>
811      The main configuration file is named <link linkend="config">config</link>
812      on Linux, Unix, BSD, OS/2, and AmigaOS and <filename>config.txt</filename>
813      on Windows. This is a required file.
814    </para>
815   </listitem> 
816
817   <listitem>
818    <para>
819     <filename>default.action</filename> (the main <link linkend="actions-file">actions file</link>) is used to define
820     the default settings for various <quote>actions</quote> relating to images, banners, 
821     pop-ups, access restrictions, banners and cookies.
822    </para>
823    <para>
824     Multiple actions files may be defined in <filename>config</filename>. These 
825     are processed in the order they are defined. Local customizations and locally 
826     preferred exceptions to the default policies as defined in
827     <filename>default.action</filename> are probably best applied in
828     <filename>user.action</filename>, which should be preserved across
829     upgrades. <filename>standard.action</filename> is also included. This is mostly 
830     for <application>Privoxy's</application> internal use.
831    </para>
832    <para>    
833     There is also a web based editor that can be accessed from
834     <ulink
835     url="http://config.privoxy.org/show-status/">http://config.privoxy.org/show-status/</ulink>
836     (Shortcut: <ulink
837     url="http://p.p/show-status/">http://p.p/show-status/</ulink>) for the
838     various actions files. 
839    </para>
840   </listitem> 
841
842   <listitem>
843    <para>
844     <filename>default.filter</filename> (the <link linkend="filter-file">filter
845     file</link>) can be used to re-write the raw page content, including
846     viewable text as well as embedded HTML and JavaScript, and whatever else
847     lurks on any given web page. The filtering jobs are only pre-defined here;
848     whether to apply them or not is up to the actions files.
849    </para>
850   </listitem> 
851
852  </itemizedlist>
853 </para>
854
855 <para>
856  All files use the <quote><literal>#</literal></quote> character to denote a
857  comment (the rest of the line will be ignored) angd understand line continuation
858  through placing a backslash ("<literal>\</literal>") as the very last character
859  in a line. If the <literal>#</literal> is preceded by a backslash, it looses
860  its special function. Placing a <literal>#</literal> in front of an otherwise
861  valid configuration line to prevent it from being interpreted is called "commenting
862  out" that line.
863 </para>
864
865 <para>
866  The actions files and <filename>default.filter</filename> 
867  can use Perl style <link linkend="regex">regular expressions</link> for
868  maximum flexibility. 
869 </para>
870
871 <para>
872  After making any changes, there is no need to restart
873  <application>Privoxy</application> in order for the changes to take
874  effect. <application>Privoxy</application> detects such changes 
875  automatically. Note, however, that it may take one or two additional
876  requests for the change to take effect. When changing the listening address
877  of <application>Privoxy</application>, these <quote>wake up</quote> requests
878  must obviously be sent to the <emphasis>old</emphasis> listening address.
879 </para>
880
881 <![%p-not-stable;[
882 <para>
883  While under development, the configuration content is subject to change. 
884  The below documentation may not be accurate by the time you read this. 
885  Also, what constitutes a <quote>default</quote> setting, may change, so 
886  please check all your configuration files on important issues.
887 </para>
888 ]]>
889
890 </sect2>
891 </sect1>
892 <!--  ~  End section  ~  -->
893
894
895 <!--   ~~~~~~~~       New section Header    ~~~~~~~~~     -->
896
897 <sect1 id="config">
898 <title>The Main Configuration File</title>
899
900 <para>
901  Again, the main configuration file is named <filename>config</filename> on
902  Linux/Unix/BSD and OS/2, and <filename>config.txt</filename> on Windows.
903  Configuration lines consist of an initial keyword followed by a list of
904  values, all separated by whitespace (any number of spaces or tabs). For
905  example:
906 </para>
907
908 <para>
909  <literal>
910   <msgtext> 
911    <literallayout>
912   <emphasis>confdir /etc/privoxy</emphasis>
913    </literallayout>
914   </msgtext>
915  </literal> 
916 </para>
917
918 <para>
919  Assigns the value <literal>/etc/privoxy</literal> to the option
920  <literal>confdir</literal> and thus indicates that the configuration
921  directory is named <quote>/etc/privoxy/</quote>.
922 </para>
923
924 <para>
925  All options in the config file except for <literal>confdir</literal> and
926  <literal>logdir</literal> are optional. Watch out in the below description
927  for what happens if you leave them unset.
928 </para>
929
930 <para>
931  The main config file controls all aspects of <application>Privoxy</application>'s
932  operation that are not location dependent (i.e. they apply universally, no matter
933  where you may be surfing).
934 </para>
935
936
937 <!--   ~~~~~       New section      ~~~~~     -->
938
939 <sect2 id="conf-log-loc">
940 <title>Configuration and Log File Locations</title>
941
942 <para>
943  <application>Privoxy</application> can (and normally does) use a number of
944  other files for additional configuration, help and logging.
945  This section of the configuration file tells <application>Privoxy</application>
946  where to find those other files. 
947 </para>
948
949
950 <sect3 renderas="sect4" id="confdir"><title>confdir</title>
951
952 <variablelist>
953  <varlistentry>
954   <term>Specifies:</term>
955   <listitem>
956    <para>The directory where the other configuration files are located</para>
957   </listitem>
958  </varlistentry>
959  <varlistentry>
960   <term>Type of value:</term>
961   <listitem>
962    <para>Path name</para>
963   </listitem>
964  </varlistentry>
965  <varlistentry>
966   <term>Default value:</term>
967   <listitem>
968    <para>/etc/privoxy (Unix) <emphasis>or</emphasis> <application>Privoxy</application> installation dir (Windows) </para>
969   </listitem>
970  </varlistentry>
971  <varlistentry>
972   <term>Effect if unset:</term>
973   <listitem>
974    <para><emphasis>Mandatory</emphasis></para>
975   </listitem>
976  </varlistentry>
977  <varlistentry>
978   <term>Notes:</term>
979   <listitem>
980    <para>
981     No trailing <quote><literal>/</literal></quote>, please
982    </para>
983    <para>
984     When development goes modular and multi-user, the blocker, filter, and
985     per-user config will be stored in subdirectories of <quote>confdir</quote>.
986     For now, the configuration directory structure is flat, except for 
987     <filename>confdir/templates</filename>, where the HTML templates for CGI 
988     output reside (e.g. <application>Privoxy's</application> 404 error page). 
989    </para>
990   </listitem>
991  </varlistentry>
992 </variablelist>
993 </sect3>
994
995
996 <sect3 renderas="sect4" id="logdir"><title>logdir</title>
997
998 <variablelist>
999  <varlistentry>
1000   <term>Specifies:</term>
1001   <listitem>
1002    <para>
1003     The directory where all logging takes place (i.e. where <filename>logfile</filename> and 
1004     <filename>jarfile</filename> are located) 
1005    </para>
1006   </listitem>
1007  </varlistentry>
1008  <varlistentry>
1009   <term>Type of value:</term>
1010   <listitem>
1011    <para>Path name</para>
1012   </listitem>
1013  </varlistentry>
1014  <varlistentry>
1015   <term>Default value:</term>
1016   <listitem>
1017    <para>/var/log/privoxy (Unix) <emphasis>or</emphasis> <application>Privoxy</application> installation dir (Windows) </para>
1018   </listitem>
1019  </varlistentry>
1020  <varlistentry>
1021   <term>Effect if unset:</term>
1022   <listitem>
1023    <para><emphasis>Mandatory</emphasis></para>
1024   </listitem>
1025  </varlistentry>
1026  <varlistentry>
1027   <term>Notes:</term>
1028   <listitem>
1029    <para>
1030     No trailing <quote><literal>/</literal></quote>, please
1031    </para>
1032   </listitem>
1033  </varlistentry>
1034 </variablelist>
1035 </sect3>
1036
1037 <sect3 renderas="sect4" id="actionsfile"><title>
1038 actionsfile
1039 </title>
1040 <anchor id="default.action">
1041 <anchor id="standard.action">
1042 <anchor id="user.action">
1043 <!-- Note: slightly modified this section 04/28/02, hal. See NOTE. -->
1044 <variablelist>
1045  <varlistentry>
1046   <term>Specifies:</term>
1047   <listitem>
1048    <para>
1049     The <link linkend="actions">actions</link> file(s) to use
1050    </para>
1051   </listitem>
1052  </varlistentry>
1053  <varlistentry>
1054   <term>Type of value:</term>
1055   <listitem>
1056    <para>File name, relative to <literal>confdir</literal></para>
1057   </listitem>
1058  </varlistentry>
1059  <varlistentry>
1060   <term>Default value:</term>
1061   <listitem>
1062    <simplelist>
1063     <member>
1064      <msgtext><literallayout>  standard     # Internal purposes, recommended not editing</literallayout></msgtext>
1065     </member>
1066     <member>
1067      <msgtext><literallayout>  default      # Main actions file</literallayout></msgtext>
1068     </member>
1069     <member>
1070      <msgtext><literallayout>  user         # User customizations</literallayout></msgtext>
1071     </member>
1072    </simplelist>
1073   </listitem>
1074  </varlistentry>
1075  <varlistentry>
1076   <term>Effect if unset:</term>
1077   <listitem>
1078    <para>
1079     No actions are taken at all. Simple neutral proxying. 
1080    </para>
1081   </listitem>
1082  </varlistentry>
1083  <varlistentry>
1084   <term>Notes:</term>
1085   <listitem>
1086    <para>
1087     Multiple <literal>actionsfile</literal> lines are permitted, and are in fact recommended!
1088    </para>
1089    <para> 
1090     The default values include standard.action, which is used for internal
1091     purposes and should be loaded, default.action, which is the
1092     <quote>main</quote> actions file maintained by the developers, and
1093     <filename>user.action</filename>, where you can make your personal additions.
1094    </para>
1095    <para> 
1096     Actions files are where all the per site and per URL configuration is done for 
1097     ad blocking, cookie management, privacy considerations, etc.
1098     There is no point in using <application>Privoxy</application> without at 
1099     least one actions file.
1100    </para>
1101   </listitem>
1102  </varlistentry>
1103 </variablelist>
1104 </sect3>
1105
1106 <sect3 renderas="sect4" id="filterfile"><title>filterfile</title>
1107 <anchor id="default.filter">
1108 <variablelist>
1109  <varlistentry>
1110   <term>Specifies:</term>
1111   <listitem>
1112    <para>
1113     The <link linkend="filter">filter</link> file to use
1114    </para>
1115   </listitem>
1116  </varlistentry>
1117  <varlistentry>
1118   <term>Type of value:</term>
1119   <listitem>
1120    <para>File name, relative to <literal>confdir</literal></para>
1121   </listitem>
1122  </varlistentry>
1123  <varlistentry>
1124   <term>Default value:</term>
1125   <listitem>
1126    <para>default.filter (Unix) <emphasis>or</emphasis> default.filter.txt (Windows)</para>
1127   </listitem>
1128  </varlistentry>
1129  <varlistentry>
1130   <term>Effect if unset:</term>
1131   <listitem>
1132    <para>
1133     No textual content filtering takes place, i.e. all
1134     <literal>+filter{<replaceable class="parameter">name</replaceable>}</literal>
1135     actions in the actions files are turned off
1136    </para>
1137   </listitem>
1138  </varlistentry>
1139  <varlistentry>
1140   <term>Notes:</term>
1141   <listitem>
1142    <para>
1143     The <quote>default.filter</quote> file contains content modification rules 
1144     that use <quote>regular expressions</quote>. These rules permit powerful
1145     changes on the content of Web pages, e.g., you could disable your favorite
1146     JavaScript annoyances, re-write the actual displayed text, or just have some
1147     fun replacing <quote>Microsoft</quote> with <quote>MicroSuck</quote> wherever
1148     it appears on a Web page.
1149    </para>
1150   </listitem>
1151  </varlistentry>
1152 </variablelist>
1153 </sect3>
1154
1155 <sect3 renderas="sect4" id="logfile"><title>logfile</title>
1156
1157 <variablelist>
1158  <varlistentry>
1159   <term>Specifies:</term>
1160   <listitem>
1161    <para>
1162     The log file to use
1163    </para>
1164   </listitem>
1165  </varlistentry>
1166  <varlistentry>
1167   <term>Type of value:</term>
1168   <listitem>
1169    <para>File name, relative to <literal>logdir</literal></para>
1170   </listitem>
1171  </varlistentry>
1172  <varlistentry>
1173   <term>Default value:</term>
1174   <listitem>
1175    <para>logfile (Unix) <emphasis>or</emphasis> privoxy.log (Windows)</para>
1176   </listitem>
1177  </varlistentry>
1178  <varlistentry>
1179   <term>Effect if unset:</term>
1180   <listitem>
1181    <para>
1182     No log file is used, all log messages go to the console (<literal>stderr</literal>).
1183    </para>
1184   </listitem>
1185  </varlistentry>
1186  <varlistentry>
1187   <term>Notes:</term>
1188   <listitem>
1189    <para>
1190     The windows version will additionally log to the console.
1191    </para>
1192    <para>
1193     The logfile is where all logging and error messages are written. The level
1194     of detail and number of messages are set with the <literal>debug</literal>
1195     option (see below). The logfile can be useful for tracking down a problem with
1196     <application>Privoxy</application> (e.g., it's not blocking an ad you
1197     think it should block) but in most cases you probably will never look at it.
1198    </para>
1199    <para>
1200     Your logfile will grow indefinitely, and you will probably want to
1201     periodically remove it.  On Unix systems, you can do this with a cron job
1202     (see <quote>man cron</quote>). For Red Hat, a <command>logrotate</command> 
1203     script has been included.
1204    </para> 
1205    <para>
1206     On SuSE Linux systems, you can place a line like <quote>/var/log/privoxy.*
1207     +1024k 644 nobody.nogroup</quote> in <filename>/etc/logfiles</filename>, with
1208     the effect that cron.daily will automatically archive, gzip, and empty the
1209     log, when it exceeds 1M size.
1210    </para>
1211   </listitem>
1212  </varlistentry>
1213 </variablelist>
1214 </sect3>
1215
1216 <sect3 renderas="sect4" id="jarfile"><title>jarfile</title>
1217
1218 <variablelist>
1219  <varlistentry>
1220   <term>Specifies:</term>
1221   <listitem>
1222    <para>
1223     The file to store intercepted cookies in
1224    </para>
1225   </listitem>
1226  </varlistentry>
1227  <varlistentry>
1228   <term>Type of value:</term>
1229   <listitem>
1230    <para>File name, relative to <literal>logdir</literal></para>
1231   </listitem>
1232  </varlistentry>
1233  <varlistentry>
1234   <term>Default value:</term>
1235   <listitem>
1236    <para>jarfile (Unix) <emphasis>or</emphasis> privoxy.jar (Windows)</para>
1237   </listitem>
1238  </varlistentry>
1239  <varlistentry>
1240   <term>Effect if unset:</term>
1241   <listitem>
1242    <para>
1243     Intercepted cookies are not stored at all.
1244    </para>
1245   </listitem>
1246  </varlistentry>
1247  <varlistentry>
1248   <term>Notes:</term>
1249   <listitem>
1250    <para>
1251     The jarfile may grow to ridiculous sizes over time.
1252    </para>
1253   </listitem>
1254  </varlistentry>
1255 </variablelist>
1256 </sect3>
1257
1258 <sect3 renderas="sect4" id="trustfile"><title>trustfile</title>
1259 <variablelist>
1260  <varlistentry>
1261   <term>Specifies:</term>
1262   <listitem>
1263    <para>
1264     The trust file to use
1265    </para>
1266   </listitem>
1267  </varlistentry>
1268  <varlistentry>
1269   <term>Type of value:</term>
1270   <listitem>
1271    <para>File name, relative to <literal>confdir</literal></para>
1272   </listitem>
1273  </varlistentry>
1274  <varlistentry>
1275   <term>Default value:</term>
1276   <listitem>
1277    <para><emphasis>Unset (commented out)</emphasis>. When activated: trust (Unix) <emphasis>or</emphasis> trust.txt (Windows)</para>
1278   </listitem>
1279  </varlistentry>
1280  <varlistentry>
1281   <term>Effect if unset:</term>
1282   <listitem>
1283    <para>
1284     The whole trust mechanism is turned off.
1285    </para>
1286   </listitem>
1287  </varlistentry>
1288  <varlistentry>
1289   <term>Notes:</term>
1290   <listitem>
1291    <para>
1292     The trust mechanism is an experimental feature for building white-lists and should
1293     be used with care. It is <emphasis>NOT</emphasis> recommended for the casual user.
1294    </para>
1295    <para>
1296     If you specify a trust file, <application>Privoxy</application> will only allow
1297     access to sites that are named in the trustfile. 
1298     You can also mark sites as trusted referrers (with <literal>+</literal>), with
1299     the effect that access to untrusted sites will be granted, if a link from a
1300     trusted referrer was used.
1301     The link target will then be added to the <quote>trustfile</quote>.
1302     Possible applications include limiting Internet access for children.
1303    </para>
1304    <para>
1305     If you use <literal>+</literal> operator in the trust file, it may grow considerably over time.
1306    </para>
1307   </listitem>
1308  </varlistentry>
1309 </variablelist>
1310 </sect3>
1311
1312 <sect3 renderas="sect4" id="user-manual"><title>user-manual</title>
1313 <variablelist>
1314  <varlistentry>
1315   <term>Specifies:</term>
1316   <listitem>
1317    <para>
1318     Location of the <application>Privoxy</application> User Manual.
1319    </para>
1320   </listitem>
1321  </varlistentry>
1322  <varlistentry>
1323   <term>Type of value:</term>
1324   <listitem>
1325    <para>A fully qualified URI</para>
1326   </listitem>
1327  </varlistentry>
1328  <varlistentry>
1329   <term>Default value:</term>
1330   <listitem>
1331    <para><ulink url="http://www.privoxy.org/user-manual/">http://www.privoxy.org/user-manual/</ulink></para>
1332   </listitem>
1333  </varlistentry>
1334  <varlistentry>
1335   <term>Effect if unset:</term>
1336   <listitem>
1337    <para>
1338     The default will be used.
1339    </para>
1340   </listitem>
1341  </varlistentry>
1342  <varlistentry>
1343   <term>Notes:</term>
1344   <listitem>
1345    <para>
1346     The User Manual is used for help hints from some of the internal CGI pages. 
1347     It is normally packaged with the binary distributions, and would make more 
1348     sense to have this pointed at a locally installed copy.
1349    </para>
1350    <para>
1351     A more useful example (Unix):
1352    </para>
1353   <para> 
1354    &nbsp;&nbsp;<emphasis>user-manual&nbsp;&nbsp;file:///usr/share/doc/privoxy-&p-version;/user-manual/</emphasis>
1355   </para>
1356   </listitem>
1357  </varlistentry>
1358 </variablelist>
1359 </sect3>
1360
1361 </sect2>
1362
1363 <!--  ~  End section  ~  -->
1364
1365
1366
1367 <!--   ~~~~~       New section      ~~~~~     -->
1368
1369 <sect2 id="local-set-up">
1370 <title>Local Set-up Documentation</title>
1371
1372   <para>
1373     If you intend to operate <application>Privoxy</application> for more users
1374     that just yourself, it might be a good idea to let them know how to reach
1375     you, what you block and why you do that, your policies etc.
1376    </para>
1377
1378 <sect3 renderas="sect4" id="trust-info-url"><title>trust-info-url</title>
1379
1380 <variablelist>
1381  <varlistentry>
1382   <term>Specifies:</term>
1383   <listitem>
1384    <para>
1385     A URL to be displayed in the error page that users will see if access to an untrusted page is denied.    
1386    </para>
1387   </listitem>
1388  </varlistentry>
1389  <varlistentry>
1390   <term>Type of value:</term>
1391   <listitem>
1392    <para>URL</para>
1393   </listitem>
1394  </varlistentry>
1395  <varlistentry>
1396   <term>Default value:</term>
1397   <listitem>
1398    <para>Two example URL are provided</para>
1399   </listitem>
1400  </varlistentry>
1401  <varlistentry>
1402   <term>Effect if unset:</term>
1403   <listitem>
1404    <para>
1405     No links are displayed on the "untrusted" error page.
1406    </para>
1407   </listitem>
1408  </varlistentry>
1409  <varlistentry>
1410   <term>Notes:</term>
1411   <listitem>
1412    <para>
1413     The value of this option only matters if the experimental trust mechanism has been
1414     activated. (See <literal>trustfile</literal> above.)
1415    </para>
1416    <para>
1417     If you use the trust mechanism, it is a good idea to write up some on-line
1418     documentation about your trust policy and to specify the URL(s) here.
1419     Use multiple times for multiple URLs.
1420    </para>
1421    <para>
1422     The URL(s) should be added to the trustfile as well, so users don't end up
1423     locked out from the information on why they were locked out in the first place!
1424    </para>
1425   </listitem>
1426  </varlistentry>
1427 </variablelist>
1428 </sect3>
1429
1430 <sect3 renderas="sect4" id="admin-address"><title>admin-address</title>
1431
1432 <variablelist>
1433  <varlistentry>
1434   <term>Specifies:</term>
1435   <listitem>
1436    <para>
1437     An email address to reach the proxy administrator.
1438    </para>
1439   </listitem>
1440  </varlistentry>
1441  <varlistentry>
1442   <term>Type of value:</term>
1443   <listitem>
1444    <para>Email address</para>
1445   </listitem>
1446  </varlistentry>
1447  <varlistentry>
1448   <term>Default value:</term>
1449   <listitem>
1450    <para><emphasis>Unset</emphasis></para>
1451   </listitem>
1452  </varlistentry>
1453  <varlistentry>
1454   <term>Effect if unset:</term>
1455   <listitem>
1456    <para>
1457     No email address is displayed on error pages and the CGI user interface.
1458    </para>
1459   </listitem>
1460  </varlistentry>
1461  <varlistentry>
1462   <term>Notes:</term>
1463   <listitem>
1464     <para>
1465     If both <literal>admin-address</literal> and <literal>proxy-info-url</literal>
1466     are unset, the whole "Local Privoxy Support" box on all generated pages will
1467     not be shown.
1468    </para>  
1469   </listitem>
1470  </varlistentry>
1471 </variablelist>
1472 </sect3>
1473
1474 <sect3 renderas="sect4" id="proxy-info-url"><title>proxy-info-url</title>
1475
1476 <variablelist>
1477  <varlistentry>
1478   <term>Specifies:</term>
1479   <listitem>
1480    <para>
1481     A URL to documentation about the local <application>Privoxy</application> setup,
1482     configuration or policies.
1483    </para>
1484   </listitem>
1485  </varlistentry>
1486  <varlistentry>
1487   <term>Type of value:</term>
1488   <listitem>
1489    <para>URL</para>
1490   </listitem>
1491  </varlistentry>
1492  <varlistentry>
1493   <term>Default value:</term>
1494   <listitem>
1495    <para><emphasis>Unset</emphasis></para>
1496   </listitem>
1497  </varlistentry>
1498  <varlistentry>
1499   <term>Effect if unset:</term>
1500   <listitem>
1501    <para>
1502     No link to local documentation is displayed on error pages and the CGI user interface.
1503    </para>
1504   </listitem>
1505  </varlistentry>
1506  <varlistentry>
1507   <term>Notes:</term>
1508   <listitem>
1509    <para>
1510     If both <literal>admin-address</literal> and <literal>proxy-info-url</literal>
1511     are unset, the whole "Local Privoxy Support" box on all generated pages will
1512     not be shown.
1513    </para>  
1514    <para>
1515     This URL shouldn't be blocked ;-)
1516    </para> 
1517   </listitem>
1518  </varlistentry>
1519 </variablelist>
1520 </sect3>
1521
1522 </sect2>
1523 <!--  ~  End section  ~  -->
1524
1525 <!--   ~~~~~       New section      ~~~~~     -->
1526
1527 <sect2 id="debugging">
1528 <title>Debugging</title>
1529
1530  <para>
1531   These options are mainly useful when tracing a problem.
1532   Note that you might also want to invoke
1533   <application>Privoxy</application> with the <literal>--no-daemon</literal>
1534   command line option when debugging.
1535  </para>
1536
1537 <sect3 renderas="sect4" id="debug"><title>debug</title>
1538
1539 <variablelist>
1540  <varlistentry>
1541   <term>Specifies:</term>
1542   <listitem>
1543    <para>
1544     Key values that determine what information gets logged.
1545    </para>
1546   </listitem>
1547  </varlistentry>
1548  <varlistentry>
1549   <term>Type of value:</term>
1550   <listitem>
1551    <para>Integer values</para>
1552   </listitem>
1553  </varlistentry>
1554  <varlistentry>
1555   <term>Default value:</term>
1556   <listitem>
1557    <para>12289 (i.e.: URLs plus informational and warning messages)</para>
1558   </listitem>
1559  </varlistentry>
1560  <varlistentry>
1561   <term>Effect if unset:</term>
1562   <listitem>
1563    <para>
1564     Nothing gets logged.
1565    </para>
1566   </listitem>
1567  </varlistentry>
1568  <varlistentry>
1569   <term>Notes:</term>
1570   <listitem>
1571    <para>
1572     The available debug levels are:
1573    </para>
1574    <para>
1575     <programlisting>
1576   debug         1 # show each GET/POST/CONNECT request
1577   debug         2 # show each connection status
1578   debug         4 # show I/O status
1579   debug         8 # show header parsing
1580   debug        16 # log all data into the logfile
1581   debug        32 # debug force feature
1582   debug        64 # debug regular expression filter 
1583   debug       128 # debug fast redirects
1584   debug       256 # debug GIF de-animation
1585   debug       512 # Common Log Format
1586   debug      1024 # debug kill pop-ups
1587   debug      4096 # Startup banner and warnings.
1588   debug      8192 # Non-fatal errors
1589 </programlisting>
1590    </para>
1591    <para>
1592     To select multiple debug levels, you can either add them or use
1593     multiple <literal>debug</literal> lines.
1594    </para>
1595    <para>
1596     A debug level of 1 is informative because it will show you each request
1597     as it happens. <emphasis>1, 4096 and 8192 are highly recommended</emphasis>
1598     so that you will notice when things go wrong. The other levels are probably
1599     only of interest if you are hunting down a specific problem. They can produce
1600     a hell of an output (especially 16).
1601     <!-- LOL -->
1602    </para>
1603    <para>
1604     The reporting of <emphasis>fatal</emphasis> errors (i.e. ones which crash 
1605     <application>Privoxy</application>) is always on and cannot be disabled.
1606    </para>
1607    <para>
1608     If you want to use CLF (Common Log Format), you should set <quote>debug
1609     512</quote> <emphasis>ONLY</emphasis> and not enable anything else.
1610    </para>
1611   </listitem>
1612  </varlistentry>
1613 </variablelist>
1614 </sect3>
1615
1616 <sect3 renderas="sect4" id="single-threaded"><title>single-threaded</title>
1617
1618 <variablelist>
1619  <varlistentry>
1620   <term>Specifies:</term>
1621   <listitem>
1622    <para>
1623     Whether to run only one server thread
1624    </para>
1625   </listitem>
1626  </varlistentry>
1627  <varlistentry>
1628   <term>Type of value:</term>
1629   <listitem>
1630    <para><emphasis>None</emphasis></para>
1631   </listitem>
1632  </varlistentry>
1633  <varlistentry>
1634   <term>Default value:</term>
1635   <listitem>
1636    <para><emphasis>Unset</emphasis></para>
1637   </listitem>
1638  </varlistentry>
1639  <varlistentry>
1640   <term>Effect if unset:</term>
1641   <listitem>
1642    <para>
1643     Multi-threaded (or, where unavailable: forked) operation, i.e. the ability to
1644     serve multiple requests simultaneously.
1645    </para>
1646   </listitem>
1647  </varlistentry>
1648  <varlistentry>
1649   <term>Notes:</term>
1650   <listitem>
1651    <para>
1652     This option is only there for debug purposes and you should never
1653     need to use it. <emphasis>It will drastically reduce performance.</emphasis>
1654    </para>
1655   </listitem>
1656  </varlistentry>
1657 </variablelist>
1658 </sect3>
1659
1660 </sect2>
1661
1662 <!--   ~~~~~       New section      ~~~~~     -->
1663
1664 <sect2 id="access-control">
1665 <title>Access Control and Security</title>
1666
1667  <para>
1668   This section of the config file controls the security-relevant aspects
1669   of <application>Privoxy</application>'s configuration.
1670  </para>
1671
1672 <sect3 renderas="sect4" id="listen-address"><title>listen-address</title>
1673
1674 <variablelist>
1675  <varlistentry>
1676   <term>Specifies:</term>
1677   <listitem>
1678    <para>
1679     The IP address and TCP port on which <application>Privoxy</application> will
1680     listen for client requests.
1681    </para>
1682   </listitem>
1683  </varlistentry>
1684  <varlistentry>
1685   <term>Type of value:</term>
1686   <listitem>
1687    <para>[<replaceable class="parameter">IP-Address</replaceable>]:<replaceable class="parameter">Port</replaceable></para>
1688   </listitem>
1689  </varlistentry>
1690
1691  <varlistentry>
1692   <term>Default value:</term>
1693   <listitem>
1694    <para>localhost:8118</para>
1695   </listitem>
1696  </varlistentry>
1697  <varlistentry>
1698   <term>Effect if unset:</term>
1699   <listitem>
1700    <para>
1701     Bind to localhost (127.0.0.1), port 8118. This is suitable and recommended for
1702     home users who run <application>Privoxy</application> on the same machine as
1703     their browser.
1704    </para>
1705   </listitem>
1706  </varlistentry>
1707  <varlistentry>
1708   <term>Notes:</term>
1709   <listitem>
1710    <para>
1711     You will need to configure your browser(s) to this proxy address and port.
1712    </para>
1713    <para>
1714     If you already have another service running on port 8118, or if you want to
1715     serve requests from other machines (e.g. on your local network) as well, you
1716     will need to override the default.
1717    </para>
1718    <para>
1719     If you leave out the IP address, <application>Privoxy</application> will
1720     bind to all interfaces (addresses) on your machine and may become reachable
1721     from the Internet. In that case, consider using access control lists (ACL's)
1722     (see <quote>ACLs</quote> below), or a firewall.
1723    </para>
1724   </listitem>
1725  </varlistentry>
1726  <varlistentry>
1727   <term>Example:</term>
1728   <listitem>
1729    <para>
1730      Suppose you are running <application>Privoxy</application> on
1731      a machine which has the address 192.168.0.1 on your local private network
1732      (192.168.0.0) and has another outside connection with a different address.
1733      You want it to serve requests from inside only:
1734    </para>
1735    <para>
1736     <programlisting>
1737   listen-address  192.168.0.1:8118
1738 </programlisting>
1739    </para>
1740   </listitem>
1741  </varlistentry>
1742 </variablelist>
1743 </sect3>
1744
1745 <sect3 renderas="sect4" id="toggle"><title>toggle</title>
1746
1747 <variablelist>
1748  <varlistentry>
1749   <term>Specifies:</term>
1750   <listitem>
1751    <para>
1752     Initial state of "toggle" status
1753    </para>
1754   </listitem>
1755  </varlistentry>
1756  <varlistentry>
1757   <term>Type of value:</term>
1758   <listitem>
1759    <para>1 or 0</para>
1760   </listitem>
1761  </varlistentry>
1762  <varlistentry>
1763   <term>Default value:</term>
1764   <listitem>
1765    <para>1</para>
1766   </listitem>
1767  </varlistentry>
1768  <varlistentry>
1769   <term>Effect if unset:</term>
1770   <listitem>
1771    <para>
1772     Act as if toggled on
1773    </para>
1774   </listitem>
1775  </varlistentry>
1776  <varlistentry>
1777   <term>Notes:</term>
1778   <listitem>
1779    <para>
1780     If set to 0, <application>Privoxy</application> will start in
1781     <quote>toggled off</quote> mode, i.e. behave like a normal, content-neutral
1782     proxy. See <literal>enable-remote-toggle</literal>
1783     below. This is not really useful anymore, since toggling is much easier
1784     via <ulink url="http://config.privoxy.org/toggle">the web
1785     interface</ulink> than via editing the <filename>conf</filename> file.
1786    </para>
1787    <para>
1788     The windows version will only display the toggle icon in the system tray
1789     if this option is present.
1790    </para>
1791   </listitem>
1792  </varlistentry>
1793 </variablelist>
1794 </sect3>
1795
1796
1797 <sect3 renderas="sect4" id="enable-remote-toggle"><title>enable-remote-toggle</title>
1798 <variablelist>
1799  <varlistentry>
1800   <term>Specifies:</term>
1801   <listitem>
1802    <para>
1803     Whether or not the <ulink url="http://config.privoxy.org/toggle">web-based toggle
1804     feature</ulink> may be used
1805    </para>
1806   </listitem>
1807  </varlistentry>
1808  <varlistentry>
1809   <term>Type of value:</term>
1810   <listitem>
1811    <para>0 or 1</para>
1812   </listitem>
1813  </varlistentry>
1814  <varlistentry>
1815   <term>Default value:</term>
1816   <listitem>
1817    <para>1</para>
1818   </listitem>
1819  </varlistentry>
1820  <varlistentry>
1821   <term>Effect if unset:</term>
1822   <listitem>
1823    <para>
1824     The web-based toggle feature is disabled.
1825    </para>
1826   </listitem>
1827  </varlistentry>
1828  <varlistentry>
1829   <term>Notes:</term>
1830   <listitem>
1831    <para>
1832     When toggled off, <application>Privoxy</application> acts like a normal,
1833     content-neutral proxy, i.e. it acts as if none of the actions applied to
1834     any URL.
1835    </para>
1836    <para>
1837     For the time being, access to the toggle feature can <emphasis>not</emphasis> be
1838     controlled separately by <quote>ACLs</quote> or HTTP authentication,
1839     so that everybody who can access <application>Privoxy</application> (see
1840     <quote>ACLs</quote> and <literal>listen-address</literal> above) can
1841     toggle it for all users. So this option is <emphasis>not recommended</emphasis>
1842     for multi-user environments with untrusted users.
1843    </para>
1844    <para>
1845     Note that you must have compiled <application>Privoxy</application> with
1846     support for this feature, otherwise this option has no effect. 
1847    </para>
1848   </listitem>
1849  </varlistentry>
1850 </variablelist>
1851 </sect3>
1852
1853
1854 <sect3 renderas="sect4" id="enable-edit-actions"><title>enable-edit-actions</title>
1855 <variablelist>
1856  <varlistentry>
1857   <term>Specifies:</term>
1858   <listitem>
1859    <para>
1860     Whether or not the <ulink url="http://config.privoxy.org/show-status">web-based actions
1861     file editor</ulink> may be used
1862    </para>
1863   </listitem>
1864  </varlistentry>
1865  <varlistentry>
1866   <term>Type of value:</term>
1867   <listitem>
1868    <para>0 or 1</para>
1869   </listitem>
1870  </varlistentry>
1871  <varlistentry>
1872   <term>Default value:</term>
1873   <listitem>
1874    <para>1</para>
1875   </listitem>
1876  </varlistentry>
1877  <varlistentry>
1878   <term>Effect if unset:</term>
1879   <listitem>
1880    <para>
1881     The web-based actions file editor is disabled.
1882    </para>
1883   </listitem>
1884  </varlistentry>
1885  <varlistentry>
1886   <term>Notes:</term>
1887   <listitem>
1888    <para>
1889     For the time being, access to the editor can <emphasis>not</emphasis> be
1890     controlled separately by <quote>ACLs</quote> or HTTP authentication,
1891     so that everybody who can access <application>Privoxy</application> (see
1892     <quote>ACLs</quote> and <literal>listen-address</literal> above) can
1893     modify its configuration for all users. So this option is <emphasis>not
1894     recommended</emphasis> for multi-user environments with untrusted users.
1895    </para>
1896    <para>
1897     Note that you must have compiled <application>Privoxy</application> with
1898     support for this feature, otherwise this option has no effect. 
1899    </para>
1900   </listitem>
1901  </varlistentry>
1902 </variablelist>
1903 </sect3>
1904
1905 <sect3 renderas="sect4" id="acls"><title>
1906 ACLs: permit-access and deny-access</title>
1907 <anchor id="permit-acces">
1908 <anchor id="deny-acces">
1909
1910 <variablelist>
1911  <varlistentry>
1912   <term>Specifies:</term>
1913   <listitem>
1914    <para>
1915     Who can access what.
1916    </para>
1917   </listitem>
1918  </varlistentry>
1919  <varlistentry>
1920   <term>Type of value:</term>
1921   <listitem>
1922    <para>
1923     <replaceable class="parameter">src_addr</replaceable>[/<replaceable class="parameter">src_masklen</replaceable>]
1924     [<replaceable class="parameter">dst_addr</replaceable>[/<replaceable class="parameter">dst_masklen</replaceable>]]
1925    </para>
1926    <para>
1927     Where <replaceable class="parameter">src_addr</replaceable> and 
1928    <replaceable class="parameter">dst_addr</replaceable> are IP addresses in dotted decimal notation or valid
1929     DNS names, and <replaceable class="parameter">src_masklen</replaceable> and
1930     <replaceable class="parameter">dst_masklen</replaceable> are subnet masks in CIDR notation, i.e. integer
1931     values from 2 to 30 representing the length (in bits) of the network address. The masks and the whole
1932     destination part are optional.
1933    </para>
1934   </listitem>
1935  </varlistentry>
1936  <varlistentry>
1937   <term>Default value:</term>
1938   <listitem>
1939    <para><emphasis>Unset</emphasis></para>
1940   </listitem>
1941  </varlistentry>
1942  <varlistentry>
1943   <term>Effect if unset:</term>
1944   <listitem>
1945    <para>
1946     Don't restrict access further than implied by <literal>listen-address</literal>
1947    </para>
1948   </listitem>
1949  </varlistentry>
1950  <varlistentry>
1951   <term>Notes:</term>
1952   <listitem>
1953    <para>
1954     Access controls are included at the request of ISPs and systems
1955     administrators, and <emphasis>are not usually needed by individual users</emphasis>.
1956     For a typical home user, it will normally suffice to ensure that 
1957     <application>Privoxy</application> only listens on the localhost or internal (home)
1958     network address by means of the <literal>listen-address</literal> option.
1959    </para>
1960    <para>
1961     Please see the warnings in the FAQ that this proxy is not intended to be a substitute
1962     for a firewall or to encourage anyone to defer addressing basic security
1963     weaknesses.
1964    </para>
1965    <para>
1966     Multiple ACL lines are OK.
1967     If any ACLs are specified, then the <application>Privoxy</application>
1968     talks only to IP addresses that match at least one <literal>permit-access</literal> line
1969     and don't match any subsequent <literal>deny-access</literal> line. In other words, the
1970     last match wins, with the default being <literal>deny-access</literal>.
1971    </para>
1972    <para>
1973     If <application>Privoxy</application> is using a forwarder (see <literal>forward</literal> below)
1974     for a particular destination URL, the <replaceable class="parameter">dst_addr</replaceable>
1975     that is examined is the address of the forwarder and <emphasis>NOT</emphasis> the address
1976     of the ultimate target. This is necessary because it may be impossible for the local
1977     <application>Privoxy</application> to determine the IP address of the
1978     ultimate target (that's often what gateways are used for).
1979    </para>
1980    <para>
1981     You should prefer using IP addresses over DNS names, because the address lookups take
1982     time. All DNS names must resolve! You can <emphasis>not</emphasis> use domain patterns
1983     like <quote>*.org</quote> or partial domain names. If a DNS name resolves to multiple
1984     IP addresses, only the first one is used.
1985    </para>
1986    <para>
1987     Denying access to particular sites by ACL may have undesired side effects
1988     if the site in question is hosted on a machine which also hosts other sites.
1989    </para>
1990   </listitem>
1991  </varlistentry>
1992  <varlistentry>
1993   <term>Examples:</term>
1994   <listitem>
1995    <para>
1996     Explicitly define the default behavior if no ACL and
1997     <literal>listen-address</literal> are set: <quote>localhost</quote>
1998     is OK. The absence of a <replaceable class="parameter">dst_addr</replaceable> implies that
1999     <emphasis>all</emphasis> destination addresses are OK:
2000    </para>
2001    <para>
2002     <screen>
2003   permit-access  localhost
2004 </screen>
2005    </para>
2006    <para>
2007     Allow any host on the same class C subnet as www.privoxy.org access to
2008     nothing but www.example.com:
2009    </para>
2010    <para>
2011     <screen>
2012   permit-access  www.privoxy.org/24 www.example.com/32
2013 </screen>
2014    </para>
2015    <para>
2016     Allow access from any host on the 26-bit subnet 192.168.45.64 to anywhere,
2017     with the exception that 192.168.45.73 may not access www.dirty-stuff.example.com:
2018    </para>
2019    <para>
2020     <screen>
2021   permit-access  192.168.45.64/26
2022   deny-access    192.168.45.73    www.dirty-stuff.example.com
2023 </screen>
2024    </para>
2025   </listitem>
2026  </varlistentry>
2027 </variablelist>
2028 </sect3>
2029
2030 <sect3 renderas="sect4" id="buffer-limit"><title>buffer-limit</title>
2031
2032 <variablelist>
2033  <varlistentry>
2034   <term>Specifies:</term>
2035   <listitem>
2036    <para>
2037     Maximum size of the buffer for content filtering.
2038    </para>
2039   </listitem>
2040  </varlistentry>
2041  <varlistentry>
2042   <term>Type of value:</term>
2043   <listitem>
2044    <para>Size in Kbytes</para>
2045   </listitem>
2046  </varlistentry>
2047  <varlistentry>
2048   <term>Default value:</term>
2049   <listitem>
2050    <para>4096</para>
2051   </listitem>
2052  </varlistentry>
2053  <varlistentry>
2054   <term>Effect if unset:</term>
2055   <listitem>
2056    <para>
2057     Use a 4MB (4096 KB) limit.
2058    </para>
2059   </listitem>
2060  </varlistentry>
2061  <varlistentry>
2062   <term>Notes:</term>
2063   <listitem>
2064    <para>
2065     For content filtering, i.e. the <literal>+filter</literal> and
2066     <literal>+deanimate-gif</literal> actions, it is necessary that 
2067     <application>Privoxy</application> buffers the entire document body.
2068     This can be potentially dangerous, since a server could just keep sending
2069     data indefinitely and wait for your RAM to exhaust -- with nasty consequences.
2070     Hence this option.
2071    </para>
2072    <para>
2073     When a document buffer size reaches the <literal>buffer-limit</literal>, it is
2074     flushed to the client unfiltered and no further attempt to
2075     filter the rest of the document is made. Remember that there may be multiple threads
2076     running, which might require up to <literal>buffer-limit</literal> Kbytes
2077     <emphasis>each</emphasis>, unless you have enabled <quote>single-threaded</quote>
2078     above.
2079    </para>
2080   </listitem>
2081  </varlistentry>
2082 </variablelist>
2083 </sect3>
2084
2085 </sect2>
2086
2087 <!--  ~  End section  ~  -->
2088
2089
2090 <!--   ~~~~~       New section      ~~~~~     -->
2091
2092 <sect2 id="forwarding">
2093 <title>Forwarding</title>
2094
2095 <para>
2096  This feature allows routing of HTTP requests through a chain of
2097  multiple proxies.
2098  It can be used to better protect privacy and confidentiality when
2099  accessing specific domains by routing requests to those domains
2100  through an anonymous public proxy (see e.g. <ulink
2101  url="http://www.multiproxy.org/anon_list.htm">http://www.multiproxy.org/anon_list.htm</ulink>)
2102  Or to use a caching proxy to speed up browsing. Or chaining to a parent
2103  proxy may be necessary because the machine that <application>Privoxy</application>
2104  runs on has no direct Internet access.
2105 </para>
2106
2107 <para>
2108  Also specified here are SOCKS proxies. <application>Privoxy</application>
2109  supports the SOCKS 4 and SOCKS 4A protocols.
2110 </para>
2111
2112 <sect3 renderas="sect4" id="forward"><title>forward</title>
2113 <variablelist>
2114  <varlistentry>
2115   <term>Specifies:</term>
2116   <listitem>
2117    <para>
2118     To which parent HTTP proxy specific requests should be routed.
2119    </para>
2120   </listitem>
2121  </varlistentry>
2122  <varlistentry>
2123   <term>Type of value:</term>
2124   <listitem>
2125    <para>
2126     <replaceable class="parameter">target_domain</replaceable>[:<replaceable class="parameter">port</replaceable>]
2127     <replaceable class="parameter">http_parent</replaceable>[/<replaceable class="parameter">port</replaceable>]
2128    </para>
2129    <para>
2130     Where <replaceable class="parameter">target_domain</replaceable> is a domain name pattern (see the
2131     chapter on domain matching in the <filename>default.action</filename> file),
2132     <replaceable class="parameter">http_parent</replaceable> is the address of the parent HTTP proxy
2133     as an IP addresses in dotted decimal notation or as a valid DNS name (or <quote>.</quote> to denote
2134     <quote>no forwarding</quote>, and the optional 
2135     <replaceable class="parameter">port</replaceable> parameters are TCP ports, i.e. integer
2136     values from 1 to 64535
2137    </para>
2138   </listitem>
2139  </varlistentry>
2140  <varlistentry>
2141   <term>Default value:</term>
2142   <listitem>
2143    <para><emphasis>Unset</emphasis></para>
2144   </listitem>
2145  </varlistentry>
2146  <varlistentry>
2147   <term>Effect if unset:</term>
2148   <listitem>
2149    <para>
2150     Don't use parent HTTP proxies.
2151    </para>
2152   </listitem>
2153  </varlistentry>
2154  <varlistentry>
2155   <term>Notes:</term>
2156   <listitem>
2157    <para>
2158     If <replaceable class="parameter">http_parent</replaceable> is <quote>.</quote>, then requests are not
2159     forwarded to another HTTP proxy but are made directly to the web servers.
2160    </para>
2161    <para>
2162     Multiple lines are OK, they are checked in sequence, and the last match wins.
2163    </para>
2164   </listitem>
2165  </varlistentry>
2166  <varlistentry>
2167   <term>Examples:</term>
2168   <listitem>
2169    <para>
2170     Everything goes to an example anonymizing proxy, except SSL on port 443 (which it doesn't handle):
2171    </para>
2172    <para>
2173     <screen>
2174   forward   .*     anon-proxy.example.org:8080
2175   forward   :443   .
2176 </screen>
2177    </para>
2178    <para>
2179     Everything goes to our example ISP's caching proxy, except for requests
2180     to that ISP's sites:
2181    </para>
2182    <para>
2183     <screen>
2184   forward   .*.                caching-proxy.example-isp.net:8000
2185   forward   .example-isp.net   .
2186 </screen>
2187    </para>
2188   </listitem>
2189  </varlistentry>
2190 </variablelist>
2191 </sect3>
2192
2193 <sect3 renderas="sect4" id="socks"><title>
2194 forward-socks4 and forward-socks4a</title>
2195 <anchor id="forward-socks4">
2196 <anchor id="forward-socks4a">
2197
2198 <variablelist>
2199  <varlistentry>
2200   <term>Specifies:</term>
2201   <listitem>
2202    <para>
2203     Through which SOCKS proxy (and to which parent HTTP proxy) specific requests should be routed.
2204    </para>
2205   </listitem>
2206  </varlistentry>
2207  <varlistentry>
2208   <term>Type of value:</term>
2209   <listitem>
2210    <para>
2211     <replaceable class="parameter">target_domain</replaceable>[:<replaceable class="parameter">port</replaceable>]
2212     <replaceable class="parameter">socks_proxy</replaceable>[/<replaceable class="parameter">port</replaceable>]
2213     <replaceable class="parameter">http_parent</replaceable>[/<replaceable class="parameter">port</replaceable>]
2214    </para>
2215    <para>
2216     Where <replaceable class="parameter">target_domain</replaceable> is a domain name pattern (see the
2217     chapter on domain matching in the <filename>default.action</filename> file),
2218     <replaceable class="parameter">http_parent</replaceable> and <replaceable class="parameter">socks_proxy</replaceable>
2219     are IP addresses in dotted decimal notation or valid DNS names (<replaceable class="parameter">http_parent</replaceable>
2220     may be <quote>.</quote> to denote <quote>no HTTP forwarding</quote>), and the optional 
2221     <replaceable class="parameter">port</replaceable> parameters are TCP ports, i.e. integer values from 1 to 64535
2222    </para>
2223   </listitem>
2224  </varlistentry>
2225  <varlistentry>
2226   <term>Default value:</term>
2227   <listitem>
2228    <para><emphasis>Unset</emphasis></para>
2229   </listitem>
2230  </varlistentry>
2231  <varlistentry>
2232   <term>Effect if unset:</term>
2233   <listitem>
2234    <para>
2235     Don't use SOCKS proxies.
2236    </para>
2237   </listitem>
2238  </varlistentry>
2239  <varlistentry>
2240   <term>Notes:</term>
2241   <listitem>
2242    <para>
2243     Multiple lines are OK, they are checked in sequence, and the last match wins.
2244    </para>
2245    <para>
2246     The difference between <literal>forward-socks4</literal> and <literal>forward-socks4a</literal>
2247     is that in the SOCKS 4A protocol, the DNS resolution of the target hostname happens on the SOCKS
2248     server, while in SOCKS 4 it happens locally.
2249    </para>
2250    <para>
2251     If <replaceable class="parameter">http_parent</replaceable> is <quote>.</quote>, then requests are not
2252     forwarded to another HTTP proxy but are made (HTTP-wise) directly to the web servers, albeit through
2253     a SOCKS proxy.
2254    </para>
2255   </listitem>
2256  </varlistentry>
2257  <varlistentry>
2258   <term>Examples:</term>
2259   <listitem>
2260    <para>
2261      From the company example.com, direct connections are made to all
2262      <quote>internal</quote> domains, but everything outbound goes through
2263      their ISP's proxy by way of example.com's corporate SOCKS 4A gateway to
2264      the Internet.
2265    </para>
2266    <para>
2267     <screen>
2268   forward-socks4a   .*.            socks-gw.example.com:1080  www-cache.example-isp.net:8080
2269   forward           .example.com   .
2270 </screen>
2271    </para>
2272    <para>
2273     A rule that uses a SOCKS 4 gateway for all destinations but no HTTP parent looks like this:
2274    </para>
2275    <para>
2276     <screen>
2277   forward-socks4   .*.            socks-gw.example.com:1080  .
2278 </screen>
2279    </para>
2280   </listitem>
2281  </varlistentry>
2282 </variablelist>
2283 </sect3>
2284
2285 <sect3 renderas="sect4" id="advanced-forwarding-examples"><title>Advanced Forwarding Examples</title>
2286
2287 <para>
2288  If you have links to multiple ISPs that provide various special content 
2289  only to their subscribers, you can configure multiple <application>Privoxies</application>
2290  which have connections to the respective ISPs to act as forwarders to each other, so that
2291  <emphasis>your</emphasis> users can see the internal content of all ISPs.
2292 </para>
2293
2294 <para>
2295  Assume that host-a has a PPP connection to isp-a.net. And host-b has a PPP connection to
2296  isp-b.net. Both run <application>Privoxy</application>. Their forwarding
2297  configuration can look like this:
2298 </para>
2299
2300 <para>
2301  host-a:
2302 </para>
2303
2304 <para>
2305  <screen>
2306   forward    .*.         .
2307   forward    .isp-b.net  host-b:8118
2308 </screen>
2309 </para>
2310
2311 <para>
2312  host-b:
2313 </para>
2314
2315 <para>
2316  <screen>
2317   forward    .*.         .
2318   forward    .isp-a.net  host-a:8118
2319 </screen>
2320 </para>
2321
2322 <para>
2323  Now, your users can set their browser's proxy to use either
2324  host-a or host-b and be able to browse the internal content
2325  of both isp-a and isp-b.
2326 </para>
2327
2328 <para>
2329  If you intend to chain <application>Privoxy</application> and 
2330  <application>squid</application> locally, then chain as 
2331  <literal>browser -> squid -> privoxy</literal> is the recommended way. 
2332 </para>
2333
2334 <para>
2335  Assuming that <application>Privoxy</application> and <application>squid</application>
2336  run on the same box, your squid configuration could then look like this:
2337 </para>
2338
2339 <para>
2340  <screen>
2341   # Define Privoxy as parent proxy (without ICP) 
2342   cache_peer 127.0.0.1 parent 8118 7 no-query 
2343
2344   # Define ACL for protocol FTP 
2345   acl ftp proto FTP 
2346
2347   # Do not forward FTP requests to Privoxy
2348   always_direct allow ftp 
2349
2350   # Forward all the rest to Privoxy
2351   never_direct allow all</screen>
2352 </para>
2353
2354 <para>
2355  You would then need to change your browser's proxy settings to <application>squid</application>'s address and port.
2356  Squid normally uses port 3128. If unsure consult <literal>http_port</literal> in <filename>squid.conf</filename>.
2357 </para>
2358
2359 </sect3>
2360
2361 </sect2>
2362
2363 <!--  ~  End section  ~  -->
2364
2365
2366 <!--   ~~~~~       New section      ~~~~~     -->
2367
2368 <sect2 id="windows-gui">
2369 <title>Windows GUI Options</title>
2370 <para>
2371  <application>Privoxy</application> has a number of options specific to the
2372  Windows GUI interface:
2373 </para>
2374
2375 <anchor id="activity-animation">
2376 <para>
2377  If <quote>activity-animation</quote> is set to 1, the
2378  <application>Privoxy</application> icon will animate when
2379  <quote>Privoxy</quote> is active. To turn off, set to 0.
2380 </para>
2381
2382 <para>
2383  <literal>
2384   <msgtext> 
2385    <literallayout>
2386   <emphasis>activity-animation   1</emphasis>
2387    </literallayout>
2388   </msgtext> 
2389  </literal>
2390 </para>
2391
2392 <anchor id="log-messages">
2393 <para>
2394  If <quote>log-messages</quote> is set to 1,
2395  <application>Privoxy</application> will log messages to the console
2396  window:
2397 </para>
2398
2399 <para>
2400  <literal>
2401   <msgtext> 
2402    <literallayout>
2403   <emphasis>log-messages       1</emphasis>
2404    </literallayout>
2405   </msgtext> 
2406  </literal>
2407 </para>
2408
2409 <anchor id="log-buffer-size">
2410 <para> 
2411  If <quote>log-buffer-size</quote> is set to 1, the size of the log buffer,
2412  i.e. the amount of memory used for the log messages displayed in the
2413  console window, will be limited to <quote>log-max-lines</quote> (see below).
2414 </para>
2415
2416 <para>
2417  Warning: Setting this to 0 will result in the buffer to grow infinitely and
2418  eat up all your memory!
2419 </para>
2420
2421 <para>
2422  <literal>
2423   <msgtext> 
2424    <literallayout>
2425   <emphasis>log-buffer-size      1</emphasis>
2426    </literallayout>
2427   </msgtext> 
2428  </literal>
2429 </para>
2430
2431 <anchor id="log-max-lines">
2432 <para>
2433  <application>log-max-lines</application> is the maximum number of lines held
2434  in the log buffer. See above.
2435 </para>
2436
2437 <para>
2438  <literal>
2439   <msgtext> 
2440    <literallayout>
2441   <emphasis>log-max-lines      200</emphasis>
2442    </literallayout>
2443   </msgtext> 
2444  </literal>
2445 </para>
2446
2447 <anchor id="log-highlight-messages">
2448 <para>
2449  If <quote>log-highlight-messages</quote> is set to 1,
2450  <application>Privoxy</application> will highlight portions of the log
2451  messages with a bold-faced font:
2452 </para>
2453
2454 <para>
2455  <literal>
2456   <msgtext> 
2457    <literallayout>
2458   <emphasis>log-highlight-messages   1</emphasis>
2459    </literallayout>
2460   </msgtext> 
2461  </literal>
2462 </para>
2463
2464 <anchor id="log-font-name">
2465 <para>
2466  The font used in the console window:
2467 </para>
2468
2469 <para>
2470  <literal>
2471   <msgtext> 
2472    <literallayout>
2473   <emphasis>log-font-name        Comic Sans MS</emphasis>
2474    </literallayout>
2475   </msgtext> 
2476  </literal>
2477 </para>
2478
2479 <anchor id="log-font-size">
2480 <para>
2481  Font size used in the console window:
2482 </para>
2483
2484 <para>
2485  <literal>
2486   <msgtext> 
2487    <literallayout>
2488   <emphasis>log-font-size        8</emphasis>
2489    </literallayout>
2490   </msgtext> 
2491  </literal>
2492 </para>
2493
2494 <anchor id="show-on-task-bar">
2495 <para>  
2496  <quote>show-on-task-bar</quote> controls whether or not
2497  <application>Privoxy</application> will appear as a button on the Task bar
2498  when minimized:
2499 </para>
2500
2501 <para>
2502  <literal>
2503   <msgtext> 
2504    <literallayout>
2505   <emphasis>show-on-task-bar     0</emphasis>
2506    </literallayout>
2507   </msgtext> 
2508  </literal>
2509 </para>
2510
2511 <anchor id="close-button-minimizes">
2512 <para>
2513  If <quote>close-button-minimizes</quote> is set to 1, the Windows close
2514  button will minimize <application>Privoxy</application> instead of closing
2515  the program (close with the exit option on the File menu).
2516 </para>
2517
2518 <para>
2519  <literal>
2520   <msgtext> 
2521    <literallayout>
2522   <emphasis>close-button-minimizes  1</emphasis>
2523    </literallayout>
2524   </msgtext> 
2525  </literal>
2526 </para>
2527
2528 <anchor id="hide-console">
2529 <para>
2530  The <quote>hide-console</quote> option is specific to the MS-Win console
2531  version of <application>Privoxy</application>. If this option is used,
2532  <application>Privoxy</application> will disconnect from and hide  the
2533  command console.
2534 </para>
2535
2536 <para>
2537  <literal>
2538   <msgtext> 
2539    <literallayout>
2540   #<emphasis>hide-console</emphasis>
2541    </literallayout>
2542   </msgtext> 
2543  </literal>
2544 </para>
2545
2546 </sect2>
2547 </sect1>
2548
2549 <!--  ~  End section  ~  -->
2550
2551
2552
2553 <!--   ~~~~~~~~       New section Header    ~~~~~~~~~     -->
2554
2555 <sect1 id="actions-file"><title>Actions Files</title>
2556
2557 <para>
2558  The actions files are used to define what actions
2559  <application>Privoxy</application> takes for which URLs, and thus determines
2560  how ad images, cookies and various other aspects of HTTP content and
2561  transactions are handled, and on which sites (or even parts thereof). There 
2562  are three such files included with <application>Privoxy</application>, 
2563  with slightly different purposes. <filename>default.action</filename> sets
2564  the default policies. <filename>standard.action</filename> is used by 
2565  <application>Privoxy</application> and the web based editor to set 
2566  pre-defined values (and normally should not be edited). Local exceptions 
2567  are best done in <filename>user.action</filename>. The content of these 
2568  can all be viewed and edited from <ulink
2569  url="http://config.privoxy.org/show-status">http://config.privoxy.org/show-status</ulink>.
2570  </para>
2571
2572 <para> 
2573  Anything you want can be blocked, including ads, banners, or just some obnoxious
2574  URL that you would rather not see is done here. Cookies can be accepted or rejected, or
2575  accepted only during the current browser session (i.e. not written to disk),
2576  content can be modified, JavaScripts tamed, user-tracking fooled, and much more.
2577  See below for a complete list of available actions.
2578 </para>
2579
2580 <para>
2581  An actions file typically has sections. Near the top, <quote>aliases</quote> are 
2582  optionally defined (discussed <ulink
2583  url="actions-file.html#ALIASES">below</ulink>), then the default set of rules
2584  which will apply universally to all sites and pages. And then below that,
2585  exceptions to the defined universal policies. 
2586 </para>
2587
2588 <!--   ~~~~~       New section      ~~~~~     -->
2589 <sect2>
2590 <title>Finding the Right Mix</title>
2591 <para>
2592  Note that some <link linkend="actions">actions</link>, like cookie suppression
2593  or script disabling, may render some sites unusable that rely on these
2594  techniques to work properly. Finding the right mix of actions is not always easy and
2595  certainly a matter of personal taste. In general, it can be said that the more
2596  <quote>aggressive</quote> your default settings (in the top section of the
2597  actions file) are, the more exceptions for <quote>trusted</quote> sites you
2598  will have to make later. If, for example, you want to kill popup windows per
2599  default, you'll have to make exceptions from that rule for sites that you
2600  regularly use and that require popups for actually useful content, like maybe
2601  your bank, favorite shop, or newspaper.
2602 </para>
2603
2604 <para>
2605  We have tried to provide you with reasonable rules to start from in the
2606  distribution actions files. But there is no general rule of thumb on these
2607  things. There just are too many variables, and sites are constantly changing.
2608  Sooner or later you will want to change the rules (and read this chapter again :).
2609 </para>
2610 </sect2>
2611
2612 <!--   ~~~~~       New section      ~~~~~     -->
2613 <sect2>
2614 <title>How to Edit</title>
2615 <para>
2616  The easiest way to edit the <quote>actions</quote> files is with a browser by
2617  using our browser-based editor, which can be reached from <ulink
2618  url="http://config.privoxy.org/show-status">http://config.privoxy.org/show-status</ulink>.
2619 </para>
2620
2621 <para>
2622  If you prefer plain text editing to GUIs, you can of course also directly edit the
2623  the actions files.
2624 </para>
2625 </sect2>
2626
2627
2628 <sect2>
2629 <title>How Actions are Applied to URLs</title>
2630 <para>
2631  Actions files are divided into sections. There are special sections,
2632  like the <quote><link linkend="aliases">alias</link></quote> sections which will be discussed later. For now
2633  let's concentrate on regular sections: They have a heading line (often split
2634  up to multiple lines for readability) which consist of a list of actions,
2635  separated by whitespace and enclosed in curly braces. Below that, there
2636  is a list of URL patterns, each on a separate line.
2637 </para>
2638
2639 <para>
2640  To determine which actions apply to a request, the URL of the request is
2641  compared to all patterns in this file. Every time it matches, the list of
2642  applicable actions for the URL is incrementally updated, using the heading
2643  of the section in which the pattern is located. If multiple matches for
2644  the same URL set the same action differently, the last match wins. If not, 
2645  the effects are aggregated (e.g. a URL might match both the 
2646  <ulink url="actions-file.html#HANDLE-AS-IMAGE"><quote>+handle-as-image</quote></ulink>
2647  and <ulink url="actions-file.html#BLOCK"><quote>+block</quote></ulink> actions).
2648  
2649 </para>
2650
2651 <para>
2652  You can trace this process by visiting <ulink
2653  url="http://config.privoxy.org/show-url-info">http://config.privoxy.org/show-url-info</ulink>.
2654 </para>
2655
2656 <para>
2657  More detail on this is provided in the Appendix, <link linkend="ACTIONSANAT">
2658  Anatomy of an Action</link>.
2659 </para>
2660 </sect2>
2661
2662 <!--   ~~~~~       New section      ~~~~~     -->
2663 <sect2>
2664 <title>Patterns</title>
2665 <para>
2666  Generally, a pattern has the form <literal>&lt;domain&gt;/&lt;path&gt;</literal>,
2667  where both the <literal>&lt;domain&gt;</literal> and <literal>&lt;path&gt;</literal>
2668  are optional. (This is why the pattern <literal>/</literal> matches all URLs).
2669 </para>
2670
2671 <variablelist>
2672  <varlistentry>
2673   <term><literal>www.example.com/</literal></term>
2674   <listitem>
2675    <para>
2676     is a domain-only pattern and will match any request to <literal>www.example.com</literal>,
2677     regardless of which document on that server is requested.
2678    </para>
2679   </listitem>
2680  </varlistentry>
2681  <varlistentry>
2682   <term><literal>www.example.com</literal></term>
2683   <listitem>
2684    <para>
2685     means exactly the same. For domain-only patterns, the trailing <literal>/</literal> may
2686     be omitted.
2687    </para>
2688   </listitem>
2689  </varlistentry>
2690  <varlistentry>
2691   <term><literal>www.example.com/index.html</literal></term>
2692   <listitem>
2693    <para>
2694     matches only the single document <literal>/index.html</literal>
2695     on <literal>www.example.com</literal>.
2696    </para>
2697   </listitem>
2698  </varlistentry>
2699  <varlistentry>
2700   <term><literal>/index.html</literal></term>
2701   <listitem>
2702    <para>
2703     matches the document <literal>/index.html</literal>, regardless of the domain,
2704     i.e. on <emphasis>any</emphasis> web server.
2705    </para>
2706   </listitem>
2707  </varlistentry>
2708  <varlistentry>
2709   <term><literal>index.html</literal></term>
2710   <listitem>
2711    <para>
2712     matches nothing, since it would be  interpreted as a domain name and
2713     there is no top-level domain called <literal>.html</literal>.
2714    </para>
2715   </listitem>
2716  </varlistentry>
2717 </variablelist>
2718
2719
2720 <!--   ~~~~~       New section      ~~~~~     -->
2721 <sect3><title>The Domain Pattern</title>
2722
2723 <para>
2724  The matching of the domain part offers some flexible options: if the
2725  domain starts or ends with a dot, it becomes unanchored at that end. 
2726  For example:
2727 </para>
2728
2729 <variablelist>
2730  <varlistentry>
2731   <term><literal>.example.com</literal></term>
2732   <listitem>
2733    <para>
2734     matches any domain that <emphasis>ENDS</emphasis> in
2735     <literal>.example.com</literal>
2736    </para>
2737   </listitem>
2738  </varlistentry>
2739  <varlistentry>
2740   <term><literal>www.</literal></term>
2741   <listitem>
2742    <para>
2743     matches any domain that <emphasis>STARTS</emphasis> with
2744     <literal>www.</literal>
2745    </para>
2746   </listitem>
2747  </varlistentry>
2748  <varlistentry>
2749   <term><literal>.example.</literal></term>
2750   <listitem>
2751    <para>
2752     matches any domain that <emphasis>CONTAINS</emphasis> <literal>.example.</literal>
2753     (Correctly speaking: It matches any FQDN that contains <literal>example</literal> as a domain.)
2754    </para>
2755   </listitem>
2756  </varlistentry>
2757 </variablelist>
2758
2759 <para>
2760  Additionally, there are wild-cards that you can use in the domain names
2761  themselves. They work pretty similar to shell wild-cards: <quote>*</quote>
2762  stands for zero or more arbitrary characters, <quote>?</quote> stands for
2763  any single character, you can define character classes in square
2764  brackets and all of that can be freely mixed:
2765 </para>
2766
2767 <variablelist>
2768  <varlistentry>
2769   <term><literal>ad*.example.com</literal></term>
2770   <listitem>
2771    <para>
2772     matches <quote>adserver.example.com</quote>, 
2773     <quote>ads.example.com</quote>, etc but not <quote>sfads.example.com</quote>
2774    </para>
2775   </listitem>
2776  </varlistentry>
2777  <varlistentry>
2778   <term><literal>*ad*.example.com</literal></term>
2779   <listitem>
2780    <para>
2781     matches all of the above, and then some.
2782    </para>
2783   </listitem>
2784  </varlistentry>
2785  <varlistentry>
2786   <term><literal>.?pix.com</literal></term>
2787   <listitem>
2788    <para>
2789     matches <literal>www.ipix.com</literal>,
2790     <literal>pictures.epix.com</literal>, <literal>a.b.c.d.e.upix.com</literal> etc. 
2791    </para>
2792   </listitem>
2793  </varlistentry>
2794  <varlistentry>
2795   <term><literal>www[1-9a-ez].example.c*</literal></term>
2796   <listitem>
2797    <para>
2798      matches <literal>www1.example.com</literal>, 
2799      <literal>www4.example.cc</literal>, <literal>wwwd.example.cy</literal>, 
2800      <literal>wwwz.example.com</literal> etc., but <emphasis>not</emphasis> 
2801      <literal>wwww.example.com</literal>.
2802    </para>
2803   </listitem>
2804  </varlistentry>
2805 </variablelist>
2806
2807 </sect3>
2808
2809 <!--  ~  End section  ~  -->
2810
2811
2812 <!--   ~~~~~       New section      ~~~~~     -->
2813 <sect3><title>The Path Pattern</title>
2814
2815 <para>
2816  <application>Privoxy</application> uses Perl compatible regular expressions
2817  (through the <ulink url="http://www.pcre.org/">PCRE</ulink> library) for
2818  matching the path.
2819 </para>
2820
2821 <para>
2822  There is an <link linkend="regex">Appendix</link> with a brief quick-start into regular
2823  expressions, and full (very technical) documentation on PCRE regex syntax is available on-line
2824  at <ulink url="http://www.pcre.org/man.txt">http://www.pcre.org/man.txt</ulink>.
2825  You might also find the Perl man page on regular expressions (<literal>man perlre</literal>)
2826  useful, which is available on-line at <ulink
2827  url="http://www.perldoc.com/perl5.6/pod/perlre.html">http://www.perldoc.com/perl5.6/pod/perlre.html</ulink>.
2828 </para>
2829
2830 <para>
2831  Note that the path pattern is automatically left-anchored at the <quote>/</quote>,
2832  i.e. it matches as if it would start with a <quote>^</quote> (regular expression speak 
2833  for the beginning of a line).
2834 </para>
2835
2836 <para>
2837  Please also note that matching in the path is case
2838  <emphasis>INSENSITIVE</emphasis> by default, but you can switch to case
2839  sensitive at any point in the pattern by using the 
2840  <quote>(?-i)</quote> switch:
2841  <literal>www.example.com/(?-i)PaTtErN.*</literal> will match only
2842  documents whose path starts with <literal>PaTtErN</literal> in
2843  <emphasis>exactly</emphasis> this capitalization.
2844 </para>
2845 </sect3>
2846
2847 </sect2>
2848
2849 <!--  ~  End section  ~  -->
2850
2851
2852 <!--   ~~~~~       New section      ~~~~~     -->
2853
2854 <sect2 id="actions">
2855 <title>Actions</title>
2856 <para>
2857  All actions are disabled by default, until they are explicitly enabled
2858  somewhere in an actions file. Actions are turned on if preceded with a
2859  <quote>+</quote>, and turned off if preceded with a <quote>-</quote>. So a
2860  <quote>+action</quote> means <quote>do that action</quote>, e.g.
2861  <quote>+block</quote> means please <quote>block the following URL
2862  patterns</quote>. 
2863 </para>
2864
2865 <para> 
2866  Actions are invoked by enclosing the action name in curly braces (e.g.
2867  {+some_action}), followed by a list of URLs (or patterns that match URLs) to
2868  which the action applies. There are three classes of actions: 
2869 </para>
2870
2871 <para>
2872  <itemizedlist>
2873
2874  <listitem>
2875   <para>  
2876    Boolean, i.e the action can only be <quote>on</quote> or
2877    <quote>off</quote>. Examples: 
2878  </para>
2879   <para>
2880    <literal>
2881     <msgtext> 
2882      <literallayout>
2883   <emphasis>{+name}</emphasis>        # enable this action
2884   <emphasis>{-name}</emphasis>        # disable this action
2885      </literallayout>
2886     </msgtext> 
2887    </literal>
2888   </para>
2889  </listitem>
2890
2891
2892  <listitem>
2893   <para>  
2894    Parameterized, e.g. <quote>+/-hide-user-agent{ Mozilla 1.0 }</quote>, 
2895    where some value is required in order to enable this type of action.
2896    Examples:
2897   </para>
2898   <para>
2899    <literal>
2900     <msgtext> 
2901      <literallayout>
2902   <emphasis>{+name{param}}</emphasis>  # enable action and set parameter to <quote>param</quote>
2903   <emphasis>{-name}</emphasis>         # disable action (<quote>parameter</quote>) can be omitted
2904      </literallayout>
2905     </msgtext> 
2906    </literal>
2907   </para>
2908  </listitem>
2909  
2910  <listitem>
2911   <para>  
2912   <!-- oes, or someone, check this. Re-worded 04/20/02 HB. -->
2913    Multi-value, e.g. <quote>{+/-add-header{Name: value}}</quote> or
2914    <quote>{+/-send-wafer{name=value}}</quote>), where some value needs to be defined
2915    in addition to simply enabling the action. Examples:
2916   </para>
2917   <para>
2918    <literal>
2919     <msgtext> 
2920      <literallayout>
2921   <emphasis>{+name{param=value}}</emphasis>   # enable action and set <quote>param</quote> to <quote>value</quote>
2922   <emphasis>{-name{param=value}}</emphasis>   # remove the parameter <quote>param</quote> completely
2923   <emphasis>{-name}</emphasis>                # disable this action totally and remove <application>param</application> too
2924      </literallayout>
2925     </msgtext> 
2926    </literal>
2927   </para>
2928  </listitem>
2929
2930  </itemizedlist>
2931 </para>
2932
2933 <para>
2934  If nothing is specified in any actions file, no <quote>actions</quote> are
2935  taken. So in this case <application>Privoxy</application> would just be a
2936  normal, non-blocking, non-anonymizing proxy. You must specifically enable the
2937  privacy and blocking features you need (although the provided default actions
2938  files will give a good starting point).
2939 </para>
2940
2941 <para>
2942  Later defined actions always over-ride earlier ones.  So exceptions 
2943  to any rules you make, should come in the latter part of the file (or 
2944  in a file that is processed later when using multiple actions files). For
2945  multi-valued actions, the actions are applied in the order they are specified.
2946  Actions files are processed in the order they are defined in
2947  <filename>config</filename> (the default installation has three actions
2948  files). It also quite possible for any given URL pattern to match more than
2949  one action!
2950 </para>
2951
2952 <!-- start actions listing -->
2953 <para>
2954  The list of valid <application>Privoxy</application> <quote>actions</quote> are:
2955 </para>
2956
2957
2958 <!-- ********************************************************** -->
2959 <!-- Please note the below defined actions use id's that are    -->
2960 <!-- probably linked from other places, so please don't change. -->
2961 <!--                                                            -->
2962 <!-- ********************************************************** -->
2963
2964
2965 <!--   ~~~~~       New section      ~~~~~     -->
2966
2967 <sect3 renderas="sect4" id="add-header">
2968 <title><emphasis>+add-header</emphasis></title>
2969
2970 <variablelist>
2971  <varlistentry>
2972   <term>Type:</term>
2973   <!-- boolean, parameterized, Multi-value -->
2974   <listitem>
2975    <para>Multi-value.</para>
2976   </listitem>
2977  </varlistentry>
2978  
2979  <varlistentry>
2980   <term>Typical uses:</term>
2981   <listitem>
2982    <para>
2983     Send a user defined HTTP header to the web server.
2984    </para>
2985   </listitem>
2986  </varlistentry>
2987
2988  <varlistentry>
2989   <term>Possible values:</term>
2990   <listitem>
2991    <para>
2992     Any value is possible. Validity of the defined HTTP headers is not checked.
2993    </para>
2994   </listitem>
2995  </varlistentry>
2996  
2997  <varlistentry>
2998   <term>Example usage:</term>
2999   <listitem>
3000     <literallayout>
3001      <emphasis>{+add-header{X-User-Tracking: sucks}}</emphasis>
3002      <emphasis>.example.com</emphasis>
3003     </literallayout>
3004   </listitem>
3005  </varlistentry>
3006
3007 <varlistentry>
3008   <term>Notes:</term>
3009   <listitem>
3010    <para>
3011     This action may be specified multiple times, in order to define multiple 
3012     headers. This is rarely needed for the typical user. If you don't know what 
3013     <quote>HTTP headers</quote> are, you definitely don't need to worry about this 
3014     one.
3015    </para>
3016   </listitem>
3017  </varlistentry>
3018 </variablelist>
3019 </sect3>
3020
3021
3022 <!--   ~~~~~       New section      ~~~~~     -->
3023 <sect3 renderas="sect4" id="block">
3024 <title><emphasis>+block</emphasis></title>
3025
3026 <variablelist>
3027  <varlistentry>
3028   <term>Type:</term>
3029   <!-- boolean, parameterized, Multi-value -->
3030   <listitem>
3031    <para>Boolean.</para>
3032   </listitem>
3033  </varlistentry>
3034
3035  <varlistentry>
3036   <term>Typical uses:</term>
3037   <listitem>
3038    <para>
3039     Used to block a URL from reaching your browser. The URL may be 
3040     anything, but is typically used to block ads or other obnoxious 
3041     content.    
3042    </para>
3043   </listitem>
3044  </varlistentry>
3045
3046  <varlistentry>
3047   <term>Possible values:</term>
3048   <listitem>
3049    <para>N/A</para>
3050   </listitem>
3051  </varlistentry>
3052  
3053  <varlistentry>
3054   <term>Example usage:</term>
3055   <listitem>
3056     <literallayout>
3057      <emphasis>{+block}</emphasis>
3058      <emphasis>.banners.example.com</emphasis>
3059      <emphasis>.ads.r.us</emphasis>
3060     </literallayout>
3061   </listitem>
3062  </varlistentry>
3063
3064 <varlistentry>
3065   <term>Notes:</term>
3066   <listitem>
3067    <para>
3068     If a URL matches one of the blocked patterns, <application>Privoxy</application>
3069     will intercept the URL and display its special <quote>BLOCKED</quote> page
3070     instead. If there is sufficient space, a large red banner will appear with
3071     a friendly message about why the page was blocked, and a way to go there
3072     anyway. If there is insufficient space a smaller <quote>BLOCKED</quote>
3073     page will appear without the red banner. 
3074     <ulink url="http://ads.bannerserver.example.com/nasty-ads/sponsor.html">Click here</ulink>
3075     to view the default blocked HTML page (<application>Privoxy</application> must be running 
3076     for this to work as intended!).
3077    </para>
3078
3079    <para> 
3080     A very important exception is if the URL <emphasis>matches both</emphasis>
3081     <quote>+block</quote> and <ulink
3082     url="actions-file.html#HANDLE-AS-IMAGE"><quote>+handle-as-image</quote></ulink>,
3083     then it will be handled by 
3084     <ulink url="actions-file.html#SET-IMAGE-BLOCKER"><quote>+set-image-blocker</quote></ulink>
3085     (see below). It is important to understand this process, in order 
3086     to understand how <application>Privoxy</application> is able to deal with 
3087     ads and other objectionable content.
3088    </para>
3089    <para>
3090     The <ulink url="actions-file.html#FILTER"><quote>+filter</quote></ulink>
3091     action can also perform some of the 
3092     same functionality as <quote>+block</quote>, but by virtue of very 
3093     different programming techniques, and is most often used for different 
3094     reasons.
3095    </para>
3096   </listitem>
3097  </varlistentry>
3098
3099 </variablelist>
3100 </sect3>
3101
3102
3103 <!--   ~~~~~       New section      ~~~~~     -->
3104 <sect3 renderas="sect4" id="deanimate-gifs">
3105 <title><emphasis>+deanimate-gifs</emphasis></title>
3106
3107 <variablelist>
3108  <varlistentry>
3109   <term>Type:</term>
3110   <!-- boolean, parameterized, Multi-value -->
3111   <listitem>
3112    <para>Parameterized.</para>
3113   </listitem>
3114  </varlistentry>
3115
3116  <varlistentry>
3117   <term>Typical uses:</term>
3118   <listitem>
3119    <para>
3120     To stop those annoying, distracting animated GIF images.
3121    </para>
3122   </listitem>
3123  </varlistentry>
3124
3125  <varlistentry>
3126   <term>Possible values:</term>
3127   <listitem>
3128    <para>
3129     <quote>last</quote> or <quote>first</quote>
3130    </para>
3131   </listitem>
3132  </varlistentry>
3133  
3134  <varlistentry>
3135   <term>Example usage:</term>
3136   <listitem>
3137     <literallayout>
3138       <emphasis>{+deanimate-gifs{last}}</emphasis>
3139       <emphasis>.example.com</emphasis>
3140     </literallayout>
3141   </listitem>
3142  </varlistentry>
3143
3144  <varlistentry>
3145   <term>Notes:</term>
3146   <listitem>
3147    <para>
3148     De-animate all animated GIF images, i.e. reduce them to their last frame.
3149     This will also shrink the images considerably (in bytes, not pixels!). If
3150     the option <quote>first</quote> is given, the first frame of the animation
3151     is used as the replacement. If <quote>last</quote> is given, the last
3152     frame of the animation is used instead, which probably makes more sense for
3153     most banner animations, but also has the risk of not showing the entire
3154     last frame (if it is only a delta to an earlier frame).
3155    </para>
3156   </listitem>
3157  </varlistentry>
3158
3159 </variablelist>
3160 </sect3>
3161
3162 <!--   ~~~~~       New section      ~~~~~     -->
3163 <sect3 renderas="sect4" id="downgrade-http-version">
3164 <title><emphasis>+downgrade-http-version</emphasis></title>
3165
3166 <variablelist>
3167  <varlistentry>
3168   <term>Type:</term>
3169   <!-- boolean, parameterized, Multi-value -->
3170   <listitem>
3171    <para>Boolean.</para>
3172   </listitem>
3173  </varlistentry>
3174
3175  <varlistentry>
3176   <term>Typical uses:</term>
3177   <listitem>
3178    <para>
3179     <quote>+downgrade-http-version</quote> will downgrade HTTP/1.1 client requests to
3180     HTTP/1.0 and downgrade the responses as well.
3181    </para>
3182   </listitem>
3183  </varlistentry>
3184
3185  <varlistentry>
3186   <term>Possible values:</term>
3187   <listitem>
3188    <para>
3189     N/A
3190    </para>
3191   </listitem>
3192  </varlistentry>
3193  
3194  <varlistentry>
3195   <term>Example usage:</term>
3196   <listitem>
3197     <literallayout>
3198      <emphasis>{+downgrade-http-version}</emphasis>
3199      <emphasis>.example.com</emphasis>
3200     </literallayout>
3201   </listitem>
3202  </varlistentry>
3203
3204  <varlistentry>
3205   <term>Notes:</term>
3206   <listitem>
3207    <para>
3208     Use this action for servers that use HTTP/1.1 protocol features that
3209     <application>Privoxy</application> doesn't handle well yet. HTTP/1.1 is
3210     only partially implemented. Default is not to downgrade requests. This is
3211     an infrequently needed action, and is used to help with rare problem sites only.
3212    </para>
3213   </listitem>
3214  </varlistentry>
3215
3216 </variablelist>
3217 </sect3>
3218
3219 <!--   ~~~~~       New section      ~~~~~     -->
3220 <sect3 renderas="sect4" id="fast-redirects">
3221 <title><emphasis>+fast-redirects</emphasis></title>
3222
3223 <variablelist>
3224  <varlistentry>
3225   <term>Type:</term>
3226   <!-- boolean, parameterized, Multi-value -->
3227   <listitem>
3228    <para>Boolean.</para>
3229   </listitem>
3230  </varlistentry>
3231
3232  <varlistentry>
3233   <term>Typical uses:</term>
3234   <listitem>
3235    <para>
3236     The <quote>+fast-redirects</quote> action enables interception of 
3237     <quote>redirect</quote> requests from one server to another, which 
3238     are used to track users.<application>Privoxy</application> can cut off
3239     all but the last valid URL in a redirect request and send a local redirect
3240     back to your browser without contacting the intermediate site(s).
3241    </para>
3242   </listitem>
3243  </varlistentry>
3244
3245  <varlistentry>
3246   <term>Possible values:</term>
3247   <listitem>
3248    <para>
3249     N/A
3250    </para>
3251   </listitem>
3252  </varlistentry>
3253  
3254  <varlistentry>
3255   <term>Example usage:</term>
3256   <listitem>
3257     <literallayout>
3258      <emphasis>{+fast-redirects}</emphasis>
3259      <emphasis>.example.com</emphasis>
3260     </literallayout>
3261   </listitem>
3262  </varlistentry>
3263
3264  <varlistentry>
3265   <term>Notes:</term>
3266   <listitem>
3267    <para>  
3268     Many sites, like yahoo.com, don't just link to other sites. Instead, they
3269     will link to some script on their own server, giving the destination as a
3270     parameter, which will then redirect you to the final target. URLs
3271     resulting from this scheme typically look like:
3272     <emphasis>http://some.place/some_script?http://some.where-else</emphasis>.
3273   </para>
3274    <para>
3275     Sometimes, there are even multiple consecutive redirects encoded in the
3276     URL. These redirections via scripts make your web browsing more traceable,
3277     since the server from which you follow such a link can see where you go
3278     to. Apart from that, valuable bandwidth and time is wasted, while your
3279     browser ask the server for one redirect after the other. Plus, it feeds
3280     the advertisers.
3281    </para>
3282    <para>
3283     This is a normally <quote>on</quote> feature, and often requires exceptions
3284     for sites that are sensitive to defeating this mechanism.
3285    </para>
3286   </listitem>
3287  </varlistentry>
3288
3289 </variablelist>
3290 </sect3>
3291
3292
3293 <!--   ~~~~~       New section      ~~~~~     -->
3294 <sect3 renderas="sect4" id="filter">
3295 <title><emphasis>+filter</emphasis></title>
3296
3297 <variablelist>
3298  <varlistentry>
3299   <term>Type:</term>
3300   <!-- boolean, parameterized, Multi-value -->
3301   <listitem>
3302    <para>Parameterized.</para>
3303   </listitem>
3304  </varlistentry>
3305
3306  <varlistentry>
3307   <term>Typical uses:</term>
3308   <listitem>
3309    <para>
3310     Apply page filtering as defined by named sections of the
3311     <filename>default.filter</filename> file to the specified site(s). 
3312     <quote>Filtering</quote> can be any modification of the raw 
3313     page content, including re-writing or deletion of content.
3314    </para>
3315   </listitem>
3316  </varlistentry>
3317
3318  <varlistentry>
3319   <term>Possible values:</term>
3320   <listitem>
3321    <para>
3322     <quote>+filter</quote> must include the name of one of the section identifiers
3323     from <filename>default.filter</filename> (or whatever
3324     <emphasis>filterfile</emphasis> is specified in <filename>config</filename>).
3325    </para>
3326   </listitem>
3327  </varlistentry>
3328  
3329  <varlistentry>
3330   <term>Example usage (from the current <filename>default.filter</filename>):</term>
3331   <listitem>
3332    <simplelist>
3333    <member>
3334     <anchor id="filter-html-annoyances">
3335     <emphasis>+filter{html-annoyances}</emphasis>:  Get rid of particularly annoying HTML abuse.
3336    </member>
3337   </simplelist>
3338   <simplelist>
3339    <member>
3340     <anchor id="filter-js-annoyances">
3341     <emphasis>+filter{js-annoyances}</emphasis>:    Get rid of particularly annoying JavaScript abuse
3342    </member>
3343   </simplelist>
3344   <simplelist>
3345    <member>
3346     <anchor id="filter-content-cookies">
3347     <emphasis>+filter{content-cookies}</emphasis>:   Kill cookies that come in the HTML or JS content 
3348    </member>
3349   </simplelist>
3350   <simplelist>
3351    <member>
3352     <anchor id="filter-popups">
3353     <emphasis>+filter{popups}</emphasis>:         Kill all popups in JS and HTML
3354    </member>
3355   </simplelist>
3356   <simplelist>
3357    <member>
3358     <anchor id="filter-frameset-borders">
3359     <emphasis>+filter{frameset-borders}</emphasis>: Give frames a border and make them resizable 
3360    </member>
3361   </simplelist>
3362   <simplelist>
3363    <member>
3364     <anchor id="filter-webbugs">
3365     <emphasis>+filter{webbugs}</emphasis>:          Squish WebBugs (1x1 invisible GIFs used for user tracking)
3366    </member>
3367   </simplelist>
3368   <simplelist>
3369    <member>
3370     <anchor id="filter-refresh-tags">
3371     <emphasis>+filter{refresh-tags}</emphasis>:     Kill automatic refresh tags (for dial-on-demand setups) 
3372    </member>
3373   </simplelist>
3374   <simplelist>
3375    <member>
3376     <anchor id="filter-fun">
3377     <emphasis>+filter{fun}</emphasis>:              Text replacements  for subversive browsing fun!
3378    </member>
3379   </simplelist>
3380   <simplelist>
3381    <member>
3382     <anchor id="filter-nimda">
3383     <emphasis>+filter{nimda}</emphasis>:            Remove Nimda (virus) code.
3384    </member>
3385   </simplelist>
3386   <simplelist>
3387    <member>
3388     <anchor id="filter-banners-by-size">
3389     <emphasis>+filter{banners-by-size}</emphasis>:  Kill banners by size (<emphasis>very</emphasis> efficient!)
3390    </member>
3391   </simplelist>
3392   <simplelist>
3393    <member>
3394     <anchor id="filter-shockwave-flash">
3395     <emphasis>+filter{shockwave-flash}</emphasis>:   Kill embedded Shockwave Flash objects
3396    </member>
3397   </simplelist>
3398   <simplelist>
3399    <member>
3400     <anchor id="filter-crude-parental">
3401     <emphasis>+filter{crude-parental}</emphasis>:   Kill all web pages that contain the words "sex" or "warez"
3402    </member>
3403   </simplelist>
3404   </listitem>
3405  </varlistentry>
3406
3407  <varlistentry>
3408   <term>Notes:</term>
3409   <listitem>
3410    <para>
3411     This is potentially a very powerful feature! And requires a knowledge 
3412     of regular expressions if you want to <quote>roll your own</quote>.
3413     Filtering operates on a line by line basis throughout the entire page.
3414    </para>
3415    <para>
3416     Filtering requires buffering the page content, which may appear to
3417     slow down page rendering since nothing is displayed until all content has
3418     passed the filters. (It does not really take longer, but seems that way
3419     since the page is not incrementally displayed.) This effect will be more
3420     noticeable on slower connections.
3421    </para>
3422    <para>
3423     Filtering can achieve some of the effects as the 
3424     <ulink url="actions-file#BLOCK"><quote>+block</quote></ulink>
3425     action, i.e. it can be used to block ads and banners. In the overall 
3426     scheme of things, filtering is one of the first things <quote>Privoxy</quote> 
3427     does with a web page. So other most other actions are applied to the 
3428     already <quote>filtered</quote> page.
3429    </para>
3430   </listitem>
3431  </varlistentry>
3432
3433 </variablelist>
3434 </sect3>
3435
3436
3437 <!--   ~~~~~       New section      ~~~~~     -->
3438 <sect3 renderas="sect4" id="hide-forwarded-for-headers">
3439 <title><emphasis>+hide-forwarded-for-headers</emphasis></title>
3440
3441 <variablelist>
3442  <varlistentry>
3443   <term>Type:</term>
3444   <!-- Boolean, Parameterized, Multi-value -->
3445   <listitem>
3446    <para>Boolean.</para>
3447   </listitem>
3448  </varlistentry>
3449
3450  <varlistentry>
3451   <term>Typical uses:</term>
3452   <listitem>
3453    <para>
3454     Block any existing X-Forwarded-for HTTP header, and do not add a new one.
3455    </para>
3456   </listitem>
3457  </varlistentry>
3458
3459  <varlistentry>
3460   <term>Possible values:</term>
3461   <listitem>
3462    <para>
3463     N/A
3464    </para>
3465   </listitem>
3466  </varlistentry>
3467  
3468  <varlistentry>
3469   <term>Example usage:</term>
3470   <listitem>
3471     <literallayout>
3472      <emphasis>{+hide-forwarded-for-headers}</emphasis>
3473      <emphasis>.example.com</emphasis>
3474     </literallayout>
3475   </listitem>
3476  </varlistentry>
3477
3478  <varlistentry>
3479   <term>Notes:</term>
3480   <listitem>
3481    <para>
3482     It is fairly safe to leave this on. It does not seem to break many sites.
3483    </para>
3484   </listitem>
3485  </varlistentry>
3486
3487 </variablelist>
3488 </sect3>
3489
3490
3491 <!--   ~~~~~       New section      ~~~~~     -->
3492 <sect3 renderas="sect4" id="hide-from-header">
3493 <title><emphasis>+hide-from-header</emphasis></title>
3494
3495 <variablelist>
3496  <varlistentry>
3497   <term>Type:</term>
3498   <!-- Boolean, Parameterized, Multi-value -->
3499   <listitem>
3500    <para>Parameterized.</para>
3501   </listitem>
3502  </varlistentry>
3503
3504  <varlistentry>
3505   <term>Typical uses:</term>
3506   <listitem>
3507    <para>
3508     To block the browser from sending your email address in a <quote>From:</quote>
3509     header.
3510    </para>
3511   </listitem>
3512  </varlistentry>
3513
3514  <varlistentry>
3515   <term>Possible values:</term>
3516   <listitem>
3517    <para>
3518     Keyword: <quote>block</quote>, or any user defined value.
3519    </para>
3520   </listitem>
3521  </varlistentry>
3522  
3523  <varlistentry>
3524   <term>Example usage:</term>
3525   <listitem>
3526     <literallayout>
3527      <emphasis>{+hide-from-header{block}}</emphasis>
3528      <emphasis>.example.com</emphasis>
3529     </literallayout>
3530   </listitem>
3531  </varlistentry>
3532
3533  <varlistentry>
3534   <term>Notes:</term>
3535   <listitem>
3536    <para>
3537     The keyword <quote>block</quote> will completely remove the header 
3538     (not to be confused with the <ulink
3539     url="actions-file.html#BLOCK"><quote>+block</quote></ulink> action).
3540     Alternately, you can specify any value you prefer to send to the web
3541     server.
3542    </para>
3543   </listitem>
3544  </varlistentry>
3545
3546 </variablelist>
3547 </sect3>
3548
3549
3550 <!--   ~~~~~       New section      ~~~~~     -->
3551 <sect3 renderas="sect4" id="hide-referer">
3552 <title><emphasis>+hide-referer</emphasis></title>
3553 <anchor id="hide-referrer">
3554 <variablelist>
3555  <varlistentry>
3556   <term>Type:</term>
3557   <!-- Boolean, Parameterized, Multi-value -->
3558   <listitem>
3559    <para>Parameterized.</para>
3560   </listitem>
3561  </varlistentry>
3562
3563  <varlistentry>
3564   <term>Typical uses:</term>
3565   <listitem>
3566    <para>
3567      Don't send the <quote>Referer:</quote> (sic) HTTP header to the web site.
3568      Or, alternately send a forged header instead.
3569    </para>
3570   </listitem>
3571  </varlistentry>
3572
3573  <varlistentry>
3574   <term>Possible values:</term>
3575   <listitem>
3576    <para>
3577      Prevent the header from being sent with the keyword, <quote>block</quote>.
3578      Or, <quote>forge</quote> a URL to one from the same server as the request.
3579      Or, set to user defined value of your choice.
3580    </para>
3581   </listitem>
3582  </varlistentry>
3583  
3584  <varlistentry>
3585   <term>Example usage:</term>
3586   <listitem>
3587     <literallayout>
3588      <emphasis>{+hide-referer{forge}}</emphasis>
3589      <emphasis>.example.com</emphasis>
3590     </literallayout>
3591   </listitem>
3592  </varlistentry>
3593
3594  <varlistentry>
3595   <term>Notes:</term>
3596   <listitem>
3597    <para>
3598     <quote>forge</quote> is the preferred option here, since some servers will
3599     not send images back otherwise.
3600    </para>
3601   <para>  
3602    <quote>+hide-referrer</quote> is an alternate spelling of
3603    <quote>+hide-referer</quote>. It has the exact same parameters, and can be freely
3604    mixed with, <quote>+hide-referer</quote>. (<quote>referrer</quote> is the
3605    correct English spelling, however the HTTP specification has a bug - it
3606    requires it to be spelled as <quote>referer</quote>.) 
3607   </para>
3608   </listitem>
3609  </varlistentry>
3610
3611 </variablelist>
3612 </sect3>
3613
3614
3615 <!--   ~~~~~       New section      ~~~~~     -->
3616 <sect3 renderas="sect4" id="hide-user-agent">
3617 <title><emphasis>+hide-user-agent</emphasis></title>
3618
3619 <variablelist>
3620  <varlistentry>
3621   <term>Type:</term>
3622   <!-- Boolean, Parameterized, Multi-value -->
3623   <listitem>
3624    <para>Parameterized.</para>
3625   </listitem>
3626  </varlistentry>
3627
3628  <varlistentry>
3629   <term>Typical uses:</term>
3630   <listitem>
3631    <para>
3632     To change the <quote>User-Agent:</quote> header so web servers can't tell
3633     your browser type. Who's business is it anyway?
3634    </para>
3635   </listitem>
3636  </varlistentry>
3637
3638  <varlistentry>
3639   <term>Possible values:</term>
3640   <listitem>
3641    <para>
3642     Any user defined string.
3643    </para>
3644   </listitem>
3645  </varlistentry>
3646  
3647  <varlistentry>
3648   <term>Example usage:</term>
3649   <listitem>
3650     <literallayout>
3651      <emphasis>{+hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}}</emphasis>
3652      <emphasis>.msn.com</emphasis>
3653     </literallayout>
3654   </listitem>
3655  </varlistentry>
3656
3657  <varlistentry>
3658   <term>Notes:</term>
3659   <listitem>
3660    <para>
3661      Warning! This breaks many web sites that depend on this in order 
3662      to determine how the target browser will respond to various 
3663      requests. Use with caution.
3664    </para>
3665   </listitem>
3666  </varlistentry>
3667
3668 </variablelist>
3669 </sect3>
3670
3671 <!--   ~~~~~       New section      ~~~~~     -->
3672 <sect3 renderas="sect4" id="handle-as-image">
3673 <title><emphasis>+handle-as-image</emphasis></title>
3674
3675 <variablelist>
3676  <varlistentry>
3677   <term>Type:</term>
3678   <!-- Boolean, Parameterized, Multi-value -->
3679   <listitem>
3680    <para>Boolean.</para>
3681   </listitem>
3682  </varlistentry>
3683
3684  <varlistentry>
3685   <term>Typical uses:</term>
3686   <listitem>
3687    <para>
3688     To define what <application>Privoxy</application> should treat 
3689     automatically as an image, and is an important ingredient of how 
3690     ads are handled.
3691    </para>
3692   </listitem>
3693  </varlistentry>
3694
3695  <varlistentry>
3696   <term>Possible values:</term>
3697   <listitem>
3698    <para>
3699     N/A
3700    </para>
3701   </listitem>
3702  </varlistentry>
3703  
3704  <varlistentry>
3705   <term>Example usage:</term>
3706   <listitem>
3707     <literallayout>
3708      <emphasis>{+handle-as-image}</emphasis>
3709      <emphasis>/.*\.(gif|jpg|jpeg|png|bmp|ico)</emphasis>
3710     </literallayout>
3711   </listitem>
3712  </varlistentry>
3713
3714  <varlistentry>
3715   <term>Notes:</term>
3716   <listitem>
3717    <para>
3718     This only has meaning if the URL (or pattern) also is
3719     <quote>+block</quote>ed, in which case a user definable image can
3720     be sent rather than a HTML page. This is integral to the whole concept of
3721     ad blocking: the URL must match <emphasis>both</emphasis> a <ulink
3722     url="actions-file.html#BLOCK"><quote>+block</quote></ulink> rule,
3723     <emphasis>and</emphasis> <quote>+handle-as-image</quote>.
3724     (See <ulink
3725     url="actions-file.html#SET-IMAGE-BLOCKER"><quote>+set-image-blocker</quote></ulink>
3726     below for control over what will actually be displayed by the browser.)
3727    </para>
3728    <para>
3729     There is little reason to change the default definition for this action.
3730    </para>
3731   </listitem>
3732  </varlistentry>
3733
3734 </variablelist>
3735 </sect3>
3736
3737
3738 <!--   ~~~~~       New section      ~~~~~     -->
3739 <sect3 renderas="sect4" id="set-image-blocker">
3740 <title><emphasis>+set-image-blocker</emphasis></title>
3741
3742 <variablelist>
3743  <varlistentry>
3744   <term>Type:</term>
3745   <!-- Boolean, Parameterized, Multi-value -->
3746   <listitem>
3747    <para>Parameterized.</para>
3748   </listitem>
3749  </varlistentry>
3750
3751  <varlistentry>
3752   <term>Typical uses:</term>
3753   <listitem>
3754    <para>
3755     Decide what to do with URLs that end up tagged with <emphasis>both</emphasis> 
3756     <ulink url="actions-file.html#BLOCK"><quote>+block</quote></ulink>
3757     and <ulink
3758     url="actions-file.html#HANDLE-AS-IMAGE"><quote>+handle-as-image</quote></ulink>,
3759     e.g an advertisement.
3760    </para>
3761   </listitem>
3762  </varlistentry>
3763
3764  <varlistentry>
3765   <term>Possible values:</term>
3766   <listitem>
3767    <para>
3768     There are four available options: <quote>-set-image-blocker</quote> will send a HTML
3769     <quote>blocked</quote> page, usually resulting in a <quote>broken
3770     image</quote> icon.
3771     <quote>+set-image-blocker{<emphasis>blank</emphasis>}</quote> will send a
3772     1x1 transparent GIF image.
3773     <quote>+set-image-blocker{<emphasis>pattern</emphasis>}</quote> will send a
3774     checkerboard type pattern (the default). And finally,
3775     <quote>+set-image-blocker{<emphasis>http://xyz.com</emphasis>}</quote> will
3776     send a HTTP temporary redirect to the specified image. This has the
3777     advantage of the icon being being cached by the browser, which will speed
3778     up the display.
3779    </para>
3780   </listitem>
3781  </varlistentry>
3782  
3783  <varlistentry>
3784   <term>Example usage:</term>
3785   <listitem>
3786     <literallayout>
3787      <emphasis>{+set-image-blocker{blank}}</emphasis>
3788      <emphasis>.example.com</emphasis>
3789     </literallayout>
3790   </listitem>
3791  </varlistentry>
3792
3793  <varlistentry>
3794   <term>Notes:</term>
3795   <listitem>
3796    <para>
3797     If you want <emphasis>invisible</emphasis> ads, they need to meet 
3798     criteria as matching both <emphasis>images</emphasis> and <emphasis>blocked</emphasis>
3799     actions. And then, <quote>image-blocker</quote> should be set to
3800     <quote>blank</quote> for invisibility. Note you cannot treat HTML pages as
3801     images in most cases. For instance, frames require an HTML page to
3802     display. So a frame that is an ad, typically cannot be treated as an image.
3803     Forcing an <quote>image</quote> in this situation just will not work
3804     reliably. 
3805    </para>
3806   </listitem>
3807  </varlistentry>
3808
3809 </variablelist>
3810 </sect3>
3811
3812 <!--   ~~~~~       New section      ~~~~~     -->
3813 <sect3 renderas="sect4" id="limit-connect">
3814 <title><emphasis>+limit-connect</emphasis></title>
3815
3816 <variablelist>
3817  <varlistentry>
3818   <term>Type:</term>
3819   <!-- Boolean, Parameterized, Multi-value -->
3820   <listitem>
3821    <para>Parameterized.</para>
3822   </listitem>
3823  </varlistentry>
3824
3825  <varlistentry>
3826   <term>Typical uses:</term>
3827   <listitem>
3828    <para>
3829     By default, <application>Privoxy</application> only allows HTTP CONNECT
3830     requests to port 443 (the standard, secure HTTPS port). Use 
3831     <quote>+limit-connect</quote> to disable this altogether, or to allow 
3832     more ports.
3833    </para>
3834   </listitem>
3835  </varlistentry>
3836
3837  <varlistentry>
3838   <term>Possible values:</term>
3839   <listitem>
3840    <para>
3841     Any valid port number, or port number range.
3842    </para>
3843   </listitem>
3844  </varlistentry>
3845  
3846  <varlistentry>
3847   <term>Example usages:</term>
3848   <listitem>
3849    <!-- I had trouble getting the spacing to look right in my browser -->
3850    <!-- I probably have the wrong font setup, bollocks. -->
3851    <!-- Apparently the emphasis tag uses a proportional font no matter what -->
3852     <literallayout>
3853      <emphasis>+limit-connect{443}</emphasis>                       # This is the default and need not be specified.
3854      <emphasis>+limit-connect{80,443}</emphasis>                  # Ports 80 and 443 are OK.
3855      <emphasis>+limit-connect{-3, 7, 20-100, 500-}</emphasis>   # Port less than 3, 7, 20 to 100 and above 500 are OK.
3856     </literallayout>
3857   </listitem>
3858  </varlistentry>
3859
3860  <varlistentry>
3861   <term>Notes:</term>
3862   <listitem>
3863    <para>
3864     The CONNECT methods exists in HTTP to allow access to secure websites
3865     (https:// URLs) through proxies. It works very simply: the proxy connects
3866     to the server on the specified port, and then short-circuits its
3867     connections to the client <emphasis>and</emphasis> to the remote proxy.
3868     This can be a big security hole, since CONNECT-enabled proxies can be
3869     abused as TCP relays very easily.
3870   </para>
3871   <para> 
3872    If you want to allow CONNECT for more ports than this, or want to forbid
3873    CONNECT altogether, you can specify a comma separated list of ports and
3874    port ranges (the latter using dashes, with the minimum defaulting to 0 and
3875    max to 65K).
3876   </para>
3877   <para>
3878    If you don't know what any of this means, there probably is no reason to 
3879    change this one.
3880   </para>
3881   </listitem>
3882  </varlistentry>
3883
3884 </variablelist>
3885 </sect3>
3886
3887 <!--   ~~~~~       New section      ~~~~~     -->
3888 <sect3 renderas="sect4" id="prevent-compression">
3889 <title><emphasis>+prevent-compression</emphasis></title>
3890
3891 <variablelist>
3892  <varlistentry>
3893   <term>Type:</term>
3894   <!-- Boolean, Parameterized, Multi-value -->
3895   <listitem>
3896    <para>Boolean.</para>
3897   </listitem>
3898  </varlistentry>
3899
3900  <varlistentry>
3901   <term>Typical uses:</term>
3902   <listitem>
3903    <para>
3904     Prevent the specified websites from compressing HTTP data.
3905    </para>
3906   </listitem>
3907  </varlistentry>
3908
3909  <varlistentry>
3910   <term>Possible values:</term>
3911   <listitem>
3912    <para>
3913     N/A
3914    </para>
3915   </listitem>
3916  </varlistentry>
3917  
3918  <varlistentry>
3919   <term>Example usage:</term>
3920   <listitem>
3921     <literallayout>
3922      <emphasis>{+prevent-compression}</emphasis>
3923      <emphasis>.example.com</emphasis>
3924     </literallayout>
3925   </listitem>
3926  </varlistentry>
3927
3928  <varlistentry>
3929   <term>Notes:</term>
3930   <listitem>
3931    <para>
3932     Some websites do this, which can be a problem for
3933     <application>Privoxy</application>, since 
3934     <ulink url="actions-file.html#FILTER"><quote>+filter</quote></ulink>,
3935     <ulink url="actions-file.html#KILL-POPUPS"><quote>+kill-popups</quote></ulink>
3936     and <ulink
3937     url="actions-file.html#GIF-DEANIMATE"><quote>+gif-deanimate</quote></ulink>
3938     will not work on compressed data. This will slow down connections to those
3939     websites, though. Default typically is to turn
3940     <quote>prevent-compression</quote> on.
3941    </para>
3942   </listitem>
3943  </varlistentry>
3944
3945 </variablelist>
3946 </sect3>
3947
3948 <!--   ~~~~~       New section      ~~~~~     -->
3949 <sect3 renderas="sect4" id="session-cookies-only">
3950 <title><emphasis>+session-cookies-only</emphasis></title>
3951
3952 <variablelist>
3953  <varlistentry>
3954   <term>Type:</term>
3955   <!-- Boolean, Parameterized, Multi-value -->
3956   <listitem>
3957    <para>Boolean.</para>
3958   </listitem>
3959  </varlistentry>
3960
3961  <varlistentry>
3962   <term>Typical uses:</term>
3963   <listitem>
3964    <para>
3965     Allow cookies for the current browser session <emphasis>only</emphasis>.
3966    </para>
3967   </listitem>
3968  </varlistentry>
3969
3970  <varlistentry>
3971   <term>Possible values:</term>
3972   <listitem>
3973    <para>
3974     N/A
3975    </para>
3976   </listitem>
3977  </varlistentry>
3978  
3979  <varlistentry>
3980   <term>Example usage (disabling):</term>
3981   <listitem>
3982     <literallayout>
3983      <emphasis>{-session-cookies-only}</emphasis>
3984      <emphasis>.example.com</emphasis>
3985     </literallayout>
3986   </listitem>
3987  </varlistentry>
3988
3989  <varlistentry>
3990   <term>Notes:</term>
3991   <listitem>
3992    <para>
3993     If websites set cookies, <quote>+session-cookies-only</quote> will make sure
3994     they are erased when you exit and restart your web browser. This makes
3995     profiling cookies useless, but won't break sites which require cookies so
3996     that you can log in for transactions. This is generally turned on for all 
3997     sites, and is the recommended setting.
3998    </para>
3999    <para>
4000     <quote>+prevent-*-cookies</quote> actions should be turned off as well (see
4001     below), for <quote>+session-cookies-only</quote> to work. Or, else no cookies 
4002     will get through at all. For, <quote>persistent</quote> cookies that survive 
4003     across browser sessions, see below as well.
4004    </para>
4005   </listitem>
4006  </varlistentry>
4007
4008 </variablelist>
4009 </sect3>
4010
4011
4012 <!--   ~~~~~       New section      ~~~~~     -->
4013 <sect3 renderas="sect4" id="prevent-reading-cookies">
4014 <title><emphasis>+prevent-reading-cookies</emphasis></title>
4015
4016 <variablelist>
4017  <varlistentry>
4018   <term>Type:</term>
4019   <!-- Boolean, Parameterized, Multi-value -->
4020   <listitem>
4021    <para>Boolean.</para>
4022   </listitem>
4023  </varlistentry>
4024
4025  <varlistentry>
4026   <term>Typical uses:</term>
4027   <listitem>
4028    <para>
4029     Explicitly prevent the web server from reading any cookies on your 
4030     system.
4031    </para>
4032   </listitem>
4033  </varlistentry>
4034
4035  <varlistentry>
4036   <term>Possible values:</term>
4037   <listitem>
4038    <para>
4039     N/A
4040    </para>
4041   </listitem>
4042  </varlistentry>
4043  
4044  <varlistentry>
4045   <term>Example usage:</term>
4046   <listitem>
4047     <literallayout>
4048      <emphasis>{+prevent-reading-cookies}</emphasis>
4049      <emphasis>.example.com</emphasis>
4050     </literallayout>
4051   </listitem>
4052  </varlistentry>
4053
4054  <varlistentry>
4055   <term>Notes:</term>
4056   <listitem>
4057    <para>
4058     Often used in conjunction with <quote>+prevent-setting-cookies</quote> to 
4059     disable cookies completely. Note that 
4060     <ulink url="actions-file.html#SESSION-COOKIES-ONLY"><quote>+session-cookies-only</quote></ulink>
4061     requires these to both be disabled (or else it never gets any cookies to cache).
4062    </para>
4063    <para>
4064     For <quote>persistent</quote> cookies to work (i.e. they survive across browser 
4065     sessions and reboots), all three cookie settings should be <quote>off</quote> 
4066     for the specified sites.
4067    </para>
4068   </listitem>
4069  </varlistentry>
4070
4071 </variablelist>
4072 </sect3>
4073
4074
4075 <!--   ~~~~~       New section      ~~~~~     -->
4076 <sect3 renderas="sect4" id="prevent-setting-cookies">
4077 <title><emphasis>+prevent-setting-cookies</emphasis></title>
4078
4079 <variablelist>
4080  <varlistentry>
4081   <term>Type:</term>
4082   <!-- Boolean, Parameterized, Multi-value -->
4083   <listitem>
4084    <para>Boolean.</para>
4085   </listitem>
4086  </varlistentry>
4087
4088  <varlistentry>
4089   <term>Typical uses:</term>
4090   <listitem>
4091    <para>
4092     Explicitly block the web server from storing cookies on your 
4093     system.
4094    </para>
4095   </listitem>
4096  </varlistentry>
4097
4098  <varlistentry>
4099   <term>Possible values:</term>
4100   <listitem>
4101    <para>
4102     N/A
4103    </para>
4104   </listitem>
4105  </varlistentry>
4106  
4107  <varlistentry>
4108   <term>Example usage:</term>
4109   <listitem>
4110     <literallayout>
4111      <emphasis>{+prevent-setting-cookies}</emphasis>
4112      <emphasis>.example.com</emphasis>
4113     </literallayout>
4114   </listitem>
4115  </varlistentry>
4116
4117  <varlistentry>
4118   <term>Notes:</term>
4119   <listitem>
4120    <para>
4121     Often used in conjunction with <quote>+prevent-reading-cookies</quote> to 
4122     disable cookies completely (see above).
4123    </para>
4124   </listitem>
4125  </varlistentry>
4126
4127 </variablelist>
4128 </sect3>
4129
4130
4131 <!--   ~~~~~       New section      ~~~~~     -->
4132 <sect3 renderas="sect4" id="kill-popup">
4133 <title><emphasis>+kill-popups<anchor id="kill-popups"></emphasis></title>
4134 <variablelist>
4135  <varlistentry>
4136   <term>Type:</term>
4137   <!-- Boolean, Parameterized, Multi-value -->
4138   <listitem>
4139    <para>Boolean.</para>
4140   </listitem>
4141  </varlistentry>
4142
4143  <varlistentry>
4144   <term>Typical uses:</term>
4145   <listitem>
4146    <para>
4147     Stop those annoying JavaScript pop-up windows! 
4148    </para>
4149   </listitem>
4150  </varlistentry>
4151
4152  <varlistentry>
4153   <term>Possible values:</term>
4154   <listitem>
4155    <para>
4156     N/A
4157    </para>
4158   </listitem>
4159  </varlistentry>
4160  
4161  <varlistentry>
4162   <term>Example usage:</term>
4163   <listitem>
4164     <literallayout>
4165      <emphasis>{+kill-popups}</emphasis>
4166      <emphasis>.example.com</emphasis>
4167     </literallayout>
4168   </listitem>
4169  </varlistentry>
4170
4171  <varlistentry>
4172   <term>Notes:</term>
4173   <listitem>
4174    <para>
4175     <quote>+kill-popups</quote> uses a built in filter to disable pop-ups
4176     that use the <literal>window.open()</literal> function, etc. This is 
4177     one of the first actions processed by <application>Privoxy</application>
4178     as it contacts the remote web server. This action is not always 100% reliable, 
4179     and is supplemented by <quote>+filter{<emphasis>popups</emphasis>}</quote>.
4180     </para>
4181   <!-- 
4182    <para>
4183     An alternate spelling is <quote>+kill-popup</quote>, which is 
4184     interchangeable.
4185    </para>
4186  --> 
4187   </listitem>
4188  </varlistentry>
4189
4190 </variablelist>
4191 </sect3>
4192
4193
4194 <!--   ~~~~~       New section      ~~~~~     -->
4195 <sect3 renderas="sect4" id="send-vanilla-wafer">
4196 <title><emphasis>+send-vanilla-wafer</emphasis></title>
4197
4198 <variablelist>
4199  <varlistentry>
4200   <term>Type:</term>
4201   <!-- Boolean, Parameterized, Multi-value -->
4202   <listitem>
4203    <para>Boolean.</para>
4204   </listitem>
4205  </varlistentry>
4206
4207  <varlistentry>
4208   <term>Typical uses:</term>
4209   <listitem>
4210    <para>
4211     Sends a cookie for every site stating that you do not accept any copyright
4212     on cookies sent to you, and asking them not to track you.
4213    </para>
4214   </listitem>
4215  </varlistentry>
4216
4217  <varlistentry>
4218   <term>Possible values:</term>
4219   <listitem>
4220    <para>
4221     N/A
4222    </para>
4223   </listitem>
4224  </varlistentry>
4225  
4226  <varlistentry>
4227   <term>Example usage:</term>
4228   <listitem>
4229     <literallayout>
4230      <emphasis>{+send-vanilla-wafer}</emphasis>
4231      <emphasis>.example.com</emphasis>
4232     </literallayout>
4233   </listitem>
4234  </varlistentry>
4235
4236  <varlistentry>
4237   <term>Notes:</term>
4238   <listitem>
4239    <para>
4240     This action only applies if you are using a <filename>jarfile</filename>
4241     for saving cookies. Of course, this is a (relatively) unique header and 
4242     could conceivably be used to track you.
4243    </para>
4244   </listitem>
4245  </varlistentry>
4246
4247 </variablelist>
4248 </sect3>
4249
4250
4251 <!--   ~~~~~       New section      ~~~~~     -->
4252 <sect3 renderas="sect4" id="send-wafer">
4253 <title><emphasis>+send-wafer</emphasis></title>
4254
4255 <variablelist>
4256  <varlistentry>
4257   <term>Type:</term>
4258   <!-- Boolean, Parameterized, Multi-value -->
4259   <listitem>
4260    <para>Multi-value.</para>
4261   </listitem>
4262  </varlistentry>
4263
4264  <varlistentry>
4265   <term>Typical uses:</term>
4266   <listitem>
4267    <para>
4268     This allows you to send an arbitrary, user definable cookie.
4269    </para>
4270   </listitem>
4271  </varlistentry>
4272
4273  <varlistentry>
4274   <term>Possible values:</term>
4275   <listitem>
4276    <para>
4277     User specified cookie name and corresponding value.
4278    </para>
4279   </listitem>
4280  </varlistentry>
4281  
4282  <varlistentry>
4283   <term>Example usage:</term>
4284   <listitem>
4285     <literallayout>
4286      <emphasis>{+send-wafer{name=value}}</emphasis>
4287      <emphasis>.example.com</emphasis>
4288     </literallayout>
4289   </listitem>
4290  </varlistentry>
4291
4292  <varlistentry>
4293   <term>Notes:</term>
4294   <listitem>
4295    <para>
4296     This can be specified multiple times in order to add as many cookies as you
4297     like.
4298    </para>
4299   </listitem>
4300  </varlistentry>
4301
4302 </variablelist>
4303 </sect3>
4304
4305
4306 <!--   ~~~~~       New section      ~~~~~     -->
4307 <sect3>
4308 <title>Summary</title>
4309 <para>
4310  Note that many of these actions have the potential to cause a page to
4311  misbehave, possibly even not to display at all. There are many ways 
4312  a site designer may choose to design his site, and what HTTP header 
4313  content, and other criteria, he may depend on. There is no way to have hard
4314  and fast rules for all sites. See the <link
4315  linkend="ACTIONSANAT">Appendix</link> for a brief example on troubleshooting
4316  actions.
4317 </para>
4318 </sect3>
4319
4320
4321 <!--   ~~~~~       New section      ~~~~~     -->
4322 <sect3 renderas="sect2" id="act-examples">
4323 <title>Sample Actions Files</title>
4324 <para>
4325  Remember that the meaning of any of the above references is reversed by preceding
4326  the action with a <quote>-</quote>, in place of the <quote>+</quote>. Also, 
4327  that some actions are turned on in the default section of the actions file, 
4328  and require little to no additional configuration. These are just <quote>on</quote>.
4329 </para>
4330
4331 <para>
4332  But, other actions that are turned on in the default section <emphasis>do
4333  typically require</emphasis> exceptions to be listed in the latter sections of 
4334  one of our actions file. For instance, by default no URLs are
4335  <quote>blocked</quote> (i.e. in the default definitions of
4336  <filename>default.action</filename>). We need exceptions to this in order to
4337  <emphasis>enable</emphasis> ad blocking in the lower sections. But we need to
4338  be very selective about what we do block. Thus, the default is <quote>off</quote>
4339  for blocking.
4340 </para>
4341
4342 <para>
4343  Below is a liberally commented sample <filename>default.action</filename> file
4344  to demonstrate how all the pieces come together. And to show how exceptions
4345  to the default policies can be handled. This is followed by a brief 
4346  <filename>user.action</filename> with similar examples.
4347 </para>
4348
4349 <para>
4350  <literal>
4351   <msgtext> 
4352    <literallayout>
4353 # Sample default.action file &lt;developers@privoxy.org&gt;
4354
4355 # Settings -- Don't change! For internal Privoxy use ONLY.
4356 {{settings}}
4357 for-privoxy-version=3.0
4358
4359
4360 ##########################################################################
4361 # <ulink url="actions-file.html#ALIASES">Aliases</ulink> must be defined *before* they are used. These are
4362 # easier to remember, and can combine several actions into one. Once 
4363 # defined they can be used just like any built-in action -- but within 
4364 # this file only! Aliases do not require a + or - sign.
4365 ##########################################################################
4366
4367 # Some useful aliases.
4368 # Alias to turn off cookie handling, ie allow all cookies unmolested.
4369  -prevent-cookies = -prevent-setting-cookies -prevent-reading-cookies \
4370                     -session-cookies-only
4371
4372 # Alias to both block and treat as if an image for ad blocking
4373 # purposes.
4374  +imageblock      = +block +handle-as-image
4375
4376 # Fragile sites should have the minimum changes:
4377  fragile     = -block -deanimate-gifs -fast-redirects -filter -hide-referer \
4378                -prevent-cookies -kill-popups
4379
4380 # Shops should be allowed to set persistent cookies
4381  shop        = -filter -prevent-cookies -session-cookies-only
4382
4383
4384 ##########################################################################
4385 # Begin default action settings. Anything in this section will match 
4386 # all URLs -- UNLESS we have exceptions that also match, defined below this 
4387 # section. We will show all potential actions here whether they are on 
4388 # or off. We could omit any disabled action if we wanted, since all 
4389 # actions are 'off' by default anyway. Shown for completeness only.
4390 # Actions are enabled if preceded by a '+', otherwise they are disabled 
4391 # (unless an alias has been defined without this).
4392 ##########################################################################
4393  { \
4394  <ulink url="actions-file.html#ADD-HEADER">-add-header</ulink> \
4395  <ulink url="actions-file.html#BLOCK">-block</ulink> \
4396  <ulink url="actions-file.html#DEANIMATE-GIFS">-deanimate-gifs</ulink> \
4397  <ulink url="actions-file.html#DOWNGRADE-HTTP-VERSION">-downgrade-http-version</ulink> \
4398  <ulink url="actions-file.html#FAST-REDIRECTS">+fast-redirects</ulink> \
4399  <ulink url="actions-file.html#FILTER-HTML-ANNOYANCES">+filter{html-annoyances}</ulink> \
4400  <ulink url="actions-file.html#FILTER-JS-ANNOYANCES">+filter{js-annoyances}</ulink> \
4401  <ulink url="actions-file.html#FILTER-CONTENT-COOKIES">-filter{content-cookies}</ulink> \
4402  <ulink url="actions-file.html#FILTER-POPUPS">-filter{popups}</ulink> \
4403  <ulink url="actions-file.html#FILTER-WEBBUGS">+filter{webbugs}</ulink> \
4404  <ulink url="actions-file.html#FILTER-REFRESH-TAGS">-filter{refresh-tags}</ulink> \
4405  <ulink url="actions-file.html#FILTER-FUN">-filter{fun}</ulink> \
4406  <ulink url="actions-file.html#FILTER-NIMDA">+filter{nimda}</ulink> \
4407  <ulink url="actions-file.html#FILTER-BANNERS-BY-SIZE">+filter{banners-by-size}</ulink> \
4408  <ulink url="actions-file.html#FILTER-SHOCKWAVE-FLASH">-filter{shockwave-flash}</ulink> \
4409  <ulink url="actions-file.html#FILTER-CRUDE-PARENTAL">-filter{crude-prental}</ulink> \
4410  <ulink url="actions-file.html#HIDE-FORWARDED-FOR-HEADERS">+hide-forwarded-for-headers</ulink> \
4411  <ulink url="actions-file.html#HIDE-FROM-HEADER">+hide-from-header{block}</ulink> \
4412  <ulink url="actions-file.html#HIDE-REFERER">-hide-referrer</ulink> \
4413  <ulink url="actions-file.html#HIDE-USER-AGENT">-hide-user-agent</ulink> \
4414  <ulink url="actions-file.html#HANDLE-AS-IMAGE">-handle-as-image</ulink> \
4415  <ulink url="actions-file.html#SET-IMAGE-BLOCKER">+set-image-blocker{pattern}</ulink> \
4416  <ulink url="actions-file.html#LIMIT-CONNECT">-limit-connect</ulink> \
4417  <ulink url="actions-file.html#PREVENT-COMPRESSION">+prevent-compression</ulink> \
4418  <ulink url="actions-file.html#SESSION-COOKIES-ONLY">-session-cookies-only</ulink> \
4419  <ulink url="actions-file.html#PREVENT-READING-COOKIES">-prevent-reading-cookies</ulink> \
4420  <ulink url="actions-file.html#PREVENT-SETTING-COOKIES">-prevent-setting-cookies</ulink> \
4421  <ulink url="actions-file.html#KILL-POPUPS">-kill-popups</ulink> \
4422  <ulink url="actions-file.html#SEND-VANILLA-WAFER">-send-vanilla-wafer</ulink> \
4423  <ulink url="actions-file.html#SEND-WAFER">-send-wafer</ulink> \
4424  }
4425  / # forward slash will match *all* potential URL patterns. 
4426
4427 ##########################################################################
4428 # Default behavior is now set. Now we will define some exceptions to our 
4429 # default action policies.
4430 ##########################################################################
4431
4432 # These sites are very complex and require very minimal interference.
4433 # We'll disable most actions with our 'fragile' alias:
4434  { fragile }
4435  .office.microsoft.com           # surprise, surprise!
4436  .windowsupdate.microsoft.com
4437
4438
4439 # Shopping sites - not as fragile but require some special 
4440 # handling. We still want to block ads, and we will allow 
4441 # persistant cookies via the 'shop' alias:
4442  { shop }
4443  .quietpc.com 
4444  .worldpay.com   # for quietpc.com
4445  .jungle.com
4446  .scan.co.uk
4447
4448
4449 # These sites require pop-ups too :(  We'll combine our 'shop' 
4450 # alias with two other actions into one rule to allow all popups.
4451  { shop <ulink url="actions-file.html#KILL-POPUPS">-kill-popups</ulink> <ulink url="actions-file.html#FILTER-POPUPS">-filter{popups}</ulink> }
4452  .dabs.com
4453  .overclockers.co.uk
4454
4455
4456 # The 'Fast-redirects' action breaks some sites. Disable this action
4457 # for these known sensitive sites:
4458  { <ulink url="actions-file.html#FAST-REDIRECTS">-fast-redirects</ulink> }
4459  login.yahoo.com
4460  edit.europe.yahoo.com
4461  .google.com
4462  .altavista.com/.*(like|url|link):http
4463  .altavista.com/trans.*urltext=http
4464  .nytimes.com
4465
4466
4467 # Define which file types will be treated as images. Important
4468 # for ad blocking.
4469  { <ulink url="actions-file.html#HANDLE-AS-IMAGE">+handle-as-image</ulink> }
4470  /.*\.(gif|jpe?g|png|bmp|ico)
4471
4472
4473 # Now lets list some domains that are known ad generators. And
4474 # our alias that we use here will block these as well as force 
4475 # them to be treated as images. This combination of actions is 
4476 # important for ad blocking. What the browser will show instead is 
4477 # determined by the setting of <ulink url="actions-file.html#SET-IMAGE-BLOCKER"><quote>+set-image-blocker</quote></ulink>
4478  { +imageblock }
4479  ar.atwola.com 
4480  .ad.doubleclick.net
4481  .a.yimg.com/(?:(?!/i/).)*$
4482  .a[0-9].yimg.com/(?:(?!/i/).)*$
4483  bs*.gsanet.com
4484  bs*.einets.com
4485  .qkimg.net
4486  ad.*.doubleclick.net
4487
4488
4489 # These will just simply be blocked. They will generate the BLOCKED
4490 # banner page, if matched. Heavy use of wildcards and regular 
4491 # expressions in this example. Enable block action:
4492  { <ulink url="actions-file.html#BLOCK">+block</ulink> }
4493  ad*.
4494  .*ads.
4495  banner?.
4496  count*.
4497  /.*count(er)?\.(pl|cgi|exe|dll|asp|php[34]?)
4498  /(?:.*/)?(publicite|werbung|rekla(ma|me|am)|annonse|maino(kset|nta|s)?)/
4499  .hitbox.com 
4500
4501
4502 # The above block section will probably inadvertantly catch some 
4503 # sites we DO NOT want blocked via the wildcards and regular expressions. 
4504 # Now let's set exceptions to the exceptions so the good guys get better 
4505 # treatment. Disable block action:
4506  { <ulink url="actions-file.html#BLOCK">-block</ulink> }
4507  advogato.org
4508  adsl.
4509  ad[ud]*.
4510  advice.
4511 # Let's just trust all .edu top level domains.
4512  .edu
4513  www.ugu.com/sui/ugu/adv
4514 # We'll need to access to path names containing 'download' 
4515  .*downloads.
4516  /downloads/
4517 # 'adv' is for globalintersec and means advanced, not advertisement
4518  www.globalintersec.com/adv
4519
4520
4521 # Don't filter *anything* from our friends at sourceforge.
4522 # Notice we don't have to name the individual filter 
4523 # identifiers -- we just turn them all off in one fell swoop.
4524 # Disable all filters for this one site:
4525  { <ulink url="actions-file.html#FILTER">-filter</ulink> }
4526  .sourceforge.net
4527    </literallayout>
4528   </msgtext> 
4529  </literal>
4530 </para>
4531
4532 <para>
4533  So far we are painting with a broad brush by setting general policies. 
4534  The above would be a reasonable starting point for many situations. Now, 
4535  we want to be more specific and have customized rules that are more suitable
4536  to our personal habits and preferences. These would be for narrowly defined 
4537  situations like your ISP or your bank, and should be placed in 
4538  <filename>user.action</filename>, which is parsed after all other 
4539  actions files and should not be clobbered by upgrades. So any settings here,
4540  will have the last word and over-ride any previously defined actions.
4541 </para>
4542
4543 <para>
4544  Now a few examples of some things that one might do with a
4545  <filename>user.action</filename> file. 
4546 </para>
4547
4548 <!-- brief sample user.action here -->
4549
4550 <para>
4551  <literal>
4552   <msgtext> 
4553    <literallayout>
4554 # Sample user.action file.
4555
4556 # Any aliases you want to use need to be re-defined here.
4557 # Alias to turn off cookie handling, ie allow all cookies unmolested.
4558  -prevent-cookies = -prevent-setting-cookies -prevent-reading-cookies \
4559                     -session-cookies-only
4560
4561 # Fragile sites should have the minimum changes:
4562  fragile     = -block -deanimate-gifs -fast-redirects -filter -hide-referer \
4563                -prevent-cookies -kill-popups
4564
4565 # Allow persistent cookies for a few regular sites that we 
4566 # trust via our above alias. These will be saved from one browser session 
4567 # to the next. We are explicity turning off any and all cookie handling, 
4568 # even though the prevent-*-cookie settings were disabled in our above 
4569 # default.action anyway. So cookies from these domains will come through 
4570 # unmolested.
4571  { -prevent-cookies }
4572  .sun.com
4573  .yahoo.com
4574  .msdn.microsoft.com
4575  .redhat.com
4576
4577
4578 # My ISP uses obnoxious self promoting images on many pages.
4579 # Nuke them :) Note that <ulink url="actions-file.html#HANDLE-AS-IMAGE"><quote>+handle-as-image</quote></ulink> need not be specified,
4580 # since all URLs ending in .gif will be tagged as images by the
4581 # general rules in default.action anyway.
4582  { <ulink url="actions-file.html#BLOCK">+block</ulink> }
4583  www.my-isp-example.com/logo[0-9].gif
4584
4585 # Say the site where you do your homebanking needs to open
4586 # popup windows, but you have chosen to kill popups by
4587 # default. This will allow it for your-example-bank.com:
4588 #
4589  { <ulink url="actions-file.html#FILTER-POPUPS">-filter{popups}</ulink> <ulink url="actions-file.html#KILL-POPUPS">-kill-popups</ulink> }
4590  .my-example-bank.com
4591
4592 # This site is delicate, and requires kid-glove 
4593 # treatment.
4594  { fragile }
4595  .forbes.com
4596    </literallayout>
4597   </msgtext> 
4598  </literal>
4599 </para>
4600
4601 </sect3>
4602 </sect2>
4603
4604 <!--  ~  End section  ~  -->
4605
4606
4607 <!--   ~~~~~       New section      ~~~~~     -->
4608 <sect2 id="aliases">
4609 <title>Aliases</title>
4610 <para>
4611  Custom <quote>actions</quote>, known to <application>Privoxy</application>
4612  as <quote>aliases</quote>, can be defined by combining other <quote>actions</quote>.
4613  These can in turn be invoked just like the built-in <quote>actions</quote>.
4614  Currently, an alias can contain any character except space, tab, <quote>=</quote>,
4615  <quote>{</quote> or <quote>}</quote>. But please use only <quote>a</quote>-
4616  <quote>z</quote>, <quote>0</quote>-<quote>9</quote>, <quote>+</quote>, and
4617  <quote>-</quote>. Alias names are not case sensitive, and 
4618  <emphasis>must be defined before other actions</emphasis> in the
4619  actions file! And there can only be one set of <quote>aliases</quote>
4620  defined per file. Each actions file may have its own aliases, but they are 
4621  only visible within that file. Aliases do not requir a <quote>+</quote> or 
4622  <quote>-</quote> sign in front, since they are merely expanded.
4623 </para>
4624
4625 <para>
4626  Now let's define a few aliases:
4627 </para>
4628
4629 <para>
4630  <literal>
4631   <msgtext> 
4632    <literallayout>
4633  # Useful custom aliases we can use later. These must come first!
4634  {{alias}}
4635  +prevent-cookies = +prevent-setting-cookies +prevent-reading-cookies
4636  -prevent-cookies = -prevent-setting-cookies -prevent-reading-cookies
4637  fragile     = -block -prevent-cookies -filter -fast-redirects -hide-referer -kill-popups
4638  shop        = -prevent-cookies -filter -fast-redirects
4639  +imageblock = +block +handle-as-image
4640
4641  # Aliases defined from other aliases, for people who don't like to type 
4642  # too much:  ;-)
4643  c0 = +prevent-cookies
4644  c1 = -prevent-cookies
4645  #... etc.  Customize to your heart's content.
4646    </literallayout>
4647   </msgtext> 
4648  </literal>
4649 </para>
4650
4651 <para>
4652  Some examples using our <quote>shop</quote> and <quote>fragile</quote>
4653  aliases from above. These would appear in the lower sections of an 
4654  actions file as exceptions to the default actions (as defined in the 
4655  upper section):
4656 </para>
4657
4658 <para>
4659  <literal>
4660   <msgtext> 
4661    <literallayout>
4662  # These sites are very complex and require
4663  # minimal interference.
4664  {fragile}
4665   .office.microsoft.com
4666   .windowsupdate.microsoft.com
4667   .nytimes.com
4668
4669  # Shopping sites - but we still want to block ads.
4670  {shop}
4671   .quietpc.com
4672   .worldpay.com   # for quietpc.com
4673   .scan.co.uk
4674
4675  # These shops require pop-ups also 
4676  {shop -kill-popups}
4677   .dabs.com
4678   .overclockers.co.uk
4679    </literallayout>
4680   </msgtext> 
4681  </literal>
4682 </para>
4683
4684 <para>
4685  The <quote>shop</quote> and <quote>fragile</quote> aliases are often used for 
4686  <quote>problem</quote> sites that require most actions to be disabled 
4687  in order to function properly.
4688
4689 </para>
4690
4691 </sect2>
4692 </sect1>
4693
4694 <!--  ~  End section  ~  -->
4695
4696
4697
4698 <!--   ~~~~~~~~       New section Header    ~~~~~~~~~     -->
4699
4700 <sect1 id="filter-file">
4701 <title>The Filter File</title>
4702 <para>
4703  Any web page can be dynamically modified with the filter file. This
4704  modification can be removal, or re-writing, of any web page content,
4705  including tags and non-visible content. The default filter file is
4706  oddly enough <filename>default.filter</filename>, located in the config
4707  directory. 
4708 </para>
4709
4710 <para>
4711  This is potentially a very powerful feature, and requires knowledge of both 
4712  <quote>regular expression</quote> and HTML in order create custom 
4713  filters. But, there are a number of useful filters included with 
4714  <application>Privoxy</application> for many common situations.
4715 </para>
4716
4717 <para>
4718  The included example file is divided into sections. Each section begins 
4719  with the <literal>FILTER</literal> keyword, followed by the identifier 
4720  for that section, e.g. <quote>FILTER: webbugs</quote>. Each section performs
4721  a similar type of filtering, such as <quote>html-annoyances</quote>.
4722 </para>
4723
4724 <para>
4725  This file uses regular expressions to alter or remove any string in the
4726  target page. The expressions can only operate on one line at a time. Some
4727  examples from the included default <filename>default.filter</filename>:
4728 </para>
4729
4730 <para>
4731  Stop web pages from displaying annoying messages in the status bar by
4732  deleting such references:
4733 </para>
4734
4735 <para>
4736  <literal>
4737   <msgtext> 
4738    <literallayout>
4739  FILTER: html-annoyances
4740
4741  # New browser windows should be resizeable and have a location and status
4742  # bar. Make it so.
4743  #
4744  s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig
4745  s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig
4746  s/scrolling="?(no|0|Auto)"?/scrolling=1/ig
4747  s/menubar="?(no|0)"?/menubar=1/ig 
4748
4749  # The &lt;BLINK&gt; tag was a crime!
4750  #
4751  s*&lt;blink&gt;|&lt;/blink&gt;**ig
4752
4753  # Is this evil? 
4754  #
4755  #s/framespacing="?(no|0)"?//ig
4756  #s/margin(height|width)=[0-9]*//gi
4757    </literallayout>
4758   </msgtext> 
4759  </literal>
4760 </para>
4761
4762 <para>
4763  Just for kicks, replace any occurrence of <quote>Microsoft</quote> with
4764  <quote>MicroSuck</quote>, and have a little fun with topical buzzwords: 
4765 </para>
4766
4767 <para>
4768  <literal>
4769   <msgtext> 
4770    <literallayout>
4771  FILTER: fun
4772
4773  s/microsoft(?!.com)/MicroSuck/ig
4774
4775  # Buzzword Bingo:
4776  #
4777  s/industry-leading|cutting-edge|award-winning/&lt;font color=red&gt;&lt;b&gt;BINGO!&lt;/b&gt;&lt;/font&gt;/ig
4778    </literallayout>
4779   </msgtext> 
4780  </literal>
4781 </para>
4782
4783 <para>
4784  Kill those pesky little web-bugs:
4785 </para>
4786
4787 <para>
4788  <literal>
4789   <msgtext> 
4790    <literallayout>
4791  # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
4792  FILTER: webbugs
4793
4794  s/&lt;img\s+[^&gt;]*?(width|height)\s*=\s*['"]?1\D[^&gt;]*?(width|height)\s*=\s*['"]?1(\D[^&gt;]*?)?>/&lt;!-- Squished WebBug --&gt;/sig
4795    </literallayout>
4796   </msgtext> 
4797  </literal>
4798 </para>
4799
4800
4801 <!--   ~~~~~       New section      ~~~~~     -->
4802 <sect2>
4803 <title>The <emphasis>+filter</emphasis> Action</title>
4804 <para>
4805  Filters are enabled with the <ulink
4806  url="actions-file.html#FILTER"><quote>+filter</quote></ulink> action from within 
4807  one of the actions files. <quote>+filter</quote> requires one parameter, which 
4808  should match one of the section identifiers in the filter file itself. Example:
4809 </para>
4810
4811 <screen>
4812   +filter{html-annoyances}
4813 </screen>
4814
4815 <para>
4816  This would activate that particular filter. Similarly, <quote>+filter</quote>
4817  can be turned off for selected sites as:
4818  <quote>-filter{html-annoyances}</quote>. Remember too, all actions are off by
4819  default, unless they are explicity enabled in one of the actions files.
4820 </para>
4821
4822 </sect2>
4823
4824 </sect1>
4825
4826 <!--  ~  End section  ~  -->
4827
4828
4829
4830 <!--   ~~~~~       New section      ~~~~~     -->
4831
4832 <sect1 id="templates">
4833 <title>Templates</title>
4834 <para>
4835  When <application>Privoxy</application> displays one of its internal 
4836  pages, such as a <ulink url="http://bogus_404_page.com">404 Not Found error page</ulink>
4837  (<application>Privoxy</application> must be running for link to work as
4838  intended), it uses the appropriate template. On Linux, BSD, and Unix, these
4839  are located in <filename>/etc/privoxy/templates</filename> by default. These
4840  may be customized, if desired. <filename>cgi-style.css</filename> is used to
4841  control the HTML attributes (fonts, etc).
4842 </para>
4843 <para>
4844  The default 
4845 <ulink url="http://ads.bannerserver.example.com/nasty-ads/sponsor.html">Blocked 
4846 (<application>Privoxy</application> needs to be running for page to display)</ulink>
4847  banner page with the bright red top 
4848  banner, is called just <quote><filename>blocked</filename></quote>. This 
4849  may be customized or replaced with something else if desired.
4850
4851 </para>
4852 </sect1>
4853
4854 <!--  ~  End section  ~  -->
4855
4856
4857
4858 <!--   ~~~~~       New section      ~~~~~     -->
4859
4860 <sect1 id="contact"><title>Contacting the Developers, Bug Reporting and Feature
4861 Requests</title>
4862
4863 <!-- Include contacting.sgml boilerplate: -->
4864  &contacting;
4865 <!-- end boilerplate -->
4866
4867 </sect1>
4868
4869
4870 <!--   ~~~~~       New section      ~~~~~     -->
4871 <sect1 id="copyright"><title>Copyright and History</title>
4872
4873 <sect2><title>Copyright</title>
4874 <!-- Include copyright.sgml: -->
4875  &copyright;
4876 <!-- end copyright -->
4877 </sect2>
4878
4879 <!--  ~  End section  ~  -->
4880
4881
4882 <!--   ~~~~~       New section      ~~~~~     -->
4883
4884 <sect2 id="history"><title>History</title>
4885 <!-- Include history.sgml: -->
4886  &history;
4887 <!-- end history -->
4888 </sect2>
4889 </sect1>
4890
4891 <!--   ~~~~~       New section      ~~~~~     -->
4892 <sect1 id="seealso"><title>See Also</title>
4893 <!-- Include seealso.sgml: -->
4894  &seealso;
4895 <!-- end seealso -->
4896 </sect1>
4897
4898
4899
4900 <!--   ~~~~~       New section      ~~~~~     -->
4901 <sect1 id="appendix"><title>Appendix</title>
4902
4903
4904 <!--   ~~~~~       New section      ~~~~~     -->
4905 <sect2 id="regex">
4906 <title>Regular Expressions</title>
4907 <para>
4908  <application>Privoxy</application> can use <quote>regular expressions</quote> 
4909  in various config files. Assuming support for <quote>pcre</quote> (Perl
4910  Compatible Regular Expressions) is compiled in, which is the default. Such
4911  configuration directives do not require regular expressions, but they can be
4912  used to increase flexibility by matching a pattern with wild-cards against
4913  URLs.
4914 </para>
4915
4916 <para>
4917  If you are reading this, you probably don't understand what <quote>regular
4918  expressions</quote> are, or what they can do. So this will be a very brief
4919  introduction only. A full explanation would require a book ;-)
4920 </para>
4921
4922 <para>
4923  <quote>Regular expressions</quote> is a way of matching one character
4924  expression against another to see if it matches or not. One of the
4925  <quote>expressions</quote> is a literal string of readable characters
4926  (letter, numbers, etc), and the other is a complex string of literal
4927  characters combined with wild-cards, and other special characters, called
4928  meta-characters. The <quote>meta-characters</quote> have special meanings and
4929  are used to build the complex pattern to be matched against. Perl Compatible
4930  Regular Expressions is an enhanced form of the regular expression language
4931  with backward compatibility.
4932 </para>
4933
4934 <para>
4935  To make a simple analogy, we do something similar when we use wild-card
4936  characters when listing files with the <command>dir</command> command in DOS. 
4937  <literal>*.*</literal> matches all filenames. The <quote>special</quote>
4938  character here is the asterisk which matches any and all characters. We can be
4939  more specific and use <literal>?</literal> to match just individual
4940  characters. So <quote>dir file?.text</quote> would match
4941  <quote>file1.txt</quote>, <quote>file2.txt</quote>, etc. We are pattern
4942  matching, using a similar technique to <quote>regular expressions</quote>!
4943 </para>
4944
4945 <para>
4946  Regular expressions do essentially the same thing, but are much, much more
4947  powerful. There are many more <quote>special characters</quote> and ways of 
4948  building complex patterns however. Let's look at a few of the common ones,
4949  and then some examples:
4950 </para>
4951
4952 <para><simplelist>
4953  <member>
4954   <emphasis>.</emphasis> - Matches any single character, e.g. <quote>a</quote>,
4955   <quote>A</quote>, <quote>4</quote>, <quote>:</quote>, or <quote>@</quote>.
4956  </member>
4957 </simplelist></para>
4958
4959 <para><simplelist>
4960  <member>
4961   <emphasis>?</emphasis> - The preceding character or expression is matched ZERO or ONE
4962   times. Either/or.
4963  </member>
4964 </simplelist></para>
4965
4966 <para><simplelist>
4967  <member>
4968   <emphasis>+</emphasis> - The preceding character or expression is matched ONE or MORE
4969   times.
4970  </member>
4971 </simplelist></para>
4972
4973 <para><simplelist>
4974  <member>
4975   <emphasis>*</emphasis> - The preceding character or expression is matched ZERO or MORE
4976   times.
4977  </member>
4978 </simplelist></para>
4979
4980 <para><simplelist>
4981  <member>
4982   <emphasis>\</emphasis> - The <quote>escape</quote> character denotes that
4983   the following character should be taken literally. This is used where one of the 
4984   special characters (e.g. <quote>.</quote>) needs to be taken literally and
4985   not as a special meta-character. Example: <quote>example\.com</quote>, makes 
4986   sure the period is recognized only as a period (and not expanded to its 
4987   meta-character meaning of any single character).
4988  </member>
4989 </simplelist></para>
4990
4991 <para><simplelist>
4992  <member>
4993   <emphasis>[]</emphasis> - Characters enclosed in brackets will be matched if
4994   any of the enclosed characters are encountered. For instance, <quote>[0-9]</quote>
4995   matches any numeric digit (zero through nine). As an example, we can combine 
4996   this with <quote>+</quote> to match any digit one of more times: <quote>[0-9]+</quote>.
4997  </member>
4998 </simplelist></para>
4999
5000 <para><simplelist>
5001  <member>
5002   <emphasis>()</emphasis> - parentheses are used to group a sub-expression,
5003   or multiple sub-expressions.
5004  </member>
5005 </simplelist></para>
5006
5007 <para><simplelist>
5008  <member>
5009   <emphasis>|</emphasis> - The <quote>bar</quote> character works like an
5010   <quote>or</quote> conditional statement. A match is successful if the
5011   sub-expression on either side of <quote>|</quote> matches. As an example:
5012   <quote>/(this|that) example/</quote> uses grouping and the bar character 
5013   and would match either <quote>this example</quote> or <quote>that
5014   example</quote>, and nothing else.
5015  </member>
5016 </simplelist></para>
5017
5018 <para><simplelist>
5019  <member>
5020   <emphasis>s/string1/string2/g</emphasis> - This is used to rewrite strings of text. 
5021   <quote>string1</quote> is replaced by <quote>string2</quote> in this
5022   example. There must of course be a match on <quote>string1</quote> first.
5023  </member>
5024 </simplelist></para>
5025
5026 <para>
5027  These are just some of the ones you are likely to use when matching URLs with 
5028  <application>Privoxy</application>, and is a long way from a definitive
5029  list. This is enough to get us started with a few simple examples which may
5030  be more illuminating:
5031 </para>
5032
5033 <para>
5034  <emphasis><literal>/.*/banners/.*</literal></emphasis> - A  simple example
5035  that uses the common combination of <quote>.</quote> and <quote>*</quote> to 
5036  denote any character, zero or more times. In other words, any string at all.
5037  So we start with a literal forward slash, then our regular expression pattern 
5038  (<quote>.*</quote>) another literal forward slash, the string
5039  <quote>banners</quote>, another forward slash, and lastly another
5040  <quote>.*</quote>. We are building 
5041  a directory path here. This will match any file with the path that has a
5042  directory named <quote>banners</quote> in it. The <quote>.*</quote> matches
5043  any characters, and this could conceivably be more forward slashes, so it
5044  might expand into a much longer looking path. For example, this could match:
5045  <quote>/eye/hate/spammers/banners/annoy_me_please.gif</quote>, or just
5046  <quote>/banners/annoying.html</quote>, or almost an infinite number of other
5047  possible combinations, just so it has <quote>banners</quote> in the path
5048  somewhere.
5049 </para>
5050
5051 <para>
5052  A now something a little more complex:
5053 </para>
5054
5055 <para>
5056  <emphasis><literal>/.*/adv((er)?ts?|ertis(ing|ements?))?/</literal></emphasis> - 
5057  We have several literal forward slashes again (<quote>/</quote>), so we are
5058  building another expression that is a file path statement. We have another 
5059  <quote>.*</quote>, so we are matching against any conceivable sub-path, just so
5060  it matches our expression. The only true literal that <emphasis>must
5061  match</emphasis> our pattern is <application>adv</application>, together with
5062  the forward slashes. What comes after the <quote>adv</quote> string is the
5063  interesting part. 
5064 </para>
5065
5066 <para>
5067  Remember the <quote>?</quote> means the preceding expression (either a
5068  literal character or anything grouped with <quote>(...)</quote> in this case)
5069  can exist or not, since this means either zero or one match. So
5070  <quote>((er)?ts?|ertis(ing|ements?))</quote> is optional, as are the
5071  individual sub-expressions: <quote>(er)</quote>,
5072  <quote>(ing|ements?)</quote>, and the <quote>s</quote>. The <quote>|</quote>
5073  means <quote>or</quote>. We have two of those. For instance, 
5074  <quote>(ing|ements?)</quote>, can expand to match either <quote>ing</quote> 
5075  <emphasis>OR</emphasis> <quote>ements?</quote>. What is being done here, is an
5076  attempt at matching as many variations of <quote>advertisement</quote>, and 
5077  similar, as possible. So this would expand to match just <quote>adv</quote>,
5078  or <quote>advert</quote>, or <quote>adverts</quote>, or
5079  <quote>advertising</quote>, or <quote>advertisement</quote>, or
5080  <quote>advertisements</quote>. You get the idea. But it would not match 
5081  <quote>advertizements</quote> (with a <quote>z</quote>). We could fix that by
5082  changing our regular expression to: 
5083  <quote>/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/</quote>, which would then match
5084  either spelling.
5085 </para>
5086
5087 <para>
5088  <emphasis><literal>/.*/advert[0-9]+\.(gif|jpe?g)</literal></emphasis> - Again 
5089  another path statement with forward slashes. Anything in the square brackets 
5090  <quote>[]</quote> can be matched. This is using <quote>0-9</quote> as a
5091  shorthand expression to mean any digit one through nine. It is the same as
5092  saying <quote>0123456789</quote>. So any digit matches. The <quote>+</quote>
5093  means one or more of the preceding expression must be included. The preceding 
5094  expression here is what is in the square brackets -- in this case, any digit 
5095  one through nine. Then, at the end, we have a grouping: <quote>(gif|jpe?g)</quote>. 
5096  This includes a <quote>|</quote>, so this needs to match the expression on
5097  either side of that bar character also. A simple <quote>gif</quote> on one side, and the other
5098  side will in turn match either <quote>jpeg</quote> or <quote>jpg</quote>,
5099  since the <quote>?</quote> means the letter <quote>e</quote> is optional and
5100  can be matched once or not at all. So we are building an expression here to
5101  match image GIF or JPEG type image file. It must include the literal
5102  string <quote>advert</quote>, then one or more digits, and a <quote>.</quote>
5103  (which is now a literal, and not a special character, since it is escaped
5104  with <quote>\</quote>), and lastly either <quote>gif</quote>, or
5105  <quote>jpeg</quote>, or <quote>jpg</quote>. Some possible matches would
5106  include: <quote>//advert1.jpg</quote>,
5107  <quote>/nasty/ads/advert1234.gif</quote>,
5108  <quote>/banners/from/hell/advert99.jpg</quote>. It would not match
5109  <quote>advert1.gif</quote> (no leading slash), or
5110  <quote>/adverts232.jpg</quote> (the expression does not include an
5111  <quote>s</quote>), or <quote>/advert1.jsp</quote> (<quote>jsp</quote> is not
5112  in the expression anywhere).
5113 </para>
5114
5115 <para>
5116  <emphasis><literal>s/microsoft(?!.com)/MicroSuck/i</literal></emphasis> - This is 
5117  a substitution. <quote>MicroSuck</quote> will replace any occurrence of 
5118  <quote>microsoft</quote>.  The <quote>i</quote> at the end of the expression
5119  means ignore case. The <quote>(?!.com)</quote> means 
5120  the match should fail if <quote>microsoft</quote> is followed by
5121  <quote>.com</quote>. In other words, this acts like a <quote>NOT</quote>
5122  modifier. In case this is a hyperlink, we don't want to break it ;-).
5123 </para>
5124
5125 <para>
5126  We are barely scratching the surface of regular expressions here so that you
5127  can understand the default <application>Privoxy</application>
5128  configuration files, and maybe use this knowledge to customize your own
5129  installation. There is much, much more that can be done with regular
5130  expressions. Now that you know enough to get started, you can learn more on
5131  your own :/
5132 </para>
5133
5134 <para>
5135  More reading on Perl Compatible Regular expressions: 
5136  <ulink url="http://www.perldoc.com/perl5.6/pod/perlre.html">http://www.perldoc.com/perl5.6/pod/perlre.html</ulink>
5137 </para>
5138
5139 </sect2>
5140
5141 <!--  ~  End section  ~  -->
5142
5143
5144 <!--   ~~~~~       New section      ~~~~~     -->
5145 <sect2>
5146 <title><application>Privoxy</application>'s Internal Pages</title>
5147
5148 <para>
5149  Since <application>Privoxy</application> proxies each requested 
5150  web page, it is easy for <application>Privoxy</application> to 
5151  trap certain special URLs. In this way, we can talk directly to
5152  <application>Privoxy</application>, and see how it is 
5153  configured, see how our rules are being applied, change these 
5154  rules and other configuration options, and even turn
5155  <application>Privoxy's</application> filtering off, all with 
5156  a web browser.
5157
5158 </para>
5159
5160 <para>
5161  The URLs listed below are the special ones that allow direct access 
5162  to <application>Privoxy</application>. Of course,
5163  <application>Privoxy</application> must be running to access these. If 
5164  not, you will get a friendly error message. Internet access is not 
5165  necessary either.
5166 </para>
5167
5168 <para>
5169  <itemizedlist>
5170
5171  <listitem>
5172   <para>  
5173    Privoxy main page: 
5174   </para>
5175   <blockquote>
5176    <para> 
5177      <ulink url="http://config.privoxy.org/">http://config.privoxy.org/</ulink>
5178    </para>
5179   </blockquote>
5180   <para>
5181    Alternately, this may be reached at <ulink
5182    url="http://p.p/">http://p.p/</ulink>, but this
5183    variation may not work as reliably as the above in some configurations.
5184   </para>
5185  </listitem>
5186
5187  <listitem>
5188   <para>  
5189     Show information about the current configuration, including viewing and 
5190     editing of actions files:
5191   </para>
5192    <blockquote>
5193    <para> 
5194     <ulink url="http://config.privoxy.org/show-status">http://config.privoxy.org/show-status</ulink>
5195    </para>
5196   </blockquote>
5197  </listitem>
5198  
5199  <listitem>
5200   <para>  
5201     Show the source code version numbers:
5202   </para>
5203   <blockquote>
5204    <para> 
5205     <ulink url="http://config.privoxy.org/show-version">http://config.privoxy.org/show-version</ulink>
5206    </para>
5207   </blockquote>
5208  </listitem>
5209  
5210  <listitem>
5211   <para>  
5212    Show the browser's request headers:
5213   </para>
5214   <blockquote>
5215    <para> 
5216     <ulink url="http://config.privoxy.org/show-request">http://config.privoxy.org/show-request</ulink>
5217    </para>
5218   </blockquote>
5219  </listitem>
5220  
5221  <listitem>
5222   <para>  
5223    Show which actions apply to a URL and why:
5224   </para>
5225    <blockquote>
5226    <para> 
5227     <ulink url="http://config.privoxy.org/show-url-info">http://config.privoxy.org/show-url-info</ulink>
5228    </para>
5229   </blockquote>
5230  </listitem>
5231  
5232  <listitem>
5233   <para>  
5234    Toggle Privoxy on or off. In this case, <quote>Privoxy</quote> continues 
5235    to run, but only as a pass-through proxy, with no actions taking place:
5236   </para>
5237    <blockquote>
5238    <para> 
5239     <ulink url="http://config.privoxy.org/toggle">http://config.privoxy.org/toggle</ulink>
5240    </para>
5241   </blockquote>
5242   <para>
5243    Short cuts. Turn off, then on: 
5244   </para>
5245    <blockquote>
5246    <para> 
5247      <ulink url="http://config.privoxy.org/toggle?set=disable">http://config.privoxy.org/toggle?set=disable</ulink>
5248    </para>
5249   </blockquote>
5250    <blockquote>
5251    <para> 
5252      <ulink url="http://config.privoxy.org/toggle?set=enable">http://config.privoxy.org/toggle?set=enable</ulink>
5253    </para>
5254   </blockquote>
5255  </listitem>
5256  
5257  </itemizedlist>
5258 </para>
5259
5260 <para>
5261  These may be bookmarked for quick reference. See next.
5262
5263 </para>
5264
5265 <sect3 id="bookmarklets">
5266 <title>Bookmarklets</title>
5267 <para>
5268  Below are some <quote>bookmarklets</quote> to allow you to easily access a
5269  <quote>mini</quote> version of some of <application>Privoxy's</application>
5270  special pages. They are designed for MS Internet Explorer, but should work
5271  equally well in Netscape, Mozilla, and other browsers which support
5272  JavaScript. They are designed to run directly from your bookmarks - not by
5273  clicking the links below (although that should work for testing).
5274 </para>
5275 <para>
5276  To save them, right-click the link and choose <quote>Add to Favorites</quote>
5277  (IE) or <quote>Add Bookmark</quote> (Netscape). You will get a warning that
5278  the bookmark <quote>may not be safe</quote> - just click OK. Then you can run the
5279  Bookmarklet directly from your favorites/bookmarks. For even faster access,
5280  you can put them on the <quote>Links</quote> bar (IE) or the <quote>Personal
5281  Toolbar</quote> (Netscape), and run them with a single click. 
5282 </para>
5283
5284 <para>
5285  <itemizedlist>
5286
5287   <listitem>
5288    <para>
5289     <ulink
5290     url="javascript:void(window.open('http://config.privoxy.org/toggle?mini=y&#38;set=enabled','ijbstatus','width=250,height=100,resizable=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());">Privoxy - Enable</ulink>
5291    </para>
5292   </listitem> 
5293
5294   <listitem>
5295    <para>
5296     <ulink
5297     url="javascript:void(window.open('http://config.privoxy.org/toggle?mini=y&#38;set=disabled','ijbstatus','width=250,height=100,resizable=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());">Privoxy - Disable</ulink>
5298    </para>
5299   </listitem> 
5300
5301   <listitem>
5302    <para>
5303     <ulink
5304     url="javascript:void(window.open('http://config.privoxy.org/toggle?mini=y&#38;set=toggle','ijbstatus','width=250,height=100,resizable=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());">Privoxy - Toggle Privoxy</ulink> (Toggles between enabled and disabled)
5305    </para>
5306   </listitem> 
5307
5308   <listitem>
5309    <para>
5310     <ulink
5311     url="javascript:void(window.open('http://config.privoxy.org/toggle?mini=y','ijbstatus','width=250,height=2,resizable=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());">Privoxy- View Status</ulink>
5312    </para>
5313   </listitem> 
5314
5315   <listitem>
5316    <para>
5317     <ulink url="javascript:w=Math.floor(screen.width/2);h=Math.floor(screen.height*0.9);void(window.open('http://www.privoxy.org/actions','Feedback','screenx='+w+',width='+w+',height='+h+',scrollbars=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());">Privoxy - Submit Filter Feedback</ulink>
5318    </para>
5319   </listitem> 
5320
5321  </itemizedlist>
5322 </para>
5323
5324
5325
5326 <para>
5327  Credit: The site which gave me the general idea for these bookmarklets is
5328  <ulink url="http://www.bookmarklets.com">www.bookmarklets.com</ulink>. They
5329  have more information about bookmarklets. 
5330 </para>
5331
5332
5333 </sect3>
5334
5335 </sect2>
5336
5337
5338 <!--   ~~~~~       New section      ~~~~~     -->
5339 <sect2 id="chain">
5340 <title>Chain of Events</title>
5341 <para>
5342  Let's take a quick look at the basic sequence of events when a web page is 
5343  requested by your browser and <application>Privoxy</application> is on duty:
5344 </para>
5345
5346 <para>
5347  <itemizedlist>
5348  <listitem>
5349   <para>
5350    First, your web browser requests a web page. The browser knows to send 
5351    the request to <application>Privoxy</application>, which will in turn, 
5352    relay the request to the remote web server after passing the following 
5353    tests: 
5354   </para>
5355  </listitem> 
5356  <listitem>
5357   <para>
5358    <application>Privoxy</application> traps any request for its own internal CGI 
5359    pages (e.g http://p.p/) and sends the CGI page back to the browser.
5360   </para>
5361  </listitem> 
5362  <listitem>
5363   <para>
5364    Next, <application>Privoxy</application> checks to see if the URL 
5365    matches any <ulink
5366    url="actions-file.html#BLOCK"><quote>+block</quote></ulink> patterns. If
5367    so, the URL is then blocked, and the remote web server will not be contacted.
5368    <ulink url="actions-file.html#HANDLE-AS-IMAGE"><quote>+handle-as-image</quote></ulink> 
5369    is then checked and if it does not match, an 
5370    HTML <quote>BLOCKED</quote> page is sent back. Otherwise, if it does match,
5371    an image is returned. The type of image depends on the setting of <ulink
5372    url="actions-file.html#SET-IMAGE-BLOCKER"><quote>+set-image-blocker</quote></ulink>
5373    (blank, checkerboard pattern, or an HTTP redirect to an image elsewhere).
5374   </para>
5375  </listitem> 
5376  <listitem>
5377   <para>
5378    Untrusted URLs are blocked. If URLs are being added to the
5379    <filename>trust</filename> file, then that is done.
5380   </para>
5381  </listitem> 
5382  <listitem>
5383   <para>
5384    If the URL pattern matches the <ulink
5385    url="actions-file.html#FAST-REDIRECTS"><quote>+fast-redirects</quote></ulink> action,
5386    it is then processed. Unwanted parts of the requested URL are stripped.
5387   </para>
5388  </listitem> 
5389  <listitem>
5390   <para>
5391    Now the rest of the client browser's request headers are processed. If any
5392    of these match any of the relevant actions (e.g. <ulink
5393    url="actions-file.html#HIDE-USER-AGENT"><quote>+hide-user-agent</quote></ulink>,
5394    etc.), headers are suppressed or forged as determined by these actions and
5395    their parameters.
5396   </para>
5397  </listitem> 
5398  <listitem>
5399   <para>
5400    Now the web server starts sending its response back (i.e. typically a web page and related 
5401    data).
5402   </para>
5403  </listitem> 
5404  <listitem>
5405   <para>
5406    First, the server headers are read and processed to determine, among other
5407    things, the MIME type (document type) and encoding. The headers are then
5408    filtered as deterimed by the 
5409    <ulink url="actions-file.html#PREVENT-SETTING-COOKIES"><quote>+prevent-setting-cookies</quote></ulink>,
5410    <ulink url="actions-file.html#SESSION-COOKIES-ONLY"><quote>+session-cookies-only</quote></ulink>,
5411    and <ulink url="actions-file.html#DOWNGRADE-HTTP-VERSION"><quote>+downgrade-http-version</quote></ulink>
5412    actions.
5413   </para>
5414  </listitem> 
5415  <listitem>
5416   <para>
5417    If the <ulink url="actions-file.html#KILL-POPUPS"><quote>+kill-popups</quote></ulink>
5418    action applies, and it is an HTML or JavaScript document, the popup-code in the
5419    response is filtered on-the-fly as it is received.
5420   </para>
5421  </listitem> 
5422  <listitem>
5423   <para>
5424    If a <ulink url="actions-file.html#FILTER"><quote>+filter</quote></ulink>
5425    or <ulink
5426    url="actions-file.html#DEANIMATE-GIFS"><quote>+deanimate-gifs</quote></ulink>
5427    action applies (and the document type fits the action), the rest of the page is
5428    read into memory (up to a configurable limit). Then the filter rules (from
5429    <filename>default.filter</filename>) are processed against the buffered
5430    content. Filters are applied in the order they are specified in the
5431    <filename>default.filter</filename> file. Animated GIFs, if present, are
5432    reduced to either the first or last frame, depending on the action
5433    setting.The entire page, which is now filtered, is then sent by
5434    <application>Privoxy</application> back to your browser. 
5435   </para>
5436   <para>
5437    If neither <ulink url="actions-file.html#FILTER"><quote>+filter</quote></ulink>
5438    or <ulink
5439    url="actions-file.html#DEANIMATE-GIFS"><quote>+deanimate-gifs</quote></ulink>
5440    matches, then <application>Privoxy</application> passes the raw data through 
5441    to the client browser as it becomes available.
5442   </para>
5443  </listitem> 
5444  <listitem>
5445   <para>
5446    As the browser receives the now (probably filtered) page content, it 
5447    reads and then requests any URLs that may be embedded within the page
5448    source, e.g. ad images, stylesheets, JavaScript, other HTML documents (e.g.
5449    frames), sounds, etc. For each of these objects, the browser issues a new
5450    request. And each such request is in turn processed as above. Note that a
5451    complex web page may have many such embedded URLs.
5452   </para>
5453  </listitem> 
5454  
5455  </itemizedlist>
5456 </para>
5457
5458 </sect2>
5459
5460
5461 <!--   ~~~~~       New section      ~~~~~     -->
5462 <sect2 id="actionsanat">
5463 <title>Anatomy of an Action</title>
5464
5465 <para>
5466  The way <application>Privoxy</application> applies 
5467  <ulink url="actions-file.html#ACTIONS"><quote>actions</quote></ulink>
5468  and <ulink url="actions-file.html#FILTER"><quote>filters</quote></ulink>
5469  to any given URL can be complex, and not always so
5470  easy to understand what is happening. And sometimes we need to be able to
5471  <emphasis>see</emphasis> just what <application>Privoxy</application> is
5472  doing. Especially, if something <application>Privoxy</application> is doing
5473  is causing us a problem inadvertently. It can be a little daunting to look at
5474  the actions and filters files themselves, since they tend to be filled with
5475  <quote>regular expressions</quote> whose consequences are not always 
5476  so obvious. 
5477 </para>
5478
5479 <para>
5480  One quick test to see if <application>Privoxy</application> is causing a problem 
5481  or not, is to disable it temporarily. This should be the first troubleshooting 
5482  step. See <link linkend="bookmarklets">the Bookmarklets</link> section on a quick 
5483  and easy way to do this (be sure to flush caches afterward!).
5484 </para>
5485
5486 <para>
5487  <application>Privoxy</application> also provides the 
5488  <ulink url="http://config.privoxy.org/show-url-info">http://config.privoxy.org/show-url-info</ulink>
5489  page that can show us very specifically how <application>actions</application>
5490  are being applied to any given URL. This is a big help for troubleshooting.
5491 </para>
5492
5493 <para>
5494  First, enter one URL (or partial URL) at the prompt, and then
5495  <application>Privoxy</application> will tell us 
5496  how the current configuration will handle it. This will not
5497  help with filtering effects (i.e. the <ulink
5498  url="actions-file.html#FILTER"><quote>+filter</quote></ulink> action) from
5499  the <filename>default.filter</filename> file since this is handled very
5500  differently and not so easy to trap! It also will not tell you about any other
5501  URLs that may be embedded within the URL you are testing. For instance, images
5502  such as ads are expressed as URLs within the raw page source of HTML pages. So
5503  you will only get info for the actual URL that is pasted into the prompt area
5504  -- not any sub-URLs. If you want to know about embedded URLs like ads, you
5505  will have to dig those out of the HTML source. Use your browser's <quote>View
5506  Page Source</quote> option for this. Or right click on the ad, and grab the
5507  URL.
5508 </para>
5509
5510 <para>
5511  Let's try an example, <ulink url="http://google.com">google.com</ulink>, 
5512  and look at it one section at a time:
5513 </para>
5514
5515 <para>
5516  <screen>
5517  Matches for http://google.com:
5518
5519 --- File standard ---
5520 (no matches in this file)
5521
5522 --- File default ---
5523
5524 { -add-header -block +deanimate-gifs{last} -downgrade-http-version +fast-redirects 
5525  -filter{popups} -filter{fun} -filter{shockwave-flash} -filter{crude-parental} 
5526  +filter{html-annoyances} +filter{js-annoyances} +filter{content-cookies} 
5527  +filter{webbugs} +filter{refresh-tags} +filter{nimda} +filter{banners-by-size} 
5528  +hide-forwarded-for-headers +hide-from-header{block} +hide-referer{forge} 
5529  -hide-user-agent -handle-as-image +set-image-blocker{pattern} -limit-connect 
5530  +prevent-compression +session-cookies-only -prevent-reading-cookies 
5531  -prevent-setting-cookies -kill-popups -send-vanilla-wafer -send-wafer }
5532 /
5533
5534  { -session-cookies-only }
5535  .google.com
5536
5537  { -fast-redirects }
5538  .google.com
5539
5540 --- File user ---
5541 (no matches in this file)  
5542 </screen>
5543 </para>
5544
5545 <para>
5546  This tells us how we have defined our 
5547  <ulink url="actions-file.html#ACTIONS"><quote>actions</quote></ulink>, and
5548  which ones match for our example, <quote>google.com</quote>. The first listing
5549  is any matches for the <filename>standard.action</filename> file. No hits at
5550  all here on <quote>standard</quote>. Then next is <quote>default</quote>, or
5551  our <filename>default.action</filename> file. The large, multi-line listing,
5552  is how the actions are set to match for all URLs, i.e. our default settings.
5553  If you look at your <quote>actions</quote> file, this would be the section
5554  just below the <quote>aliases</quote> section near the top. This will apply to
5555  all URLs as signified by the single forward slash at the end of the listing
5556  -- <quote>/</quote>.
5557 </para>
5558
5559 <para>
5560  But we can define additional actions that would be exceptions to these general
5561  rules, and then list specific URLs (or patterns) that these exceptions would
5562  apply to. Last match wins. Just below this then are two explicit matches for
5563  <quote>.google.com</quote>. The first is negating our previous cookie setting, 
5564  which was for <ulink
5565  url="actions-file.html#SESSION-COOKIES-ONLY"><quote>+session-cookies-only</quote></ulink>
5566  (i.e. not persistent). So we will allow persistent cookies for google. The
5567  second turns <emphasis>off</emphasis> any 
5568  <ulink
5569  url="actions-file.html#FAST-REDIRECTS"><quote>+fast-redirects</quote></ulink>
5570  action, allowing this to take place unmolested. Note that there is a leading
5571  dot here -- <quote>.google.com</quote>. This will match any hosts and
5572  sub-domains, in the google.com domain also, such as
5573  <quote>www.google.com</quote>. So, apparently, we have these two actions
5574  defined somewhere in the lower part of our <filename>default.action</filename>
5575  file, and <quote>google.com</quote> is referenced somewhere in these latter
5576  sections.
5577 </para>
5578
5579 <para>
5580  Then, for our <filename>user.action</filename> file, we again have no hits.
5581 </para>
5582
5583 <para>
5584  And finally we pull it all together in the bottom section and summarize how
5585  <application>Privoxy</application> is applying all its <quote>actions</quote> 
5586  to <quote>google.com</quote>:
5587
5588 </para>
5589
5590 <para>
5591  <screen>
5592
5593  Final results:
5594  -add-header -block +deanimate-gifs{last} -downgrade-http-version -fast-redirects 
5595  -filter{popups} -filter{fun} -filter{shockwave-flash} -filter{crude-parental} 
5596  +filter{html-annoyances} +filter{js-annoyances} +filter{content-cookies} 
5597  +filter{webbugs} +filter{refresh-tags} +filter{nimda} +filter{banners-by-size} 
5598  +hide-forwarded-for-headers +hide-from-header{block} +hide-referer{forge} 
5599  -hide-user-agent -handle-as-image +set-image-blocker{pattern} -limit-connect 
5600  +prevent-compression -session-cookies-only -prevent-reading-cookies 
5601  -prevent-setting-cookies -kill-popups -send-vanilla-wafer -send-wafer
5602 </screen>
5603 </para>
5604
5605 <para>
5606  Notice the only difference here to the previous listing, is to 
5607  <quote>fast-redirects</quote> and <quote>session-cookies-only</quote>.
5608 </para>
5609
5610 <para>
5611  Now another example, <quote>ad.doubleclick.net</quote>:
5612 </para>
5613
5614 <para>
5615  <screen>
5616
5617  { +block +handle-as-image }
5618   .ad.doubleclick.net
5619
5620  { +block +handle-as-image }
5621   ad*.
5622
5623  { +block +handle-as-image }
5624   .doubleclick.net
5625 </screen>
5626 </para>
5627
5628 <para>
5629  We'll just show the interesting part here, the explicit matches. It is 
5630  matched three different times. Each as an <quote>+block +handle-as-image</quote>,
5631  which is the expanded form of one of our aliases that had been defined as: 
5632  <quote>+imageblock</quote>. (<ulink
5633  url="actions-file.html#ALIASES"><quote>Aliases</quote></ulink> are defined in
5634  the first section of the actions file and typically used to combine more 
5635  than one action.)
5636 </para>
5637
5638 <para>
5639  Any one of these would have done the trick and blocked this as an unwanted 
5640  image. This is unnecessarily redundant since the last case effectively 
5641  would also cover the first. No point in taking chances with these guys 
5642  though ;-) Note that if you want an ad or obnoxious 
5643  URL to be invisible, it should be defined as <quote>ad.doubleclick.net</quote>
5644  is done here -- as both a <ulink
5645  url="actions-file.html#BLOCK"><quote>+block</quote></ulink>
5646  <emphasis>and</emphasis> an 
5647  <ulink
5648  url="actions-file.html#HANDLE-AS-IMAGE"><quote>+handle-as-image</quote></ulink>.
5649  The custom alias <quote>+imageblock</quote> just simplifies the process and make 
5650  it more readable.
5651 </para>
5652
5653 <para>
5654  One last example. Let's try <quote>http://www.rhapsodyk.net/adsl/HOWTO/</quote>.
5655  This one is giving us problems. We are getting a blank page. Hmmm...
5656 </para>
5657
5658 <para>
5659  <screen>
5660
5661  Matches for http://www.rhapsodyk.net/adsl/HOWTO/:
5662
5663  { -add-header -block +deanimate-gifs -downgrade-http-version +fast-redirects 
5664    +filter{html-annoyances} +filter{js-annoyances} +filter{kill-popups} 
5665    +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal} 
5666    +filter{fun} +hide-forwarded-for-headers +hide-from-header{block} 
5667    +hide-referer{forge} -hide-user-agent -handle-as-image +set-image-blocker{blank} 
5668    +prevent-compression +session-cookies-only -prevent-setting-cookies 
5669    -prevent-reading-cookies +kill-popups -send-vanilla-wafer -send-wafer }
5670    /
5671
5672  { +block +handle-as-image }
5673   /ads
5674 </screen>
5675 </para>
5676
5677 <para>
5678  Ooops, the <quote>/adsl/</quote> is matching <quote>/ads</quote>! But 
5679  we did not want this at all! Now we see why we get the blank page. We could
5680  now add a new action below this that explicitly does <emphasis>not</emphasis>
5681  block (<quote>{-block}</quote>) paths with <quote>adsl</quote>. There are
5682  various ways to handle such exceptions. Example:
5683 </para>
5684
5685 <para>
5686  <screen>
5687
5688  { -block }
5689   /adsl
5690 </screen>
5691 </para>
5692
5693 <para>
5694  Now the page displays ;-) Be sure to flush your browser's caches when 
5695  making such changes. Or, try using <literal>Shift+Reload</literal>.
5696 </para>
5697
5698 <para>
5699  But now what about a situation where we get no explicit matches like 
5700  we did with:
5701 </para>
5702
5703 <para>
5704  <screen>
5705
5706  { +block +handle-as-image }
5707  /ads
5708 </screen>
5709 </para>
5710
5711 <para>
5712  That actually was very telling and pointed us quickly to where the problem
5713  was. If you don't get this kind of match, then it means one of the default 
5714  rules in the first section is causing the problem. This would require some 
5715  guesswork, and maybe a little trial and error to isolate the offending rule.
5716  One likely cause would be one of the <quote>{+filter}</quote> actions. Try 
5717  adding the URL for the site to one of aliases that turn off <quote>+filter</quote>:
5718 </para>
5719
5720 <para>
5721  <screen>
5722
5723  {shop}
5724  .quietpc.com
5725  .worldpay.com   # for quietpc.com
5726  .jungle.com
5727  .scan.co.uk
5728  .forbes.com
5729 </screen>
5730 </para>
5731
5732 <para>
5733  <quote>{shop}</quote> is an <quote>alias</quote> that expands to 
5734  <quote>{ -filter -session-cookies-only }</quote>.
5735  Or you could do your own exception to negate filtering:
5736
5737 </para>
5738
5739 <para>
5740  <screen>
5741
5742  {-filter}
5743  .forbes.com
5744 </screen>
5745 </para>
5746
5747 <para>
5748  This would probably be most appropriately put in <filename>user.action</filename>, 
5749  for local site exceptions.
5750 </para>
5751
5752 <para>
5753  <quote>{fragile}</quote> is an alias that disables most actions. This can be 
5754  used as a last resort for problem sites. Remember to flush caches! If this 
5755  still does not work, you will have to go through the remaining actions one by
5756  one to find which one(s) is causing the problem.
5757 </para>
5758
5759 </sect2>
5760
5761 </sect1>
5762
5763  <!--
5764
5765  This program is free software; you can redistribute it 
5766  and/or modify it under the terms of the GNU General
5767  Public License as published by the Free Software
5768  Foundation; either version 2 of the License, or (at
5769  your option) any later version.
5770
5771  This program is distributed in the hope that it will
5772  be useful, but WITHOUT ANY WARRANTY; without even the
5773  implied warranty of MERCHANTABILITY or FITNESS FOR A
5774  PARTICULAR PURPOSE.  See the GNU General Public
5775  License for more details.
5776
5777  The GNU General Public License should be included with
5778  this file.  If not, you can view it at
5779  http://www.gnu.org/copyleft/gpl.html
5780  or write to the Free Software Foundation, Inc., 59
5781  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
5782
5783  $Log: user-manual.sgml,v $
5784  Revision 1.98  2002/04/28 05:43:59  hal9
5785  This is the break up of configuration.html into multiple files. This
5786  will probably break links elsewhere :(
5787
5788  Revision 1.97  2002/04/27 21:04:42  hal9
5789  -Rewrite of Actions File example.
5790  -Add section for user-manual directive in config.
5791
5792  Revision 1.96  2002/04/27 05:32:00  hal9
5793  -Add short section to Filter Files to tie in with +filter action.
5794  -Start rewrite of examples in Actions Examples (not finished).
5795
5796  Revision 1.95  2002/04/26 17:23:29  swa
5797  bookmarks cleaned, changed structure of user manual, screen and programlisting cleanups, and numerous other changes that I forgot
5798
5799  Revision 1.94  2002/04/26 05:24:36  hal9
5800  -Add most of Andreas suggestions to Chain of Events section.
5801  -A few other minor corrections and touch up.
5802
5803  Revision 1.92  2002/04/25 18:55:13  hal9
5804  More catchups on new actions files, and new actions names.
5805  Other assorted cleanups, and minor modifications.
5806
5807  Revision 1.91  2002/04/24 02:39:31  hal9
5808  Add 'Chain of Events' section.
5809
5810  Revision 1.90  2002/04/23 21:41:25  hal9
5811  Linuxconf is deprecated on RH, substitute chkconfig.
5812
5813  Revision 1.89  2002/04/23 21:05:28  oes
5814  Added hint for startup on Red Hat
5815
5816  Revision 1.88  2002/04/23 05:37:54  hal9
5817  Add AmigaOS install stuff.
5818
5819  Revision 1.87  2002/04/23 02:53:15  david__schmidt
5820  Updated OSX installation section
5821  Added a few English tweaks here an there
5822
5823  Revision 1.86  2002/04/21 01:46:32  hal9
5824  Re-write actions section.
5825
5826  Revision 1.85  2002/04/18 21:23:23  hal9
5827  Fix ugly typo (mine).
5828
5829  Revision 1.84  2002/04/18 21:17:13  hal9
5830  Spell Redhat correctly (ie Red Hat). A few minor grammar corrections.
5831
5832  Revision 1.83  2002/04/18 18:21:12  oes
5833  Added RPM install detail
5834
5835  Revision 1.82  2002/04/18 12:04:50  oes
5836  Cosmetics
5837
5838  Revision 1.81  2002/04/18 11:50:24  oes
5839  Extended Install section - needs fixing by packagers
5840
5841  Revision 1.80  2002/04/18 10:45:19  oes
5842  Moved text to buildsource.sgml, renamed some filters, details
5843
5844  Revision 1.79  2002/04/18 03:18:06  hal9
5845  Spellcheck, and minor touchups.
5846
5847  Revision 1.78  2002/04/17 18:04:16  oes
5848  Proofreading part 2
5849
5850  Revision 1.77  2002/04/17 13:51:23  oes
5851  Proofreading, part one
5852
5853  Revision 1.76  2002/04/16 04:25:51  hal9
5854  -Added 'Note to Upgraders' and re-ordered the 'Quickstart' section.
5855  -Note about proxy may need requests to re-read config files.
5856
5857  Revision 1.75  2002/04/12 02:08:48  david__schmidt
5858  Remove OS/2 building info... it is already in the developer-manual
5859
5860  Revision 1.74  2002/04/11 00:54:38  hal9
5861  Add small section on submitting actions.
5862
5863  Revision 1.73  2002/04/10 18:45:15  swa
5864  generated
5865
5866  Revision 1.72  2002/04/10 04:06:19  hal9
5867  Added actions feedback  to Bookmarklets section
5868
5869  Revision 1.71  2002/04/08 22:59:26  hal9
5870  Version update. Spell chkconfig correctly :)
5871
5872  Revision 1.70  2002/04/08 20:53:56  swa
5873  ?
5874
5875  Revision 1.69  2002/04/06 05:07:29  hal9
5876  -Add privoxy-man-page.sgml, for man page.
5877  -Add authors.sgml for AUTHORS (and p-authors.sgml)
5878  -Reworked various aspects of various docs.
5879  -Added additional comments to sub-docs.
5880
5881  Revision 1.68  2002/04/04 18:46:47  swa
5882  consistent look. reuse of copyright, history et. al.
5883
5884  Revision 1.67  2002/04/04 17:27:57  swa
5885  more single file to be included at multiple points. make maintaining easier
5886
5887  Revision 1.66  2002/04/04 06:48:37  hal9
5888  Structural changes to allow for conditional inclusion/exclusion of content
5889  based on entity toggles, e.g. 'entity % p-not-stable  "INCLUDE"'. And
5890  definition of internal entities, e.g. 'entity p-version "2.9.13"' that will
5891  eventually be set by Makefile.
5892  More boilerplate text for use across multiple docs.
5893
5894  Revision 1.65  2002/04/03 19:52:07  swa
5895  enhance squid section due to user suggestion
5896
5897  Revision 1.64  2002/04/03 03:53:43  hal9
5898  A few minor bug fixes, and touch ups. Ready for review.
5899
5900  Revision 1.63  2002/04/01 16:24:49  hal9
5901  Define entities to include boilerplate text. See doc/source/*.
5902
5903  Revision 1.62  2002/03/30 04:15:53  hal9
5904  - Fix privoxy.org/config links.
5905  - Paste in Bookmarklets from Toggle page.
5906  - Move Quickstart nearer top, and minor rework.
5907
5908  Revision 1.61  2002/03/29 01:31:08  hal9
5909  Minor update.
5910
5911  Revision 1.60  2002/03/27 01:57:34  hal9
5912  Added more to Anatomy section.
5913
5914  Revision 1.59  2002/03/27 00:54:33  hal9
5915  Touch up intro for new name.
5916
5917  Revision 1.58  2002/03/26 22:29:55  swa
5918  we have a new homepage!
5919
5920  Revision 1.57  2002/03/24 20:33:30  hal9
5921  A few minor catch ups with name change.
5922
5923  Revision 1.56  2002/03/24 16:17:06  swa
5924  configure needs to be generated.
5925
5926  Revision 1.55  2002/03/24 16:08:08  swa
5927  we are too lazy to make a block-built
5928  privoxy logo. hence removed the option.
5929
5930  Revision 1.54  2002/03/24 15:46:20  swa
5931  name change related issue.
5932
5933  Revision 1.53  2002/03/24 11:51:00  swa
5934  name change. changed filenames.
5935
5936  Revision 1.52  2002/03/24 11:01:06  swa
5937  name change
5938
5939  Revision 1.51  2002/03/23 15:13:11  swa
5940  renamed every reference to the old name with foobar.
5941  fixed "application foobar application" tag, fixed
5942  "the foobar" with "foobar". left junkbustser in cvs
5943  comments and remarks to history untouched.
5944
5945  Revision 1.50  2002/03/23 05:06:21  hal9
5946  Touch up.
5947
5948  Revision 1.49  2002/03/21 17:01:05  hal9
5949  New section in Appendix.
5950
5951  Revision 1.48  2002/03/12 06:33:01  hal9
5952  Catching up to Andreas and re_filterfile changes.
5953
5954  Revision 1.47  2002/03/11 13:13:27  swa
5955  correct feedback channels
5956
5957  Revision 1.46  2002/03/10 00:51:08  hal9
5958  Added section on JB internal pages in Appendix.
5959
5960  Revision 1.45  2002/03/09 17:43:53  swa
5961  more distros
5962
5963  Revision 1.44  2002/03/09 17:08:48  hal9
5964  New section on Jon's actions file editor, and move some stuff around.
5965
5966  Revision 1.43  2002/03/08 00:47:32  hal9
5967  Added imageblock{pattern}.
5968
5969  Revision 1.42  2002/03/07 18:16:55  swa
5970  looks better
5971
5972  Revision 1.41  2002/03/07 16:46:43  hal9
5973  Fix a few markup problems for jade.
5974
5975  Revision 1.40  2002/03/07 16:28:39  swa
5976  provide correct feedback channels
5977
5978  Revision 1.39  2002/03/06 16:19:28  hal9
5979  Note on perceived filtering slowdown per FR.
5980
5981  Revision 1.38  2002/03/05 23:55:14  hal9
5982  Stupid I did it again. Double hyphen in comment breaks jade.
5983
5984  Revision 1.37  2002/03/05 23:53:49  hal9
5985  jade barfs on '- -' embedded in comments. - -user option broke it.
5986
5987  Revision 1.36  2002/03/05 22:53:28  hal9
5988  Add new - - user option.
5989
5990  Revision 1.35  2002/03/05 00:17:27  hal9
5991  Added section on command line options.
5992
5993  Revision 1.34  2002/03/04 19:32:07  oes
5994  Changed default port to 8118
5995
5996  Revision 1.33  2002/03/03 19:46:13  hal9
5997  Emphasis on where/how to report bugs, etc
5998
5999  Revision 1.32  2002/03/03 09:26:06  joergs
6000  AmigaOS changes, config is now loaded from PROGDIR: instead of
6001  AmiTCP:db/junkbuster/ if no configuration file is specified on the
6002  command line.
6003
6004  Revision 1.31  2002/03/02 22:45:52  david__schmidt
6005  Just tweaking
6006
6007  Revision 1.30  2002/03/02 22:00:14  hal9
6008  Updated 'New Features' list. Ran through spell-checker.
6009
6010  Revision 1.29  2002/03/02 20:34:07  david__schmidt
6011  Update OS/2 build section
6012
6013  Revision 1.28  2002/02/24 14:34:24  jongfoster
6014  Formatting changes.  Now changing the doctype to DocBook XML 4.1
6015  will work - no other changes are needed.
6016
6017  Revision 1.27  2002/01/11 14:14:32  hal9
6018  Added a very short section on Templates
6019
6020  Revision 1.26  2002/01/09 20:02:50  hal9
6021  Fix bug re: auto-detect config file changes.
6022
6023  Revision 1.25  2002/01/09 18:20:30  hal9
6024  Touch ups for *.action files.
6025
6026  Revision 1.24  2001/12/02 01:13:42  hal9
6027  Fix typo.
6028
6029  Revision 1.23  2001/12/02 00:20:41  hal9
6030  Updates for recent changes.
6031
6032  Revision 1.22  2001/11/05 23:57:51  hal9
6033  Minor update for startup now daemon mode.
6034
6035  Revision 1.21  2001/10/31 21:11:03  hal9
6036  Correct 2 minor errors
6037
6038  Revision 1.18  2001/10/24 18:45:26  hal9
6039  *** empty log message ***
6040
6041  Revision 1.17  2001/10/24 17:10:55  hal9
6042  Catching up with Jon's recent work, and a few other things.
6043
6044  Revision 1.16  2001/10/21 17:19:21  swa
6045  wrong url in documentation
6046
6047  Revision 1.15  2001/10/14 23:46:24  hal9
6048  Various minor changes. Fleshed out SEE ALSO section.
6049
6050  Revision 1.13  2001/10/10 17:28:33  hal9
6051  Very minor changes.
6052
6053  Revision 1.12  2001/09/28 02:57:04  hal9
6054  Ditto :/
6055
6056  Revision 1.11  2001/09/28 02:25:20  hal9
6057  Ditto.
6058
6059  Revision 1.9  2001/09/27 23:50:29  hal9
6060  A few changes. A short section on regular expression in appendix.
6061
6062  Revision 1.8  2001/09/25 00:34:59  hal9
6063  Some additions, and re-arranging.
6064
6065  Revision 1.7  2001/09/24 14:31:36  hal9
6066  Diddling.
6067
6068  Revision 1.6  2001/09/24 14:10:32  hal9
6069  Including David's OS/2 installation instructions.
6070
6071  Revision 1.2  2001/09/13 15:27:40  swa
6072  cosmetics
6073
6074  Revision 1.1  2001/09/12 15:36:41  swa
6075  source files for junkbuster documentation
6076
6077  Revision 1.3  2001/09/10 17:43:59  swa
6078  first proposal of a structure.
6079
6080  Revision 1.2  2001/06/13 14:28:31  swa
6081  docs should have an author.
6082
6083  Revision 1.1  2001/06/13 14:20:37  swa
6084  first import of project's documentation for the webserver.
6085
6086  -->
6087
6088 </article>