more single file to be included at multiple points. make maintaining easier
[privoxy.git] / doc / source / user-manual.sgml
1 <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
2 <!entity % dummy "INCLUDE"> 
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.13">
12 <!entity p-status "BETA">
13 <!entity % p-not-stable "INCLUDE"> <!-- set to IGNORE for stable release  -->
14 <!entity % p-stable "IGNORE">      <!-- set INCLUDE for stable release    -->
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-supp-userman "IGNORE"> <!-- Omit some from supported.sgml    -->
19 ]>
20 <!--
21  File        :  $Source: /cvsroot/ijbswa/current/doc/source/user-manual.sgml,v $
22
23  Purpose     :  user manual
24                 This file belongs into
25                 ijbswa.sourceforge.net:/home/groups/i/ij/ijbswa/htdocs/
26                 
27  $Id: user-manual.sgml,v 1.66 2002/04/04 06:48:37 hal9 Exp $
28
29  Written by and Copyright (C) 2001 the SourceForge
30  Privoxy team. http://www.privoxy.org/
31
32  Based on the Internet Junkbuster originally written
33  by and Copyright (C) 1997 Anonymous Coders and 
34  Junkbusters Corporation.  http://www.junkbusters.com
35
36 -->
37
38 <article id="index">
39 <artheader>
40 <title>Privoxy User Manual</title>
41
42 <pubdate>$Id: user-manual.sgml,v 1.66 2002/04/04 06:48:37 hal9 Exp $</pubdate>
43
44 <authorgroup>
45  <author>
46   <affiliation>
47    <orgname>By: Privoxy Developers</orgname>
48    </affiliation>
49  </author>
50 </authorgroup>
51
52 <abstract>
53 <![%dummy;[
54  <para>
55  <comment>
56   This is here to keep vim syntax file from breaking :/
57   If I knew enough to fix it, I would.
58   PLEASE DO NOT REMOVE! HB: hal@foobox.net
59  </comment>
60  </para>
61 ]]>
62
63  <para>
64   The user manual gives users information on how to install, configure and use
65   <application>Privoxy</application>.
66   </para>
67
68 <!--
69  Include privoxy.sgml boilerplate:
70 -->
71  &p-intro;
72
73  <para>
74   You can find the latest version of the user manual at  <ulink
75   url="http://www.privoxy.org/user-manual/">http://www.privoxy.org/user-manual/</ulink>.
76   </para>
77
78 <!--   <para> -->
79 <!--    Feel free to send a note to the developers at <email>ijbswa-developers@lists.sourceforge.net</email>. -->
80 <!--   </para> -->
81 </abstract>
82
83 </artheader>
84
85
86 <!--   ~~~~~       New section      ~~~~~     -->
87
88 <sect1 id="introduction"><title>Introduction</title>
89
90 <para>
91  This documentation is included with the current &p-status; version of
92  <application>Privoxy</application> and is mostly complete at this
93  point. The most up to date reference for the time being is still the comments
94  in the source files and in the individual configuration files. Development
95  of version 3.0 is currently nearing completion, and includes many significant
96  changes and enhancements over earlier versions. The target release date for
97  stable v3.0 is <quote>soon</quote> ;-)
98 </para>
99
100 <![%p-not-stable;[
101 <!-- include only in non-stable versions -->
102 <para>
103  Since this is a &p-status; version, not all new features are well tested. This
104  documentation may be slightly out of sync as a result (especially with 
105  CVS sources). And there <emphasis>may be</emphasis> bugs, though hopefully
106  not many! 
107 </para>
108 ]]>
109
110 <!--   ~~~~~       New section      ~~~~~     -->
111 <sect2>
112 <title>New Features</title>
113 <para>
114  In addition to <application>Internet Junkbuster's</application> traditional
115  feature of ad and banner blocking and cookie management,
116  <application>Privoxy</application> provides new features<![%p-not-stable;[,
117  some of them currently under development]]>:
118 </para>
119
120 <!-- Include newfeatures.sgml boilerplate here: -->
121  &newfeatures;
122 <!-- end boilerplate -->
123
124 </sect2>
125
126 </sect1>
127
128 <!--  ~  End section  ~  -->
129
130
131 <!--   ~~~~~       New section      ~~~~~     -->
132 <sect1 id="installation"><title>Installation</title>
133 <para>
134  <application>Privoxy</application> is available as raw source code (tarball 
135  or via CVS), or pre-compiled binaries for various platforms. See the <ulink
136  url="http://sourceforge.net/projects/ijbswa/">Privoxy Project Page</ulink> for
137  the most up to date release information.
138  <application>Privoxy</application> is also available via <ulink
139  url="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/ijbswa/current/">CVS</ulink>.
140  <![%p-not-stable;[This is the recommended approach at this time.]]> But
141  please be aware that CVS is constantly changing, and it may break in
142  mysterious ways.
143 </para>
144
145 <!-- Include supported.sgml boilerplate -->
146  &supported;
147 <!-- end boilerplate -->
148
149 <!--   ~~~~~       New section      ~~~~~     -->
150 <sect2 id="installation-source"><title>Source</title>
151
152
153 <!-- include buildsource.sgml boilerplate: -->
154  &buildsource;
155 <!-- end boilerplate -->
156
157 <para>
158  For Redhat and SuSE Linux RPM packages, see below.
159 </para>
160
161
162 <!--   ~~~~~       New section      ~~~~~     -->
163 <sect3 id="installation-rh"><title>Red Hat</title>
164 <para>
165  To build Redhat RPM packages from source, install source as above. Then:
166 </para>
167
168 <para>
169  <screen>
170  autoheader
171  autoconf
172  ./configure
173  make redhat-dist
174  </screen>
175 </para>
176
177 <para>
178  This will create both binary and src RPMs in the usual places. Example:
179 </para>
180
181 <para>
182  &nbsp;&nbsp;&nbsp;/usr/src/redhat/RPMS/i686/privoxy-&p-version;-1.i686.rpm
183 </para>
184 <para>
185  &nbsp;&nbsp;&nbsp;/usr/src/redhat/SRPMS/privoxy-&p-version;-1.src.rpm
186 </para>
187
188 <para>
189  To install, of course:
190 </para>
191
192 <para>
193  <screen>
194  rpm -Uvv /usr/src/redhat/RPMS/i686/privoxy-&p-version;-1.i686.rpm
195  </screen>
196 </para>
197
198 <para>
199  This will place the <application>Privoxy</application> configuration 
200  files in <filename>/etc/privoxy/</filename>, and log files in 
201  <filename>/var/log/privoxy/</filename>. Run 
202  <command>ckconfig privoxy on</command> to have
203  <application>Privoxy</application> start automatically during init.
204
205 </para>
206
207 </sect3>
208
209 <!--   ~~~~~       New section      ~~~~~     -->
210 <sect3 id="installation-suse"><title>SuSE</title>
211 <para>
212  To build SuSE RPM packages, install source as above. Then:
213 </para>
214
215 <para>
216  <screen>
217  autoheader
218  autoconf
219  ./configure
220  make suse-dist
221  </screen>
222 </para>
223
224 <para>
225  This will create both binary and src RPMs in the usual places. Example:
226 </para>
227
228 <para>
229  &nbsp;&nbsp;&nbsp;/usr/src/packages/RPMS/i686/privoxy-&p-version;-1.i686.rpm
230 </para>
231 <para>
232  &nbsp;&nbsp;&nbsp;/usr/src/packages/SRPMS/privoxy-&p-version;-1.src.rpm
233 </para>
234
235 <para>
236  To install, of course:
237 </para>
238
239 <para>
240  <screen>
241  rpm -Uvv /usr/src/packages/RPMS/i686/privoxy-&p-version;-1.i686.rpm
242  </screen>
243 </para>
244
245 <para>
246  This will place the <application>Privoxy</application> configuration 
247  files in <filename>/etc/privoxy/</filename>, and log files in 
248  <filename>/var/log/privoxy/</filename>. 
249 </para>
250
251 </sect3>
252
253
254 <!--   ~~~~~       New section      ~~~~~     -->
255 <sect3 id="installation-os2"><title>OS/2</title>
256
257 <!--
258 Thanx David Schmidt!
259 -->
260
261 <para>
262  <application>Privoxy</application> is packaged in a WarpIN self-
263  installing archive.  The self-installing program will be named depending
264  on the release version, something like:
265  <filename>privoxyos2_setup_&p-version;.exe</filename>.  In order to install it, simply
266  run this executable or double-click on its icon and follow the WarpIN
267  installation panels.  A shadow of the <application>Privoxy</application>
268  executable will be placed in your startup folder so it will start 
269  automatically whenever OS/2 starts.
270 </para>
271
272 <para>
273  The directory you choose to install <application>Privoxy</application>
274  into will contain all of the configuration files.
275 </para>
276
277 <para>
278  If you would like to build binary images on OS/2 yourself, you will need
279  a few Unix-like tools: autoconf, autoheader and sh.  These tools will be
280  used to create the required config.h file, which is not part of the 
281  source distribution because it differs based on platform.  You will also
282  need a compiler.
283  The distribution has been created using IBM VisualAge compilers, but you
284  can use any compiler you like.  GCC/EMX has the disadvantage of needing 
285  to be single-threaded due to a limitation of EMX's implementation of the
286  select() socket call.
287 </para>
288
289 <para>
290  In addition to needing the source code distribution as outlined earlier,
291  you will want to extract the <filename>os2seutp</filename> directory from CVS:
292  <screen>
293  cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login          
294  cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co os2setup
295  </screen>
296  This will create a directory named os2setup/, which will contain the
297  <filename>Makefile.vac</filename> makefile and <filename>os2build.cmd</filename>
298  which is used to completely create the binary distribution.  The sequence
299  of events for building the executable for yourself goes something like this:
300  <screen>
301  cd current
302  autoheader
303  autoconf
304  sh configure
305  cd ..\os2setup
306  nmake -f Makefile.vac
307  </screen>
308  You will see this sequence laid out in <filename>os2build.cmd</filename>.
309 </para>
310
311 </sect3>
312
313
314 <!--   ~~~~~       New section      ~~~~~     -->
315 <sect3 id="installation-win"><title>Windows</title>
316 <para>Click-click. (I need help on this. Not a clue here. Also for 
317 configuration section below. HB.)
318 </para>
319 </sect3>
320
321 <!--   ~~~~~       New section      ~~~~~     -->
322 <sect3 id="installation-other"><title>Other</title>
323 <para>
324  Some quick notes on other Operating Systems.
325 </para>
326
327 <para>
328  For FreeBSD (and other *BSDs?), the build will require <command>gmake</command> 
329  instead of the included <command>make</command>. <command>gmake</command> is
330  available from <ulink url="http://www.gnu.org">http://www.gnu.org</ulink>.
331  The rest should be the same as above for Linux/Unix.
332 </para>
333
334 </sect3>
335 </sect2>
336
337 </sect1>
338
339 <!--  ~  End section  ~  -->
340
341
342 <!--   ~~~~~       New section      ~~~~~     -->
343
344 <sect1 id="quickstart"><title>Quickstart to Using <application>Privoxy</application></title>
345 <para>
346  Before launching <application>Privoxy</application> for the first time, you 
347  will want to configure your browser(s) to use <application>Privoxy</application>
348  as a HTTP and HTTPS proxy. The default is localhost for the proxy address,
349  and port 8118 (earlier versions used port 800). This is the one required 
350  configuration that must be done! 
351 </para>
352  
353 <para> 
354  With <application>Netscape</application> (and
355  <application>Mozilla</application>), this can be set under <literal>Edit
356  -&gt; Preferences -&gt; Advanced -&gt; Proxies -&gt; HTTP Proxy</literal>.
357  For <application>Internet Explorer</application>: <literal>Tools -&gt;
358  Internet Properties -&gt; Connections -&gt; LAN Setting</literal>. Then,
359  check <quote>Use Proxy</quote> and fill in the appropriate info (Address:
360  localhost, Port: 8118). Include if HTTPS proxy support too.
361 </para>
362
363 <para>
364  After doing this, flush your browser's disk and memory caches to force a
365  re-reading of all pages and get rid of any ads that may be cached. You 
366  are now ready to start enjoying the benefits of using
367  <application>Privoxy</application>.
368 </para>
369
370
371 <para>
372  <application>Privoxy</application> is typically started by specifying the
373  main configuration file to be used on the command line. Example Unix startup
374  command:
375 </para>
376
377 <para>
378  <screen>
379  
380  # /usr/sbin/privoxy /etc/privoxy/config
381  
382  </screen>
383 </para>
384
385 <para>
386  An init script is provided for SuSE and Redhat.
387 </para>
388
389 <para>
390 For for SuSE: /etc/rc.d/privoxy start
391 </para>
392
393 <para>
394 For RedHat: /etc/rc.d/init.d/privoxy start
395 </para>
396
397
398 <para>
399  If no configuration file is specified on the command line,
400  <application>Privoxy</application> will look for a file named
401  <filename>config</filename> in the current directory. Except on Win32 where
402  it will try <filename>config.txt</filename>. If no file is specified on the
403  command line and no default configuration file can be found, 
404  <application>Privoxy</application> will fail to start.
405 </para>
406
407
408 <para>
409  The included default configuration files should give a reasonable starting
410  point, though may be somewhat aggressive in blocking junk. Most of the 
411  per site configuration is done in the <quote>actions</quote> files. These 
412  are where various cookie actions are defined, ad and banner blocking, 
413  and other aspects of <application>Privoxy</application> configuration. There 
414  are several such files included, with varying levels of aggressiveness. 
415 </para>
416
417 <para>
418  You will probably want to keep an eye out for sites that require persistent
419  cookies, and add these to <filename>default.action</filename> as needed. By
420  default, most of these will be accepted only during the current browser
421  session, until you add them to the configuration. If you want the browser to
422  handle this instead, you will need to edit
423  <filename>default.action</filename> and disable this feature. If you use more
424  than one browser, it would make more sense to let
425  <application>Privoxy</application> handle this. In which case, the browser(s)
426  should be set to accept all cookies.
427 </para>
428
429 <para>
430  <application>Privoxy</application> is HTTP/1.1 compliant,  but not all 1.1
431  features are as yet implemented. If browsers that support HTTP/1.1 (like
432  <application>Mozilla</application> or recent versions of I.E.) experience
433  problems, you might try to force HTTP/1.0 compatibility. For Mozilla, look
434  under <literal>Edit -&gt; Preferences -&gt; Debug -&gt; Networking</literal>.
435  Or set the <quote>+downgrade</quote> config option in
436  <filename>default.action</filename>.
437 </para>
438
439 <para>
440  After running <application>Privoxy</application> for a while, you can 
441  start to fine tune the configuration to suit your personal, or site, 
442  preferences and requirements. There are many, many aspects that can 
443  be customized. <quote>Actions</quote> (as specified in <filename>default.action</filename>) 
444  can be adjusted by pointing your browser to 
445  <ulink url="http://p.p/">http://p.p/</ulink>, 
446  and then follow the link to <quote>edit the actions list</quote>. 
447  (This is an internal page and does not require Internet access.)
448 </para>
449
450 <para>
451  In fact, various aspects of <application>Privoxy</application>
452  configuration can be viewed from this page, including 
453  current configuration parameters, source code version numbers, 
454  the browser's request headers, and <quote>actions</quote> that apply 
455  to a given URL. In addition to the <filename>default.action</filename> file 
456  editor mentioned above, <application>Privoxy</application> can also 
457  be turned <quote>on</quote> and <quote>off</quote> from this page.
458 </para>
459
460 <para>
461  If you encounter problems, please verify it is a
462  <application>Privoxy</application> bug, by disabling
463  <application>Privoxy</application>, and then trying the same page. 
464  Also, try another browser if possible to eliminate browser or site 
465  problems. Before reporting it as a bug, see if there is not a configuration
466  option that is enabled that is causing the page not to load. You can then add
467  an exception for that page or site. For instance, try adding it to the
468  <literal>{fragile}</literal> section of <filename>default.action</filename>.
469  This will turn off most actions for this site. For more on troubleshooting
470  problem sites, see the <ulink
471  url="appendix.html#ACTIONSANAT">Appendix</ulink>. If a bug, please report it
472  to the developers (see below). 
473 </para>
474
475
476 <!--   ~~~~~       New section      ~~~~~     -->
477
478 <sect2>
479 <title>Command Line Options</title>
480 <para>
481  <application>Privoxy</application> may be invoked with the following
482  command-line options:
483 </para>
484
485 <para>
486  <itemizedlist>
487
488  <listitem>
489   <para>
490     <emphasis>--version</emphasis>
491   </para>
492   <para>
493      Print version info and exit, Unix only.
494   </para>
495  </listitem> 
496  <listitem>
497   <para>
498     <emphasis>--help</emphasis>
499   </para>
500   <para>
501    Print a short usage info and exit, Unix only.
502   </para>
503  </listitem> 
504  <listitem>
505   <para>
506    <emphasis>--no-daemon</emphasis>
507   </para>
508   <para>
509    Don't become a daemon, i.e. don't fork and become process group
510    leader, don't detach from controlling tty. Unix only.
511   </para>
512  </listitem> 
513  <listitem>
514   <para>
515    <emphasis>--pidfile FILE</emphasis>
516   
517   </para>
518   <para>
519    On startup, write the process ID to <emphasis>FILE</emphasis>. Delete the
520    <emphasis>FILE</emphasis> on exit. Failiure to create or delete the
521    <emphasis>FILE</emphasis> is non-fatal. If no <emphasis>FILE</emphasis>
522    option is given, no PID file will be used. Unix only.
523   </para>
524  </listitem> 
525  <listitem>
526   <para>
527    <emphasis>--user USER[.GROUP]</emphasis>
528   
529   </para>
530   <para>
531    After (optionally) writing the PID file, assume the user  ID  of
532    <emphasis>USER</emphasis>, and if included the GID of GROUP.  Exit if the
533    privileges are not sufficient to do so. Unix only.
534   </para>
535  </listitem> 
536  <listitem>
537   <para>
538     <emphasis>configfile</emphasis>
539   </para>
540   <para>
541     If no <emphasis>configfile</emphasis> is included on the command line, 
542     <application>Privoxy</application> will look for a file named 
543     <quote>config</quote> in the current directory (except on Win32 
544     where it will look for <quote>config.txt</quote> instead). Specify 
545     full path to avoid confusion.
546   </para>
547  </listitem> 
548
549  </itemizedlist>
550 </para>
551
552 </sect2>
553
554 </sect1>
555
556 <!--  ~  End section  ~  -->
557
558
559 <!--   ~~~~~       New section      ~~~~~     -->
560 <sect1 id="configuration"><title><application>Privoxy</application> Configuration</title>
561  <para>
562   All <application>Privoxy</application> configuration is stored  
563   in text files. These files can be edited with a text editor.
564   Many important aspects of <application>Privoxy</application> can 
565   also be controlled easily with a web browser.
566
567  </para>
568
569
570 <!--   ~~~~~       New section      ~~~~~     -->
571
572 <sect2>
573 <title>Controlling <application>Privoxy</application> with Your Web Browser</title>
574 <para>
575  <application>Privoxy</application> can be reached by the special 
576  URL <ulink url="http://p.p/">http://p.p/</ulink> (or alternately
577  <ulink url="http://config.privoxy.org/">http://config.privoxy.org/</ulink>), 
578  which is an internal page. You will see the following section:
579
580 </para>
581
582 <para>
583  <screen>
584
585 Please choose from the following options:
586
587     * Show information about the current configuration
588     * Show the source code version numbers
589     * Show the client's request headers.
590     * Show which actions apply to a URL and why
591     * Toggle Privoxy on or off
592     * Edit the actions list
593
594  </screen>
595 </para>
596
597 <para>
598  This should be self-explanatory. Note the last item is an editor for the
599  <quote>actions list</quote>, which is where much of the ad, banner, cookie,
600  and URL blocking magic is configured as well as other advanced features of
601  <application>Privoxy</application>. This is an easy way to adjust various
602  aspects of <application>Privoxy</application> configuration. The actions
603  file, and other configuration files, are explained in detail below. 
604  <application>Privoxy</application> will automatically detect any changes 
605  to these files.
606 </para>
607
608 <para>
609  <quote>Toggle Privoxy On or Off</quote> is handy for sites that might 
610  have problems with your current actions and filters, or just to test if 
611  a site misbehaves, whether it is <application>Privoxy</application> 
612  causing the problem or not. <application>Privoxy</application> continues 
613  to run as a proxy in this case, but all filtering is disabled.
614
615 </para>
616
617 </sect2>
618
619 <!--  ~  End section  ~  -->
620
621
622
623
624 <!--   ~~~~~       New section      ~~~~~     -->
625
626 <sect2>
627 <title>Configuration Files Overview</title>
628 <para>
629  For Unix, *BSD and Linux, all configuration files are located in
630  <filename>/etc/privoxy/</filename> by default. For MS Windows, OS/2, and
631  AmigaOS these are all in the same directory as the 
632  <application>Privoxy</application> executable. The name and number of
633  configuration files has changed from previous versions, and is subject to
634  change as development progresses.
635 </para>
636
637 <para>
638  The installed defaults provide a reasonable starting point, though possibly
639  aggressive by some standards. For the time being, there are only three
640  default configuration files (this will change in time):
641 </para>
642
643 <para>
644  <itemizedlist>
645
646   <listitem>
647    <para>
648      The main configuration file is named <filename>config</filename>
649      on Linux, Unix, BSD, OS/2, and AmigaOS and <filename>config.txt</filename>
650      on Windows.
651    </para>
652   </listitem> 
653
654   <listitem>
655    <para>
656     The <filename>default.action</filename> file is used  to define various 
657     <quote>actions</quote> relating to images, banners, pop-ups, access
658     restrictions, banners and cookies. There is a CGI based editor for this
659     file that can be accessed via <ulink
660     url="http://p.p">http://p.p</ulink>. (Other actions 
661     files are included as well with differing levels of filtering 
662     and blocking, e.g. <filename>basic.action</filename>.)
663    </para>
664   </listitem> 
665
666   <listitem>
667    <para>
668     The <filename>default.filter</filename> file can be used to re-write the raw
669     page content, including viewable text as well as embedded HTML and JavaScript,
670     and whatever else lurks on any given web page.
671    </para>
672   </listitem> 
673
674  </itemizedlist>
675 </para>
676
677 <para>
678  <filename>default.action</filename> and <filename>default.filter</filename> 
679  can use Perl style regular expressions for maximum flexibility. All files use
680  the <quote><literal>#</literal></quote> character to denote a comment. Such
681  lines are not processed by <application>Privoxy</application>. After
682  making any changes, there is no need to restart
683  <application>Privoxy</application> in order for the changes to take
684  effect. <application>Privoxy</application> should detect such changes 
685  automatically.
686 </para>
687
688 <para>
689  While under development, the configuration content is subject to change. 
690  The below documentation may not be accurate by the time you read this. 
691  Also, what constitutes a <quote>default</quote> setting, may change, so 
692  please check all your configuration files on important issues.
693 </para>
694 </sect2>
695
696
697 <!--   ~~~~~       New section      ~~~~~     -->
698
699 <sect2>
700 <title>The Main Configuration File</title>
701 <para>
702  Again, the main configuration file is named <filename>config</filename> on
703  Linux/Unix/BSD and OS/2, and <filename>config.txt</filename> on Windows.
704  Configuration lines consist of an initial keyword followed by a list of
705  values, all separated by whitespace (any number of spaces or tabs). For
706  example:
707 </para>
708
709 <para>
710  <literal>
711   <msgtext> 
712    <literallayout>
713   <emphasis>blockfile blocklist.ini</emphasis>
714    </literallayout>
715   </msgtext> 
716  </literal>
717 </para>
718
719 <para>
720  Indicates that the blockfile is named <quote>blocklist.ini</quote>. (A 
721  default installation does not use this.)
722 </para>
723
724 <para>
725  A <quote><literal>#</literal></quote> indicates a comment.  Any part of a
726  line following a <quote><literal>#</literal></quote> is ignored, except if
727  the <quote><literal>#</literal></quote> is preceded by a
728  <quote><literal>\</literal></quote>.
729 </para>
730
731 <para>
732  Thus, by placing a <quote><literal>#</literal></quote> at the start of an
733  existing configuration line, you can make it a comment and it will be treated
734  as if it weren't there. This is called <quote>commenting out</quote> an
735  option and can be useful to turn off features: If you comment out the
736  <quote>logfile</quote> line, <application>Privoxy</application> will not
737  log to a file at all. Watch for the <quote>default:</quote> section in each
738  explanation to see what happens if the option is left unset (or commented
739  out). 
740 </para>
741
742 <para>
743  Long lines can be continued on the next line by using a
744  <quote><literal>\</literal></quote> as the very last character.
745 </para>
746
747 <para>
748  There are various aspects of <application>Privoxy</application> behavior 
749  that can be tuned.
750 </para>
751
752
753 <!--   ~~~~~       New section      ~~~~~     -->
754
755 <sect3>
756 <title>Defining Other Configuration Files</title>
757
758 <para>
759  <application>Privoxy</application> can use a number of other files to tell it
760  what ads to block, what cookies to accept, and perform other functions.  This
761  section of the configuration file tells <application>Privoxy</application>
762  where to find all those other files. 
763 </para>
764
765 <para>
766  On <application>Windows</application> and <application>AmigaOS</application>,
767  <application>Privoxy</application> looks for these files in the same
768  directory as the executable.  On Unix and  OS/2,
769  <application>Privoxy</application> looks for these files in the current
770  working directory. In either case, an absolute path name can be used to
771  avoid problems.
772 </para>
773
774 <para>
775  When development goes modular and multi-user, the blocker, filter, and
776  per-user config will be stored in subdirectories of <quote>confdir</quote>.
777  For now, only <filename>confdir/templates</filename> is used for storing HTML
778  templates for CGI results. 
779 </para>
780
781 <para>
782  The location of the configuration files:
783 </para>
784
785 <para>
786  <literal>
787   <msgtext> 
788    <literallayout>
789   <emphasis>confdir  /etc/privoxy</emphasis>       # No trailing /, please.
790    </literallayout>
791   </msgtext> 
792  </literal>
793 </para>
794
795 <para>
796  The directory where all logging (i.e. <filename>logfile</filename> and 
797  <filename>jarfile</filename>) takes place. No trailing
798  <quote><literal>/</literal></quote>, please: 
799 </para>
800
801 <para>
802  <literal>
803   <msgtext> 
804    <literallayout>
805   <emphasis>logdir  /var/log/privoxy</emphasis>
806    </literallayout>
807   </msgtext> 
808  </literal>
809 </para>
810
811 <para>
812  Note that all file specifications below are relative to 
813  the above two directories!
814 </para>
815
816 <para>
817  The <quote>default.action</quote> file contains patterns to specify the
818  actions to apply to requests for each site. Default: Cookies to and from all
819  destinations are kept only during the current browser session (i.e. they are
820  not saved to disk). Pop-ups are disabled for all sites. All sites are
821  filtered through selected sections of <quote>default.filter</quote>. No sites
822  are blocked. <application>Privoxy</application> displays a checkboard type
823  pattern for filtered ads and other images. The syntax of this file is
824  explained in detail <link linkend="actionsfile">below</link>. Other
825  <quote>actions</quote> files are included, and you are free to use any of
826  them. They have varying degrees of aggressiveness.
827 </para>
828
829 <para>
830  <literal>
831   <msgtext> 
832    <literallayout>
833   <emphasis>actionsfile  default.action</emphasis>
834    </literallayout>
835   </msgtext> 
836  </literal>
837 </para>
838
839 <para>
840  The <quote>default.filter</quote> file contains content modification rules 
841  that use <quote>regular expressions</quote>. These rules permit powerful
842  changes on the content of Web pages, e.g., you could disable your favorite
843  JavaScript annoyances, re-write the actual displayed text, or just have some
844  fun replacing <quote>Microsoft</quote> with <quote>MicroSuck</quote> wherever
845  it appears on a Web page. Default: whatever the developers are playing with
846  :-/
847 </para>
848
849 <para>
850  Filtering requires buffering the page content, which may appear to slow down
851  page rendering since nothing is displayed until all content has passed 
852  the filters. (It does not really take longer, but seems that way since 
853  the page is not incrementally displayed.) This effect will be more noticeable
854  on slower connections.
855
856 </para>
857
858 <para>
859  <literal>
860   <msgtext> 
861    <literallayout>
862   <emphasis>filterfile  default.filter</emphasis>
863    </literallayout>
864   </msgtext> 
865  </literal>
866 </para>
867
868 <para>
869  The logfile is where all logging and error messages are written. The logfile
870  can be useful for tracking down a problem with
871  <application>Privoxy</application> (e.g., it's not blocking an ad you
872  think it should block) but in most cases you probably will never look at it.
873 </para>
874
875 <para>
876  Your logfile will grow indefinitely, and you will probably want to
877  periodically remove it.  On Unix systems, you can do this with a cron job
878  (see <quote>man cron</quote>). For Redhat, a <command>logrotate</command> 
879  script has been included.
880 </para>
881
882 <para>
883  On SuSE Linux systems, you can place a line like <quote>/var/log/privoxy.*
884  +1024k 644 nobody.nogroup</quote> in <filename>/etc/logfiles</filename>, with
885  the effect that cron.daily will automatically archive, gzip, and empty the
886  log, when it exceeds 1M size.
887 </para>
888
889 <para>
890  Default: Log to the a file named <filename>logfile</filename>. 
891  Comment out to disable logging.
892 </para>
893
894 <para>
895  <literal>
896   <msgtext> 
897    <literallayout>
898   <emphasis>logfile  logfile</emphasis>
899    </literallayout>
900   </msgtext> 
901  </literal>
902 </para>
903
904 <para>
905  The <quote>jarfile</quote> defines where
906  <application>Privoxy</application> stores the cookies it intercepts.  Note
907  that if you use a <quote>jarfile</quote>, it may grow quite large. Default:
908  Don't store intercepted cookies.
909 </para>
910
911 <para>
912  <literal>
913   <msgtext> 
914    <literallayout>
915   <emphasis>#jarfile  jarfile</emphasis>
916    </literallayout>
917   </msgtext> 
918  </literal>
919 </para>
920
921 <para>
922  If you specify a <quote>trustfile</quote>,
923  <application>Privoxy</application> will only allow access to sites that
924  are named in the trustfile. You can also mark sites as trusted referrers,
925  with the effect that access to untrusted sites will be granted, if a link
926  from a trusted referrer was used. The link target will then be added to the
927  <quote>trustfile</quote>. This is a very restrictive feature that typical
928  users most probably want to leave disabled. Default: Disabled, don't use the
929  trust mechanism.
930 </para>
931
932 <para>
933  <literal>
934   <msgtext> 
935    <literallayout>
936   <emphasis>#trustfile  trust</emphasis>
937    </literallayout>
938   </msgtext> 
939  </literal>
940 </para>
941  
942 <para>
943  If you use the trust mechanism, it is a good idea to write up some on-line
944  documentation about your blocking policy and to specify the URL(s) here. They
945  will appear on the page that your users receive when they try to access
946  untrusted content. Use multiple times for multiple URLs. Default: Don't
947  display links on the <quote>untrusted</quote> info page.
948 </para>
949
950 <para>
951  <literal>
952   <msgtext> 
953    <literallayout>
954   <emphasis>trust-info-url http://www.example.com/why_we_block.html</emphasis>
955   <emphasis>trust-info-url http://www.example.com/what_we_allow.html</emphasis>
956    </literallayout>
957   </msgtext> 
958  </literal>
959 </para>
960
961 </sect3>
962
963 <!--  ~  End section  ~  -->
964
965
966
967 <!--   ~~~~~       New section      ~~~~~     -->
968
969 <sect3>
970 <title>Other Configuration Options</title>
971
972 <para>
973  This part of the configuration file contains options that control how
974  <application>Privoxy</application> operates.
975 </para>
976
977 <para>
978  <quote>Admin-address</quote> should be set to the email address of the proxy
979  administrator. It is used in many of the proxy-generated pages. Default:
980  fill@me.in.please.
981 </para>
982
983 <para>
984  <literal>
985   <msgtext> 
986    <literallayout>
987   <emphasis>#admin-address  fill@me.in.please</emphasis>
988    </literallayout>
989   </msgtext> 
990  </literal>
991 </para>
992
993 <para>
994  <quote>Proxy-info-url</quote> can be set to a URL that contains more info
995  about this <application>Privoxy</application> installation, it's
996  configuration and policies. It is used in many of the proxy-generated pages
997  and its use is highly recommended in multi-user installations, since your
998  users will want to know why certain content is blocked or modified. Default:
999  Don't show a link to on-line documentation.
1000 </para>
1001
1002 <para>
1003  <literal>
1004   <msgtext> 
1005    <literallayout>
1006   <emphasis>proxy-info-url  http://www.example.com/proxy.html</emphasis>
1007    </literallayout>
1008   </msgtext> 
1009  </literal>
1010 </para>
1011
1012 <para>
1013  <quote>Listen-address</quote> specifies the address and port where
1014  <application>Privoxy</application> will listen for connections from your
1015  Web browser.  The default is to listen on the localhost port 8118, and
1016  this is suitable for most users.  (In your web browser, under proxy
1017  configuration, list the proxy server as <quote>localhost</quote> and the
1018  port as <quote>8118</quote>).
1019 </para>
1020
1021 <para>
1022  If you already have another service running on port 8118, or if you want to
1023  serve requests from other machines (e.g. on your local network) as well, you
1024  will need to override the default. The syntax is 
1025  <quote>listen-address [&lt;ip-address&gt;]:&lt;port&gt;</quote>. If you leave
1026  out the IP address, <application>Privoxy</application> will bind to all
1027  interfaces (addresses) on your machine and may become reachable from the
1028  Internet. In that case, consider using access control lists (acl's) (see
1029  <quote>aclfile</quote> above), or a firewall.
1030 </para>
1031
1032 <para>
1033  For example, suppose you are running <application>Privoxy</application> on
1034  a machine which has the address 192.168.0.1 on your local private network
1035  (192.168.0.0) and has another outside connection with a different address.
1036  You want it to serve requests from inside only:
1037 </para>
1038
1039 <para>
1040  <literal>
1041   <msgtext> 
1042    <literallayout>
1043   <emphasis>listen-address  192.168.0.1:8118</emphasis>
1044    </literallayout>
1045   </msgtext> 
1046  </literal>
1047 </para>
1048
1049 <para>
1050  If you want it to listen on all addresses (including the outside
1051  connection):
1052 </para>
1053
1054 <para>
1055  <literal>
1056   <msgtext> 
1057    <literallayout>
1058   <emphasis>listen-address  :8118</emphasis>
1059    </literallayout>
1060   </msgtext> 
1061  </literal>
1062 </para>
1063
1064 <para>
1065  If you do this, consider using ACLs (see <quote>aclfile</quote> above). Note:
1066  you will need to point your browser(s) to the address and port that you have
1067  configured here. Default: localhost:8118 (127.0.0.1:8118).
1068 </para>
1069
1070 <para>
1071  The debug option sets the level of debugging information to log in the
1072  logfile (and to the console in the Windows version).  A debug level of 1 is
1073  informative because it will show you each request as it happens.  Higher
1074  levels of debug are probably only of interest to developers.
1075 </para>
1076
1077 <para>
1078  <literal>
1079   <msgtext> 
1080    <literallayout>
1081   debug         1 # GPC   = show each GET/POST/CONNECT request
1082   debug         2 # CONN  = show each connection status
1083   debug         4 # IO    = show I/O status
1084   debug         8 # HDR   = show header parsing
1085   debug        16 # LOG   = log all data into the logfile
1086   debug        32 # FRC   = debug force feature
1087   debug        64 # REF   = debug regular expression filter 
1088   debug       128 #       = debug fast redirects
1089   debug       256 #       = debug GIF de-animation
1090   debug       512 # CLF   = Common Log Format
1091   debug      1024 #       = debug kill pop-ups
1092   debug      4096 # INFO  = Startup banner and warnings.
1093   debug      8192 # ERROR = Non-fatal errors
1094     </literallayout>
1095   </msgtext>
1096  </literal>
1097 </para>
1098
1099 <para>
1100  It is <emphasis>highly recommended</emphasis> that you enable ERROR
1101  reporting (debug 8192), at least until v3.0 is released.
1102 </para>
1103
1104 <para>
1105  The reporting of FATAL errors (i.e. ones which crash 
1106  <application>Privoxy</application>) is always on and cannot be disabled.
1107 </para>
1108
1109 <para>
1110  If you want to use CLF (Common Log Format), you should set <quote>debug
1111  512</quote> ONLY, do not enable anything else.
1112 </para>
1113
1114 <para>
1115  Multiple <quote>debug</quote> directives, are OK - they're logical-OR'd
1116  together. 
1117 </para>
1118
1119 <para>
1120  <literal>
1121   <msgtext> 
1122    <literallayout>
1123   <emphasis>debug    15     # same as setting the first 4 listed above</emphasis>
1124    </literallayout>
1125   </msgtext> 
1126  </literal>
1127 </para>
1128
1129 <para>
1130  Default:
1131 </para>
1132
1133 <para>
1134  <literal>
1135   <msgtext> 
1136    <literallayout>
1137   <emphasis>debug   1     # URLs</emphasis>
1138   <emphasis>debug   4096  # Info</emphasis>
1139   <emphasis>debug   8192  # Errors - *we highly recommended enabling this*</emphasis>
1140    </literallayout>
1141   </msgtext> 
1142  </literal>
1143 </para>
1144
1145 <para>
1146  <application>Privoxy</application> normally uses
1147  <quote>multi-threading</quote>, a software technique that permits it to
1148  handle many different requests simultaneously. In some cases you may wish to
1149  disable this -- particularly if you're trying to debug a problem.  The
1150  <quote>single-threaded</quote> option forces
1151  <application>Privoxy</application> to handle requests sequentially.
1152  Default: Multi-threaded mode.
1153 </para>
1154
1155 <para>
1156  <literal>
1157   <msgtext> 
1158    <literallayout>
1159   <emphasis>#single-threaded</emphasis>
1160    </literallayout>
1161   </msgtext> 
1162  </literal>
1163 </para>
1164
1165 <para>
1166  <quote>toggle</quote> allows you to temporarily disable all
1167  <application>Privoxy's</application>  filtering. Just set <quote>toggle
1168  0</quote>.
1169 </para>
1170
1171 <para>
1172  The Windows version of <application>Privoxy</application> puts an icon in
1173  the system tray, which also allows you to change this option.  If you
1174  right-click on that icon (or select the <quote>Options</quote> menu), one
1175  choice is <quote>Enable</quote>. Clicking on enable toggles
1176  <application>Privoxy</application> on and off. This is useful if you want
1177  to temporarily disable <application>Privoxy</application>, e.g., to access
1178  a site that requires cookies which you would otherwise have blocked. This can also
1179  be toggled via a web browser at the <application>Privoxy</application>
1180  internal address of <ulink url="http://p.p">http://p.p</ulink> on 
1181  any platform.
1182 </para>
1183
1184 <para>
1185  <quote>toggle 1</quote> means <application>Privoxy</application> runs
1186  normally, <quote>toggle 0</quote> means that
1187  <application>Privoxy</application> becomes a non-anonymizing non-blocking
1188  proxy. Default: 1 (on). 
1189 </para>
1190
1191 <para>
1192  <literal>
1193   <msgtext> 
1194    <literallayout>
1195   <emphasis>toggle    1</emphasis>
1196    </literallayout>
1197   </msgtext> 
1198  </literal>
1199 </para>
1200
1201 <para>
1202  For content filtering, i.e. the <quote>+filter</quote> and
1203  <quote>+deanimate-gif</quote> actions, it is necessary that 
1204  <application>Privoxy</application> buffers the entire document body.
1205  This can be potentially dangerous, since a server could just keep sending
1206  data indefinitely and wait for your RAM to exhaust. With nasty consequences.
1207 </para>
1208
1209 <para>
1210  The <application>buffer-limit</application> option lets you set the maximum
1211  size in Kbytes that each buffer may use. When the documents buffer exceeds
1212  this size, it is flushed to the client unfiltered and no further attempt to
1213  filter the rest of it is made. Remember that there may multiple threads
1214  running, which might require increasing the <quote>buffer-limit</quote>
1215  Kbytes <emphasis>each</emphasis>, unless you have enabled 
1216  <quote>single-threaded</quote> above.
1217 </para>
1218
1219 <para>
1220  <literal>
1221   <msgtext> 
1222    <literallayout>
1223   <emphasis>buffer-limit    4069</emphasis>
1224    </literallayout>
1225   </msgtext> 
1226  </literal>
1227 </para>
1228
1229 <para>
1230  To enable the web-based <filename>default.action</filename> file editor set
1231  <application>enable-edit-actions</application> to 1, or 0 to disable.  Note
1232  that you must have compiled <application>Privoxy</application> with
1233  support for this feature, otherwise this option has no effect. This 
1234  internal page can be reached at <ulink
1235  url="http://p.p">http://p.p</ulink>.
1236  </para>
1237
1238 <para>
1239  Security note: If this is enabled, anyone who can use the proxy
1240  can edit the actions file, and their changes will affect all users.
1241  For shared proxies, you probably want to disable this. Default: enabled.
1242 </para>
1243
1244 <para>
1245  <literal>
1246   <msgtext> 
1247    <literallayout>
1248   <emphasis>enable-edit-actions    1</emphasis>
1249    </literallayout>
1250   </msgtext> 
1251  </literal>
1252 </para>
1253
1254 <para>
1255  Allow <application>Privoxy</application> to be toggled on and off
1256  remotely, using your web browser.  Set <quote>enable-remote-toggle</quote>to
1257  1 to enable, and 0 to disable.  Note that you must have compiled 
1258  <application>Privoxy</application> with support for this feature,
1259  otherwise this option has no effect.
1260 </para>
1261
1262 <para>
1263  Security note:  If this is enabled, anyone who can use the proxy can toggle
1264  it on or off (see <ulink url="http://p.p">http://p.p</ulink>), and
1265  their changes will affect all users. For shared proxies, you probably want to
1266  disable this. Default: enabled.
1267 </para>
1268
1269 <para>
1270  <literal>
1271   <msgtext> 
1272    <literallayout>
1273   <emphasis>enable-remote-toggle    1</emphasis>
1274    </literallayout>
1275   </msgtext> 
1276  </literal>
1277 </para>
1278
1279 </sect3>
1280
1281 <!--  ~  End section  ~  -->
1282
1283
1284 <!--   ~~~~~       New section      ~~~~~     -->
1285
1286 <sect3>
1287 <title>Access Control List (ACL)</title>
1288 <para>
1289  Access controls are included at the request of some ISPs and systems
1290  administrators, and are not usually needed by individual users. Please note
1291  the warnings in the FAQ that this proxy is not intended to be a substitute
1292  for a firewall or to encourage anyone to defer addressing basic security
1293  weaknesses.
1294 </para>
1295
1296 <para>
1297  If no access settings are specified, the proxy talks to anyone that
1298  connects. If any access settings file are specified, then the proxy
1299  talks only to IP addresses permitted somewhere in this file and not
1300  denied later in this file.
1301 </para>
1302
1303 <para>
1304  Summary -- if using an ACL:
1305 </para>
1306
1307  <simplelist>
1308   <member>
1309    Client must have permission to receive service.
1310   </member>
1311  </simplelist>
1312  <simplelist>
1313   <member>
1314    LAST match in ACL wins.
1315   </member>
1316  </simplelist>
1317  <simplelist>
1318   <member>
1319    Default behavior is to deny service.
1320   </member>
1321  </simplelist>
1322
1323 <para>
1324  The syntax for an entry in the Access Control List is:
1325 </para>
1326
1327 <para>
1328  <literal>
1329   <msgtext> 
1330    <literallayout>
1331   ACTION    SRC_ADDR[/SRC_MASKLEN]    [ DST_ADDR[/DST_MASKLEN] ]
1332    </literallayout>
1333   </msgtext> 
1334  </literal>
1335 </para>
1336
1337 <para>
1338  Where the individual fields are:
1339 </para>
1340
1341 <para>
1342  <literal>
1343   <msgtext> 
1344    <literallayout>
1345  <emphasis>ACTION</emphasis>      = <quote>permit-access</quote> or <quote>deny-access</quote>
1346
1347  <emphasis>SRC_ADDR</emphasis>    = client hostname or dotted IP address
1348  <emphasis>SRC_MASKLEN</emphasis> = number of bits in the subnet mask for the source
1349
1350  <emphasis>DST_ADDR</emphasis>    = server or forwarder hostname or dotted IP address
1351  <emphasis>DST_MASKLEN</emphasis> = number of bits in the subnet mask for the target
1352    </literallayout>
1353   </msgtext> 
1354  </literal>
1355 </para>
1356
1357
1358 <para> 
1359  The field separator (FS) is whitespace (space or tab).
1360 </para>
1361
1362 <para>
1363  IMPORTANT NOTE: If <application>Privoxy</application> is using a
1364  forwarder (see below) or a gateway for a particular destination URL, the
1365  <literal>DST_ADDR</literal> that is examined is the address of the forwarder
1366  or the gateway and <emphasis>NOT</emphasis> the address of the ultimate
1367  target. This is necessary because it may be impossible for the local
1368  <application>Privoxy</application> to determine the address of the
1369  ultimate target (that's often what gateways are used for).
1370 </para>
1371
1372 <para>
1373  Here are a few examples to show how the ACL features work:
1374 </para>
1375
1376 <para>
1377  <quote>localhost</quote> is OK -- no DST_ADDR implies that
1378  <emphasis>ALL</emphasis> destination addresses are OK:
1379 </para>
1380
1381 <para>
1382  <literal>
1383   <msgtext> 
1384    <literallayout>
1385   <emphasis>permit-access  localhost</emphasis>
1386    </literallayout>
1387   </msgtext> 
1388  </literal>
1389 </para>
1390
1391 <para>
1392  A silly example to illustrate permitting any host on the class-C subnet with
1393  <application>Privoxy</application> to go anywhere:
1394 </para>
1395
1396 <para>
1397  <literal>
1398   <msgtext> 
1399    <literallayout>
1400   <emphasis>permit-access    www.privoxy.com/24</emphasis>
1401    </literallayout>
1402   </msgtext> 
1403  </literal>
1404 </para>
1405
1406 <para>
1407  Except deny one particular IP address from using it at all:
1408 </para>
1409
1410 <para>
1411  <literal>
1412   <msgtext> 
1413    <literallayout>
1414   <emphasis>deny-access      ident.privoxy.com</emphasis>
1415    </literallayout>
1416   </msgtext> 
1417  </literal>
1418 </para>
1419
1420 <para>
1421  You can also specify an explicit network address and subnet mask.
1422  Explicit addresses do not have to be resolved to be used.
1423 </para>
1424
1425 <para>
1426  <literal>
1427   <msgtext> 
1428    <literallayout>
1429   <emphasis>permit-access    207.153.200.0/24</emphasis>
1430    </literallayout>
1431   </msgtext> 
1432  </literal>
1433 </para>
1434
1435 <para>
1436  A subnet mask of 0 matches anything, so the next line permits everyone.
1437 </para>
1438
1439 <para>
1440  <literal>
1441   <msgtext> 
1442    <literallayout>
1443   <emphasis>permit-access    0.0.0.0/0</emphasis>
1444    </literallayout>
1445   </msgtext> 
1446  </literal>
1447 </para>
1448
1449 <para>
1450  Note, you <emphasis>cannot</emphasis> say:
1451 </para>
1452
1453 <para>
1454  <literal>
1455   <msgtext> 
1456    <literallayout>
1457   <emphasis>permit-access    .org</emphasis>
1458    </literallayout>
1459   </msgtext> 
1460  </literal>
1461 </para>
1462
1463 <para>
1464  to allow all *.org domains. Every IP address listed must resolve fully.
1465 </para>
1466
1467 <para>
1468  An ISP may want to provide a <application>Privoxy</application> that is
1469  accessible by <quote>the world</quote> and yet restrict use of some of their
1470  private content to hosts on its internal network (i.e. its own subscribers).
1471  Say, for instance the ISP owns the Class-B IP address block 123.124.0.0 (a 16
1472  bit netmask). This is how they could do it:
1473 </para>
1474
1475 <para>
1476  <literal>
1477   <msgtext> 
1478    <literallayout>
1479  <emphasis>permit-access 0.0.0.0/0   0.0.0.0/0</emphasis>   # other clients can go anywhere 
1480                                        # with the following exceptions:
1481  
1482  <emphasis>deny-access</emphasis>   0.0.0.0/0   123.124.0.0/16 # block all external requests for
1483                                           # sites on the ISP's network
1484
1485  <emphasis>permit 0.0.0.0/0   www.my_isp.com</emphasis>        # except for the ISP's main 
1486                                           # web site
1487
1488  <emphasis>permit 123.124.0.0/16 0.0.0.0/0</emphasis>          # the ISP's clients can go 
1489                                           # anywhere
1490    </literallayout>
1491   </msgtext> 
1492  </literal>
1493 </para>
1494
1495 <para>
1496  Note that if some hostnames are listed with multiple IP addresses, 
1497  the primary value returned by DNS (via gethostbyname()) is used. Default:
1498  Anyone can access the proxy.
1499 </para>
1500
1501 </sect3>
1502
1503 <!--  ~  End section  ~  -->
1504
1505
1506 <!--   ~~~~~       New section      ~~~~~     -->
1507
1508 <sect3 id="forwarding">
1509 <title>Forwarding</title>
1510
1511 <para>
1512  This feature allows chaining of HTTP requests via multiple proxies.
1513  It can be used to better protect privacy and confidentiality when
1514  accessing specific domains by routing requests to those domains
1515  to a special purpose filtering proxy such as lpwa.com. Or to use 
1516  a caching proxy to speed up browsing.
1517 </para>
1518
1519 <para>
1520  It can also be used in an environment with multiple networks to route
1521  requests via multiple gateways allowing transparent access to multiple
1522  networks without having to modify browser configurations.
1523 </para>
1524
1525 <para>
1526  Also specified here are SOCKS proxies. <application>Privoxy</application>
1527  SOCKS 4 and SOCKS 4A. The difference is that SOCKS 4A will resolve the target
1528  hostname using DNS on the SOCKS server, not our local DNS client.
1529 </para>
1530
1531 <para>
1532  The syntax of each line is:
1533 </para>
1534
1535 <para>
1536  <literal>
1537   <msgtext> 
1538    <literallayout>
1539  <emphasis>forward target_domain[:port] http_proxy_host[:port]</emphasis>
1540  <emphasis>forward-socks4  target_domain[:port] socks_proxy_host[:port] http_proxy_host[:port]</emphasis>
1541  <emphasis>forward-socks4a target_domain[:port] socks_proxy_host[:port] http_proxy_host[:port]</emphasis>
1542    </literallayout>
1543   </msgtext> 
1544  </literal>
1545 </para>
1546
1547 <para>
1548  If http_proxy_host is <quote>.</quote>, then requests are not forwarded to a
1549  HTTP proxy but are made directly to the web servers.
1550 </para>
1551
1552 <para>
1553  Lines are checked in sequence, and the last match wins.
1554 </para>
1555
1556 <para>
1557  There is an implicit line equivalent to the following, which specifies that
1558  anything not finding a match on the list is to go out without forwarding
1559  or gateway protocol, like so:
1560 </para>
1561
1562 <para>
1563  <literal>
1564   <msgtext> 
1565    <literallayout>
1566   <emphasis>forward   .*   .       </emphasis># implicit
1567    </literallayout>
1568   </msgtext> 
1569  </literal>
1570 </para>
1571
1572 <para>
1573  In the following common configuration, everything goes to Lucent's LPWA,
1574  except SSL on port 443 (which it doesn't handle):
1575 </para>
1576
1577 <para>
1578  <literal>
1579   <msgtext> 
1580    <literallayout>
1581  <emphasis>forward   .*     lpwa.com:8000</emphasis>
1582  <emphasis>forward   :443   .</emphasis>
1583    </literallayout>
1584   </msgtext> 
1585  </literal>
1586 </para>
1587
1588 <para>
1589 <!--
1590  See the FAQ for instructions on how to automate the login procedure for LPWA.
1591 --> 
1592  Some users have reported difficulties related to LPWA's use of
1593  <quote>.</quote> as the last element of the domain, and have said that this
1594  can be fixed with this:
1595 </para>
1596    
1597 <para>
1598  <literal>
1599   <msgtext> 
1600    <literallayout>
1601   <emphasis>forward   lpwa.  lpwa.com:8000</emphasis>
1602    </literallayout>
1603   </msgtext> 
1604  </literal>
1605 </para>
1606  
1607 <para>
1608  (NOTE: the syntax for specifying target_domain has changed since the
1609  previous paragraph was written -- it will not work now.  More information
1610  is welcome.)
1611 </para>
1612
1613 <para>
1614  In this fictitious example, everything goes via an ISP's caching proxy,
1615  except requests to that ISP:
1616 </para>
1617
1618 <para>
1619  <literal>
1620   <msgtext> 
1621    <literallayout>
1622  <emphasis>forward    .*         caching.myisp.net:8000</emphasis>
1623  <emphasis>forward    myisp.net  .</emphasis>
1624    </literallayout>
1625   </msgtext> 
1626  </literal>
1627 </para>
1628
1629 <para>
1630  For the @home network, we're told the forwarding configuration is this:
1631 </para>
1632
1633
1634 <para>
1635  <literal>
1636   <msgtext> 
1637    <literallayout>
1638   <emphasis>forward    .*    proxy:8080</emphasis>
1639    </literallayout>
1640   </msgtext> 
1641  </literal>
1642 </para>
1643
1644 <para>
1645  Also, we're told they insist on getting cookies and JavaScript, so you should 
1646  allow cookies from home.com. We consider JavaScript a potential security risk.
1647  Java need not be enabled.
1648 </para>
1649
1650 <para>
1651  In this example direct connections are made to all <quote>internal</quote>
1652  domains, but everything else goes through Lucent's LPWA by way of the
1653  company's SOCKS gateway to the Internet.
1654 </para>
1655
1656 <para>
1657  <literal>
1658   <msgtext> 
1659    <literallayout>
1660  <emphasis>forward-socks4  .*  lpwa.com:8000  firewall.my_company.com:1080</emphasis>
1661  <emphasis>forward    my_company.com  .</emphasis>
1662    </literallayout>
1663   </msgtext> 
1664  </literal>
1665 </para>
1666
1667 <para>
1668  This is how you could set up a site that always uses SOCKS but no forwarders:
1669 </para>
1670
1671 <para>
1672  <literal>
1673   <msgtext> 
1674    <literallayout>
1675   <emphasis>forward-socks4a   .*  .  firewall.my_company.com:1080</emphasis>
1676    </literallayout>
1677   </msgtext> 
1678  </literal>
1679 </para>
1680
1681 <para>
1682  An advanced example for network administrators:
1683 </para>
1684
1685 <para>
1686  If you have links to multiple ISPs that provide various special content to
1687  their subscribers, you can configure forwarding to pass requests to the
1688  specific host that's connected to that ISP so that everybody can see all
1689  of the content on all of the ISPs.
1690 </para>
1691
1692 <para>
1693  This is a bit tricky, but here's an example:
1694 </para>
1695
1696
1697 <para>
1698  host-a has a PPP connection to isp-a.com. And host-b has a PPP connection to
1699  isp-b.com. host-a can run a <application>Privoxy</application> proxy with
1700  forwarding like this: 
1701 </para>
1702
1703 <para>
1704  <literal>
1705   <msgtext> 
1706    <literallayout>
1707  <emphasis>forward    .*         .</emphasis>
1708  <emphasis>forward    isp-b.com  host-b:8118</emphasis>
1709    </literallayout>
1710   </msgtext> 
1711  </literal>
1712 </para>
1713
1714 <para>
1715  host-b can run a <application>Privoxy</application> proxy with forwarding
1716  like this: 
1717 </para>
1718
1719 <para>
1720  <literal>
1721   <msgtext> 
1722    <literallayout>
1723  <emphasis>forward    .*          .</emphasis>
1724  <emphasis>forward    isp-a.com   host-a:8118</emphasis>
1725    </literallayout>
1726   </msgtext> 
1727  </literal>
1728 </para>
1729
1730 <para>
1731  Now, <emphasis>anyone</emphasis> on the Internet (including users on host-a
1732  and host-b) can set their browser's proxy to <emphasis>either</emphasis>
1733  host-a or host-b and be able to browse the content on isp-a or isp-b.
1734 </para>
1735
1736 <para>
1737  Here's another practical example, for University of Kent at
1738  Canterbury students with a network connection in their room, who
1739  need to use the University's Squid web cache.
1740 </para>
1741
1742 <para>
1743  <literal>
1744   <msgtext> 
1745    <literallayout>
1746  <emphasis>forward  *. ssbcache.ukc.ac.uk:3128</emphasis>  # Use the proxy, except for:
1747  <emphasis>forward  .ukc.ac.uk            .    </emphasis> # Anything on the same domain as us
1748  <emphasis>forward  *                     .    </emphasis> # Host with no domain specified
1749  <emphasis>forward  129.12.*.*            .    </emphasis> # A dotted IP on our /16 network.
1750  <emphasis>forward  127.*.*.*             .    </emphasis> # Loopback address
1751  <emphasis>forward  localhost.localdomain .    </emphasis> # Loopback address
1752  <emphasis>forward  www.ukc.mirror.ac.uk  .    </emphasis> # Specific host
1753    </literallayout>
1754   </msgtext> 
1755  </literal>
1756 </para>
1757
1758 <para>
1759  If you intend to chain <application>Privoxy</application> and 
1760  <application>squid</application> locally, then chain as 
1761  <literal>browser -> squid -> privoxy</literal> is the recommended way. 
1762 </para>
1763
1764 <para>
1765 Your squid configuration could then look like this (assuming that the IP
1766 address of the box is <literal>192.168.0.1</literal> ):
1767 </para>
1768
1769 <para>
1770  <literal>
1771   <msgtext> 
1772    <literallayout>
1773   # Define Privoxy as parent cache 
1774  <!-- per feedback from user...
1775   cache_peer 127.0.0.1 8118 parent 0 no-query 
1776  --> 
1777   cache_peer 192.168.0.1 parent 8118 0 no-query
1778
1779   # don't listen to the whole world
1780   http_port 192.168.0.1:3128
1781
1782   # define the local lan
1783   acl mylocallan src 192.168.0.1-192.168.0.5/255.255.255.255
1784
1785   # grant access for http to local lan
1786   http_access allow mylocallan
1787   
1788   # Define ACL for protocol FTP 
1789   acl FTP proto FTP 
1790
1791   # Do not forward ACL FTP to privoxy
1792   always_direct allow FTP 
1793
1794   # Do not forward ACL CONNECT (https) to privoxy
1795   always_direct allow CONNECT 
1796
1797   # Forward the rest to privoxy
1798   never_direct allow all 
1799    </literallayout>
1800   </msgtext> 
1801  </literal>
1802 </para>
1803
1804 </sect3>
1805
1806 <!--  ~  End section  ~  -->
1807
1808
1809 <!--   ~~~~~       New section      ~~~~~     -->
1810
1811 <sect3>
1812 <title>Windows GUI Options</title>
1813 <!--
1814 Removed references to Win32. HB 09/23/01
1815 -->
1816 <para>
1817  <application>Privoxy</application> has a number of options specific to the
1818  Windows GUI interface:
1819 </para>
1820
1821 <para>
1822  If <quote>activity-animation</quote> is set to 1, the
1823  <application>Privoxy</application> icon will animate when
1824  <quote>Privoxy</quote> is active. To turn off, set to 0.
1825 </para>
1826
1827 <para>
1828  <literal>
1829   <msgtext> 
1830    <literallayout>
1831   <emphasis>activity-animation   1</emphasis>
1832    </literallayout>
1833   </msgtext> 
1834  </literal>
1835 </para>
1836
1837 <para>
1838  If <quote>log-messages</quote> is set to 1,
1839  <application>Privoxy</application> will log messages to the console
1840  window:
1841 </para>
1842
1843 <para>
1844  <literal>
1845   <msgtext> 
1846    <literallayout>
1847   <emphasis>log-messages       1</emphasis>
1848    </literallayout>
1849   </msgtext> 
1850  </literal>
1851 </para>
1852
1853 <para> 
1854  If <quote>log-buffer-size</quote> is set to 1, the size of the log buffer,
1855  i.e. the amount of memory used for the log messages displayed in the
1856  console window, will be limited to <quote>log-max-lines</quote> (see below).
1857 </para>
1858
1859 <para>
1860  Warning: Setting this to 0 will result in the buffer to grow infinitely and
1861  eat up all your memory!
1862 </para>
1863
1864 <para>
1865  <literal>
1866   <msgtext> 
1867    <literallayout>
1868   <emphasis>log-buffer-size      1</emphasis>
1869    </literallayout>
1870   </msgtext> 
1871  </literal>
1872 </para>
1873
1874 <para>
1875  <application>log-max-lines</application> is the maximum number of lines held
1876  in the log buffer. See above.
1877 </para>
1878
1879 <para>
1880  <literal>
1881   <msgtext> 
1882    <literallayout>
1883   <emphasis>log-max-lines      200</emphasis>
1884    </literallayout>
1885   </msgtext> 
1886  </literal>
1887 </para>
1888
1889 <para>
1890  If <quote>log-highlight-messages</quote> is set to 1,
1891  <application>Privoxy</application> will highlight portions of the log
1892  messages with a bold-faced font:
1893 </para>
1894
1895 <para>
1896  <literal>
1897   <msgtext> 
1898    <literallayout>
1899   <emphasis>log-highlight-messages   1</emphasis>
1900    </literallayout>
1901   </msgtext> 
1902  </literal>
1903 </para>
1904
1905 <para>
1906  The font used in the console window:
1907 </para>
1908
1909 <para>
1910  <literal>
1911   <msgtext> 
1912    <literallayout>
1913   <emphasis>log-font-name        Comic Sans MS</emphasis>
1914    </literallayout>
1915   </msgtext> 
1916  </literal>
1917 </para>
1918
1919 <para>
1920  Font size used in the console window:
1921 </para>
1922
1923 <para>
1924  <literal>
1925   <msgtext> 
1926    <literallayout>
1927   <emphasis>log-font-size        8</emphasis>
1928    </literallayout>
1929   </msgtext> 
1930  </literal>
1931 </para>
1932
1933 <para>  
1934  <quote>show-on-task-bar</quote> controls whether or not
1935  <application>Privoxy</application> will appear as a button on the Task bar
1936  when minimized:
1937 </para>
1938
1939 <para>
1940  <literal>
1941   <msgtext> 
1942    <literallayout>
1943   <emphasis>show-on-task-bar     0</emphasis>
1944    </literallayout>
1945   </msgtext> 
1946  </literal>
1947 </para>
1948
1949 <para>
1950  If <quote>close-button-minimizes</quote> is set to 1, the Windows close
1951  button will minimize <application>Privoxy</application> instead of closing
1952  the program (close with the exit option on the File menu).
1953 </para>
1954
1955 <para>
1956  <literal>
1957   <msgtext> 
1958    <literallayout>
1959   <emphasis>close-button-minimizes  1</emphasis>
1960    </literallayout>
1961   </msgtext> 
1962  </literal>
1963 </para>
1964
1965 <para>
1966  The <quote>hide-console</quote> option is specific to the MS-Win console
1967  version of <application>Privoxy</application>. If this option is used,
1968  <application>Privoxy</application> will disconnect from and hide  the
1969  command console.
1970 </para>
1971
1972 <para>
1973  <literal>
1974   <msgtext> 
1975    <literallayout>
1976   #hide-console
1977    </literallayout>
1978   </msgtext> 
1979  </literal>
1980 </para>
1981
1982 </sect3>
1983 </sect2>
1984
1985 <!--  ~  End section  ~  -->
1986
1987
1988 <!--   ~~~~~       New section      ~~~~~     -->
1989 <sect2 id="actionsfile">
1990 <title>The Actions File</title>
1991
1992 <para>
1993  The <quote>default.action</quote> file (formerly
1994  <filename>actionsfile</filename> or <filename>ijb.action</filename>) is used
1995  to define what actions <application>Privoxy</application> takes, and thus
1996  determines how ad images, cookies and various other aspects of HTTP content
1997  and transactions are handled. These can be accepted or rejected for all
1998  sites, or just those sites you choose. See below for a complete list of 
1999  actions. 
2000 </para>
2001 <para> 
2002  Anything you want can blocked, including ads, banners, or just some obnoxious
2003  URL that you would rather not see. Cookies can be accepted or rejected, or
2004  accepted only during the current browser session (i.e. not written to disk).
2005  Changes to <filename>default.action</filename> should be immediately visible
2006  to <application>Privoxy</application> without the need to restart.
2007 </para>
2008
2009 <para>
2010  Note that some sites may misbehave, or possibly not work at all with some 
2011  actions. This may require some tinkering with the rules to get the most 
2012  mileage of <application>Privoxy's</application> features, and still be 
2013  able to see and enjoy just what you want to. There is no general rule of
2014  thumb on these things. There just are too many variables, and sites are 
2015  always changing.
2016
2017 </para>
2018
2019 <para>
2020  The easiest way to edit the <quote>actions</quote> file is with a browser by
2021  loading <ulink url="http://p.p/">http://p.p/</ulink>, and then select
2022  <quote>Edit Actions List</quote>. A text editor can also be used.
2023 </para>
2024
2025 <para>
2026  To determine which actions apply to a request, the URL of the request is
2027  compared to all patterns in this file. Every time it matches, the list of
2028  applicable actions for the URL is incrementally updated. You can trace
2029  this process by visiting <ulink
2030  url="http://p.p/show-url-info">http://p.p/show-url-info</ulink>. 
2031 </para>
2032
2033
2034 <para>
2035  There are four types of lines in this file: comments (begin with a 
2036  <quote>#</quote> character), actions, aliases and patterns, all of which are
2037  explained below, as well as the configuration file syntax that 
2038  <application>Privoxy</application> understands.
2039
2040 </para>
2041
2042
2043 <!--   ~~~~~       New section      ~~~~~     -->
2044 <sect3>
2045 <title>URL Domain and Path Syntax</title>
2046 <para>
2047  Generally, a pattern has the form &lt;domain&gt;/&lt;path&gt;, where both the
2048  &lt;domain&gt; and &lt;path&gt; part are optional. If you only specify a
2049  domain part, the <quote>/</quote> can be left out:
2050 </para>
2051
2052 <para>
2053  <emphasis>www.example.com</emphasis> - is a domain only pattern and will match any request to
2054  <quote>www.example.com</quote>.
2055 </para>
2056
2057 <para>
2058  <emphasis>www.example.com/</emphasis> - means exactly the same.
2059 </para>
2060
2061 <para>
2062  <emphasis>www.example.com/index.html</emphasis> - matches only the single
2063  document <quote>/index.html</quote> on <quote>www.example.com</quote>.
2064 </para>
2065
2066 <para>
2067  <emphasis>/index.html</emphasis> - matches the document <quote>/index.html</quote>, 
2068  regardless of the domain. So would match any page named <quote>index.html</quote>
2069  on any site.
2070 </para>
2071
2072 <para>
2073  <emphasis>index.html</emphasis> - matches nothing, since it would be
2074  interpreted as a domain name and there is no top-level domain called
2075  <quote>.html</quote>.
2076 </para>
2077
2078 <para>
2079  The matching of the domain part offers some flexible options: if the
2080  domain starts or ends with a dot, it becomes unanchored at that end. 
2081  For example:
2082 </para>
2083
2084 <para>
2085  <emphasis>.example.com</emphasis> - matches any domain or sub-domain that
2086  <emphasis>ENDS</emphasis> in <quote>.example.com</quote>.
2087 </para>
2088
2089 <para>
2090  <emphasis>www.</emphasis> - matches any domain that <emphasis>STARTS</emphasis> with
2091  <quote>www</quote>.
2092 </para>
2093
2094 <para>
2095  Additionally, there are wild-cards that you can use in the domain names
2096  themselves. They work pretty similar to shell wild-cards: <quote>*</quote>
2097  stands for zero or more arbitrary characters, <quote>?</quote> stands for
2098  any single character. And you can define character classes in square
2099  brackets and they can be freely mixed:
2100 </para>
2101
2102 <para>
2103  <emphasis>ad*.example.com</emphasis> - matches <quote>adserver.example.com</quote>, 
2104  <quote>ads.example.com</quote>, etc but not <quote>sfads.example.com</quote>.
2105 </para>
2106
2107 <para>
2108  <emphasis>*ad*.example.com</emphasis> - matches all of the above, and then some.
2109 </para>
2110
2111 <para>
2112  <emphasis>.?pix.com</emphasis> - matches <quote>www.ipix.com</quote>,
2113  <quote>pictures.epix.com</quote>, <quote>a.b.c.d.e.upix.com</quote>, etc. 
2114 </para>
2115
2116 <para>
2117  <emphasis>www[1-9a-ez].example.com</emphasis> - matches <quote>www1.example.com</quote>, 
2118  <quote>www4.example.com</quote>, <quote>wwwd.example.com</quote>, 
2119  <quote>wwwz.example.com</quote>, etc., but <emphasis>not</emphasis> 
2120  <quote>wwww.example.com</quote>.
2121 </para>
2122
2123 <para>
2124  If <application>Privoxy</application> was compiled with
2125  <quote>pcre</quote> support (the default), Perl compatible regular expressions
2126  can be used. These are more flexible and powerful than other types 
2127  of <quote>regular expressions</quote>. See the <filename>pcre/docs/</filename> directory or <quote>man
2128  perlre</quote> (also available on  <ulink
2129  url="http://www.perldoc.com/perl5.6/pod/perlre.html">http://www.perldoc.com/perl5.6/pod/perlre.html</ulink>)
2130  for details. A brief discussion of regular expressions is in the 
2131  <link linkend="regex">Appendix</link>. For instance:
2132 </para>
2133
2134 <para>
2135  <emphasis>/.*/advert[0-9]+\.jpe?g</emphasis>  - would match a URL from any
2136  domain, with any path that includes <quote>advert</quote> followed
2137  immediately by one or more digits, then a <quote>.</quote> and ending in
2138  either <quote>jpeg</quote> or <quote>jpg</quote>. So we match
2139  <quote>example.com/ads/advert2.jpg</quote>, and
2140  <quote>www.example.com/ads/banners/advert39.jpeg</quote>, but not
2141  <quote>www.example.com/ads/banners/advert39.gif</quote> (no gifs in the
2142  example pattern).
2143 </para>
2144
2145 <para>
2146  Please note that matching in the path is case
2147  <emphasis>INSENSITIVE</emphasis> by default, but you can switch to case
2148  sensitive at any point in the pattern by using the 
2149  <quote>(?-i)</quote> switch:
2150 </para>
2151
2152 <para>
2153  <emphasis>www.example.com/(?-i)PaTtErN.*</emphasis> - will match only
2154  documents whose path starts with <quote>PaTtErN</quote> in
2155  <emphasis>exactly</emphasis> this capitalization.
2156 </para>
2157
2158 </sect3>
2159
2160 <!--  ~  End section  ~  -->
2161
2162
2163
2164 <!--   ~~~~~       New section      ~~~~~     -->
2165
2166 <sect3>
2167 <title>Actions</title>
2168 <para>
2169  Actions are enabled if preceded with a <quote>+</quote>, and disabled if 
2170  preceded with a <quote>-</quote>. Actions are invoked by enclosing the 
2171  action name in curly braces (e.g. {+some_action}), followed by a list of 
2172  URLs to which the action applies. There are three classes of actions:
2173 </para>
2174
2175 <para>
2176  <itemizedlist>
2177
2178  <listitem>
2179   <para>  
2180    Boolean (e.g. <quote>+/-block</quote>):
2181   </para>
2182   <para>
2183    <literal>
2184     <msgtext> 
2185      <literallayout>
2186   <emphasis>{+name}</emphasis>        # enable this action
2187   <emphasis>{-name}</emphasis>        # disable this action
2188      </literallayout>
2189     </msgtext> 
2190    </literal>
2191   </para>
2192  </listitem>
2193
2194
2195  <listitem>
2196   <para>  
2197    parameterized (e.g. <quote>+/-hide-user-agent</quote>):
2198   </para>
2199   <para>
2200    <literal>
2201     <msgtext> 
2202      <literallayout>
2203   <emphasis>{+name{param}}</emphasis>  # enable action and set parameter to <quote>param</quote>
2204   <emphasis>{-name}</emphasis>         # disable action
2205      </literallayout>
2206     </msgtext> 
2207    </literal>
2208   </para>
2209  </listitem>
2210  
2211  <listitem>
2212   <para>  
2213    Multi-value (e.g. <quote>{+/-add-header{Name: value}}</quote>, <quote>{+/-wafer{name=value}}</quote>):
2214   </para>
2215   <para>
2216    <literal>
2217     <msgtext> 
2218      <literallayout>
2219   <emphasis>{+name{param}}</emphasis>   # enable action and add parameter <quote>param</quote>
2220   <emphasis>{-name{param}}</emphasis>   # remove the parameter <quote>param</quote>
2221   <emphasis>{-name}</emphasis>          # disable this action totally
2222      </literallayout>
2223     </msgtext> 
2224    </literal>
2225   </para>
2226  </listitem>
2227
2228  </itemizedlist>
2229 </para>
2230
2231 <para>
2232  If nothing is specified in this file, no <quote>actions</quote> are taken.
2233  So in this case <application>Privoxy</application> would just be a
2234  normal, non-blocking, non-anonymizing proxy. You must specifically
2235  enable the privacy and blocking features you need (although the 
2236  provided default <filename>default.action</filename> file will 
2237  give a good starting point).
2238 </para>
2239
2240 <para>
2241  Later defined actions always over-ride earlier ones.  So exceptions 
2242  to any rules you make, should come in the latter part of the file. For
2243  multi-valued actions, the actions are applied in the order they are
2244  specified.
2245 </para>
2246
2247 <para>
2248  The list of valid <application>Privoxy</application> <quote>actions</quote> are:
2249 </para>
2250
2251 <para>
2252  <itemizedlist>
2253  
2254  <listitem>
2255   <para>  
2256    Add the specified HTTP header, which is not checked for validity.
2257    You may specify this many times to specify many different headers:
2258   </para>
2259   <para>
2260    <literal>
2261     <msgtext> 
2262      <literallayout>
2263   <emphasis>+add-header{Name: value}</emphasis>
2264      </literallayout>
2265     </msgtext> 
2266    </literal>
2267   </para>
2268  </listitem>
2269  
2270  
2271  <listitem>
2272   <para>  
2273    Block this URL totally. In a default installation, a <quote>blocked</quote>
2274    URL will result in bright red banner that says <quote>BLOCKED</quote>, 
2275    with a reason why it is being blocked, and an option to see it anyway.
2276    The page displayed for this is the <quote>blocked</quote> template 
2277    file.
2278   </para>
2279   <para>
2280    <literal>
2281     <msgtext> 
2282      <literallayout>
2283   <emphasis>+block</emphasis>
2284      </literallayout>
2285     </msgtext> 
2286    </literal>
2287   </para>
2288  </listitem>
2289  
2290  
2291  <listitem>
2292   <para>  
2293    De-animate all animated GIF images, i.e. reduce them to their last frame.
2294    This will also shrink the images considerably (in bytes, not pixels!). If
2295    the option <quote>first</quote> is given, the first frame of the animation
2296    is used as the replacement. If <quote>last</quote> is given, the last frame
2297    of the animation is used instead, which probably makes more sense for most
2298    banner animations, but also has the risk of not showing the entire last
2299    frame (if it is only a delta to an earlier frame).
2300   </para>
2301   <para>
2302    <literal>
2303     <msgtext> 
2304      <literallayout>
2305   <emphasis>+deanimate-gifs{last}</emphasis>
2306   <emphasis>+deanimate-gifs{first}</emphasis>
2307      </literallayout>
2308     </msgtext> 
2309    </literal>
2310   </para>
2311  </listitem>
2312  
2313  <listitem>
2314   <para>
2315    <quote>+downgrade</quote> will downgrade HTTP/1.1 client requests to
2316    HTTP/1.0 and downgrade the responses as well. Use this action for servers
2317    that use HTTP/1.1 protocol features that
2318    <application>Privoxy</application> doesn't handle well yet. HTTP/1.1 
2319    is only partially implemented. Default is not to downgrade requests.
2320   </para>
2321   <para>
2322    <literal>
2323     <msgtext> 
2324      <literallayout>
2325   <emphasis>+downgrade</emphasis>
2326      </literallayout>
2327     </msgtext> 
2328    </literal>
2329   </para>
2330  </listitem> 
2331  
2332  <listitem>
2333   <para>  
2334    Many sites, like yahoo.com, don't just link to other sites. Instead, they
2335    will link to some script on their own server, giving the destination as a
2336    parameter, which will then redirect you to the final target. URLs resulting
2337    from this scheme typically look like:
2338    http://some.place/some_script?http://some.where-else.
2339   </para>
2340   <para>
2341    Sometimes, there are even multiple consecutive redirects encoded in the
2342    URL. These redirections via scripts make your web browsing more traceable,
2343    since the server from which you follow such a link can see where you go to.
2344    Apart from that, valuable bandwidth and time is wasted, while your browser
2345    ask the server for one redirect after the other. Plus, it feeds the
2346    advertisers.
2347   </para>
2348   <para>
2349    The <quote>+fast-redirects</quote> option enables interception of these
2350    types of requests by <application>Privoxy</application>, who will cut off
2351    all but the last valid URL in the request and send a local redirect back to
2352    your browser without contacting the intermediate site(s).
2353   </para>
2354   <para>
2355    <literal>
2356     <msgtext> 
2357      <literallayout>
2358   <emphasis>+fast-redirects</emphasis>
2359      </literallayout>
2360     </msgtext> 
2361    </literal>
2362   </para>
2363  </listitem>
2364
2365  <listitem>
2366   <para>  
2367    Apply the filters in the <literal>section_header</literal> 
2368    section of the <filename>default.filter</filename> file to the site(s).
2369    <filename>default.filter</filename> sections are grouped according to like
2370    functionality. <application>Filters</application> can be used to 
2371    re-write any of the raw page content. This is a potentially a 
2372    very powerful feature!
2373   </para> 
2374    
2375   <para>
2376    <literal>
2377     <msgtext> 
2378      <literallayout>
2379  <emphasis>+filter{section_header}</emphasis>
2380      </literallayout>
2381     </msgtext> 
2382    </literal>
2383   </para>
2384
2385   <para>   
2386    Filter sections that are pre-defined in the supplied
2387    <filename>default.filter</filename> include:
2388   </para>
2389
2390  <blockquote>
2391   <simplelist>
2392    <member>
2393      <emphasis>html-annoyances</emphasis>:  Get rid of particularly annoying HTML abuse.
2394    </member>
2395   </simplelist>
2396   <simplelist>
2397    <member>
2398     <emphasis>js-annoyances</emphasis>:    Get rid of particularly annoying JavaScript abuse
2399    </member>
2400   </simplelist>
2401   <simplelist>
2402    <member>
2403     <emphasis>no-poups</emphasis>:         Kill all popups in JS and HTML
2404    </member>
2405   </simplelist>
2406   <simplelist>
2407    <member>
2408     <emphasis>frameset-borders</emphasis>: Give frames a border
2409    </member>
2410   </simplelist>
2411   <simplelist>
2412    <member>
2413     <emphasis>webbugs</emphasis>:          Squish WebBugs (1x1 invisible GIFs used for user tracking)
2414    </member>
2415   </simplelist>
2416   <simplelist>
2417    <member>
2418     <emphasis>no-refresh</emphasis>:       Automatic refresh sucks on auto-dialup lines
2419    </member>
2420   </simplelist>
2421   <simplelist>
2422    <member>
2423     <emphasis>fun</emphasis>:              Text replacements  for subversive browsing fun!
2424    </member>
2425   </simplelist>
2426   <simplelist>
2427    <member>
2428     <emphasis>nimda</emphasis>:            Remove (virus) Nimda code.
2429    </member>
2430   </simplelist>
2431   <simplelist>
2432    <member>
2433      <emphasis>banners-by-size</emphasis>:  Kill banners by size
2434    </member>
2435   </simplelist>
2436   <simplelist>
2437    <member>
2438     <emphasis>crude-parental</emphasis>:   Kill all web pages that contain the words "sex" or "warez"
2439    </member>
2440   </simplelist>
2441  </blockquote>
2442
2443  </listitem>
2444
2445  <listitem>
2446   <para>  
2447    Block any existing X-Forwarded-for header, and do not add a new one:
2448   </para>
2449   <para>
2450    <literal>
2451     <msgtext> 
2452      <literallayout>
2453   <emphasis>+hide-forwarded</emphasis>
2454      </literallayout>
2455     </msgtext> 
2456    </literal>
2457   </para>
2458  </listitem>
2459
2460  <listitem>
2461   <para>  
2462    If the browser sends a <quote>From:</quote> header containing your e-mail
2463    address, this either completely removes the header (<quote>block</quote>), or
2464    changes it to the specified e-mail address.
2465   </para>
2466   <para>
2467    <literal>
2468     <msgtext> 
2469      <literallayout>
2470   <emphasis>+hide-from{block}</emphasis>
2471   <emphasis>+hide-from{spam@sittingduck.xqq}</emphasis>
2472      </literallayout>
2473     </msgtext> 
2474    </literal>
2475   </para>
2476  </listitem>
2477  
2478  <listitem>
2479   <para>  
2480    Don't send the <quote>Referer:</quote> (sic) header to the web site.  You
2481    can block it, forge a URL to the same server as the request (which is
2482    preferred because some sites will not send images otherwise) or set it to a
2483    constant, user defined string of your choice.
2484   </para>
2485   <para>
2486    <literal>
2487     <msgtext> 
2488      <literallayout>
2489   <emphasis>+hide-referer{block}</emphasis>
2490   <emphasis>+hide-referer{forge}</emphasis>
2491   <emphasis>+hide-referer{http://nowhere.com}</emphasis>
2492      </literallayout>
2493     </msgtext> 
2494    </literal>
2495   </para>
2496  </listitem>
2497  
2498  <listitem>
2499   <para>  
2500    Alternative spelling of <quote>+hide-referer</quote>.  It has the same
2501    parameters, and can be freely mixed with, <quote>+hide-referer</quote>.
2502    (<quote>referrer</quote> is the correct English spelling, however the HTTP
2503    specification has a bug - it requires it to be spelled <quote>referer</quote>.) 
2504   </para>
2505   <para>
2506    <literal>
2507     <msgtext> 
2508      <literallayout>
2509   <emphasis>+hide-referrer{...}</emphasis>
2510      </literallayout>
2511     </msgtext> 
2512    </literal>
2513   </para>
2514  </listitem>
2515
2516  <listitem>
2517   <para>  
2518    Change the <quote>User-Agent:</quote> header so web servers can't tell your
2519    browser type.  Warning! This breaks many web sites.  Specify the
2520    user-agent value you want. Example, pretend to be using Netscape on
2521    Linux:
2522   </para>
2523   <para>
2524    <literal>
2525     <msgtext> 
2526      <literallayout>
2527   <emphasis>+hide-user-agent{Mozilla (X11; I; Linux 2.0.32 i586)}</emphasis>
2528      </literallayout>
2529     </msgtext> 
2530    </literal>
2531   </para>
2532  <!-- 
2533   <para>
2534    Or to identify yourself explicitly as a  <application>Privoxy</application> user:
2535   </para>
2536   <para>
2537    <literal>
2538     <msgtext> 
2539      <literallayout>
2540   <emphasis>+hide-user-agent{Privoxy/1.0}</emphasis>
2541      </literallayout>
2542     </msgtext> 
2543    </literal>
2544   </para>
2545    (Don't change the version number from 1.0 - after all, why tell them?)
2546   <para>
2547   </para>
2548   <para>
2549    <literal>
2550     <msgtext> 
2551      <literallayout>
2552   <emphasis>+hide-user-agent{browser-type}</emphasis>
2553      </literallayout>
2554     </msgtext> 
2555    </literal>
2556   </para>
2557 -->
2558  </listitem>
2559
2560  <listitem>
2561   <para>  
2562    Treat this URL as an image.  This only matters if it's also <quote>+block</quote>ed,
2563    in which case a <quote>blocked</quote> image can be sent rather than a HTML page.
2564    See <quote>+image-blocker{}</quote> below for the control over what is actually sent.
2565    If you want <emphasis>invisible</emphasis> ads, they should be defined as 
2566    <emphasis>images</emphasis> and <emphasis>blocked</emphasis>. And also, 
2567    <quote>image-blocker</quote>  should be set to <quote>blank</quote>. Note you 
2568    cannot treat HTML pages as images in most cases. For instance, frames 
2569    require an HTML page to display. Forcing an <quote>image</quote> in this 
2570    situation just will not work.
2571   </para>
2572   <para>
2573    <literal>
2574     <msgtext> 
2575      <literallayout>
2576   <emphasis>+image</emphasis>
2577      </literallayout>
2578     </msgtext> 
2579    </literal>
2580   </para>
2581  </listitem>
2582  
2583  <listitem>
2584   <para> Decides what to do with URLs that end up tagged with <quote>{+block
2585   +image}</quote>, e.g an advertizement. There are five options.
2586   <quote>-image-blocker</quote> will send a HTML <quote>blocked</quote> page,
2587   usually resulting in a <quote>broken image</quote> icon.
2588 <!--   <quote>+image-blocker{logo}</quote> will send a -->
2589 <!--   <application>Privoxy</application> logo -->
2590 <!--   image. -->
2591 <quote>+image-blocker{blank}</quote> will send a 1x1 transparent GIF
2592 image. And finally, <quote>+image-blocker{http://xyz.com}</quote> will send a
2593 HTTP temporary redirect to the specified image. This has the advantage of the
2594 icon being being cached by the browser, which will speed up the display.
2595 <quote>+image-blocker{pattern}</quote> will send a checkboard type pattern
2596 <!-- , -->
2597 <!-- which scales better than the logo (which can get blocky if the browser -->
2598 <!-- enlarges it too much). -->
2599   </para>
2600   <para>
2601    <literal>
2602     <msgtext> 
2603      <literallayout>
2604 <!--   <emphasis>+image-blocker{logo}</emphasis> -->
2605   <emphasis>+image-blocker{blank}</emphasis>
2606   <emphasis>+image-blocker{pattern}</emphasis>
2607   <emphasis>+image-blocker{http://p.p/send-banner}</emphasis>
2608      </literallayout>
2609     </msgtext> 
2610    </literal>
2611   </para>
2612  </listitem>
2613  
2614  <listitem>
2615    <para> 
2616    By default (i.e. in the absence of a <quote>+limit-connect</quote>
2617    action), <application>Privoxy</application> will only allow CONNECT
2618    requests to port 443, which is the standard port for https as a 
2619    precaution.
2620   </para>
2621  
2622   <para>
2623    The CONNECT methods exists in HTTP to allow access to secure websites
2624    (https:// URLs) through proxies. It works very simply: the proxy
2625    connects to the server on the specified port, and then short-circuits
2626    its connections to the client <emphasis>and</emphasis> to the remote proxy.
2627    This can be a big security hole, since CONNECT-enabled proxies can
2628    be abused as TCP relays very easily.
2629   </para>
2630   
2631   <para> 
2632    If you want to allow CONNECT for more ports than this, or want to forbid
2633    CONNECT altogether, you can specify a comma separated list of ports and
2634    port ranges (the latter using dashes, with the minimum defaulting to 0 and
2635    max to 65K):
2636   </para>
2637
2638   <para>
2639    <literal>
2640     <msgtext> 
2641      <literallayout>
2642   <emphasis>+limit-connect{443}                 # This is the default and need no be specified.</emphasis>
2643   <emphasis>+limit-connect{80,443}              # Ports 80 and 443 are OK.</emphasis>
2644   <emphasis>+limit-connect{-3, 7, 20-100, 500-} # Port less than 3, 7, 20 to 100</emphasis>
2645   <emphasis>                                    #and above 500 are OK.</emphasis>
2646      </literallayout>
2647     </msgtext> 
2648    </literal>
2649   </para>
2650
2651  </listitem> 
2652  
2653  <listitem>
2654   <para>
2655    <quote>+no-compression</quote> prevents the website from compressing the
2656    data. Some websites do this, which can be a problem for
2657    <application>Privoxy</application>, since <quote>+filter</quote>,
2658    <quote>+no-popup</quote> and <quote>+gif-deanimate</quote> will not work on
2659    compressed data. This will slow down connections to those websites,
2660    though. Default is <quote>no-compression</quote> is turned on.
2661   </para>
2662
2663   <para>
2664    <literal>
2665     <msgtext> 
2666      <literallayout>
2667   <emphasis>+nocompression</emphasis>
2668      </literallayout>
2669     </msgtext> 
2670    </literal>
2671   </para>
2672  </listitem> 
2673  
2674  <listitem>
2675   <para>  
2676    If the website sets cookies, <quote>no-cookies-keep</quote> will make sure
2677    they are erased when you exit and restart your web browser. This makes
2678    profiling cookies useless, but won't break sites which require cookies so
2679    that you can log in for transactions. Default: on.
2680   </para>
2681   <para>
2682    <literal>
2683     <msgtext> 
2684      <literallayout>
2685   <emphasis>+no-cookies-keep</emphasis>
2686      </literallayout>
2687     </msgtext> 
2688    </literal>
2689   </para>
2690  </listitem>
2691  
2692  <listitem>
2693   <para>  
2694    Prevent the website from reading cookies:
2695   </para>
2696   <para>
2697    <literal>
2698     <msgtext> 
2699      <literallayout>
2700   <emphasis>+no-cookies-read</emphasis>
2701      </literallayout>
2702     </msgtext> 
2703    </literal>
2704   </para>
2705  </listitem>
2706  
2707  <listitem>
2708   <para>  
2709    Prevent the website from setting cookies:
2710   </para>
2711   <para>
2712    <literal>
2713     <msgtext> 
2714      <literallayout>
2715   <emphasis>+no-cookies-set</emphasis>
2716      </literallayout>
2717     </msgtext> 
2718    </literal>
2719   </para>
2720  </listitem>
2721  
2722  <listitem>
2723   <para>  
2724    Filter the website through a built-in filter to disable those obnoxious 
2725    JavaScript pop-up windows via window.open(), etc. The two alternative
2726    spellings are equivalent.
2727   </para>
2728   <para>
2729    <literal>
2730     <msgtext> 
2731      <literallayout>
2732   <emphasis>+no-popup</emphasis>
2733   <emphasis>+no-popups</emphasis>
2734      </literallayout>
2735     </msgtext> 
2736    </literal>
2737   </para>
2738  </listitem>
2739  
2740  <listitem>
2741   <para>  
2742    This action only applies if you are using a <filename>jarfile</filename>
2743    for saving cookies. It sends a cookie to every site stating that you do not
2744    accept any copyright on cookies sent to you, and asking them not to track
2745    you.  Of course, this is a (relatively) unique header they could use to
2746    track you.
2747   </para>
2748   <para>
2749    <literal>
2750     <msgtext> 
2751      <literallayout>
2752   <emphasis>+vanilla-wafer</emphasis>
2753      </literallayout>
2754     </msgtext> 
2755    </literal>
2756   </para>
2757  </listitem>
2758  
2759  <listitem>
2760   <para>  
2761    This allows you to add an arbitrary cookie. It can be specified multiple
2762    times in order to add as many cookies as you like.
2763   </para>
2764   <para>
2765    <literal>
2766     <msgtext> 
2767      <literallayout>
2768   <emphasis>+wafer{name=value}</emphasis>
2769      </literallayout>
2770     </msgtext> 
2771    </literal>
2772   </para>
2773  </listitem>
2774
2775  </itemizedlist>
2776 </para>
2777
2778 <para>
2779  The meaning of any of the above is reversed by preceding the action with a 
2780  <quote>-</quote>, in place of the <quote>+</quote>.
2781 </para>
2782
2783 <para>
2784  Some examples:
2785 </para>
2786
2787 <para>
2788  Turn off cookies by default, then allow a few through for specified sites:
2789 </para>
2790   
2791 <para>
2792  <literal>
2793   <msgtext> 
2794    <literallayout>
2795  # Turn off all persistent cookies
2796  { +no-cookies-read }
2797  { +no-cookies-set }
2798  # Allow cookies for this browser session ONLY
2799  { +no-cookies-keep }
2800
2801  # Exceptions to the above, sites that benefit from persistent cookies
2802  { -no-cookies-read }
2803  { -no-cookies-set }
2804  { -no-cookies-keep }
2805  .javasoft.com
2806  .sun.com
2807  .yahoo.com
2808  .msdn.microsoft.com
2809  .redhat.com
2810
2811  # Alternative way of saying the same thing
2812  {-no-cookies-set -no-cookies-read -no-cookies-keep}
2813  .sourceforge.net
2814  .sf.net
2815    </literallayout>
2816   </msgtext> 
2817  </literal>
2818 </para>
2819
2820 <para>
2821  Now turn off <quote>fast redirects</quote>, and then we allow two exceptions:
2822 </para>
2823
2824 <para>
2825  <literal>
2826   <msgtext> 
2827    <literallayout>
2828  # Turn them off!
2829  {+fast-redirects}
2830  
2831  # Reverse it for these two sites, which don't work right without it.
2832  {-fast-redirects}
2833  www.ukc.ac.uk/cgi-bin/wac\.cgi\?
2834  login.yahoo.com
2835    </literallayout>
2836   </msgtext> 
2837  </literal>
2838 </para>
2839
2840 <para>
2841  Turn on page filtering according to rules in the defined sections 
2842  of <filename>refilterfile</filename>, and make one exception for 
2843  sourceforge:
2844  </para>
2845
2846 <para>
2847  <literal>
2848   <msgtext> 
2849    <literallayout>
2850  # Run everything through the filter file, using only the
2851  # specified sections:
2852  +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}\
2853  +filter{webbugs} +filter{nimda} +filter{banners-by-size}
2854               
2855  # Then disable filtering of code from sourceforge!
2856  {-filter}
2857  .cvs.sourceforge.net
2858    </literallayout>
2859   </msgtext> 
2860  </literal>
2861 </para>
2862
2863 <para>
2864  Now some URLs that we want <quote>blocked</quote> (normally generates 
2865  the <quote>blocked</quote> banner). Many of these use regular expressions
2866  that will expand to match multiple URLs:
2867 </para>
2868
2869 <para>
2870  <literal>
2871   <msgtext> 
2872    <literallayout>
2873   # Blocklist:
2874   {+block}
2875   /.*/(.*[-_.])?ads?[0-9]?(/|[-_.].*|\.(gif|jpe?g))
2876   /.*/(.*[-_.])?count(er)?(\.cgi|\.dll|\.exe|[?/])
2877   /.*/(ng)?adclient\.cgi
2878   /.*/(plain|live|rotate)[-_.]?ads?/
2879   /.*/(sponsor)s?[0-9]?/
2880   /.*/_?(plain|live)?ads?(-banners)?/
2881   /.*/abanners/
2882   /.*/ad(sdna_image|gifs?)/
2883   /.*/ad(server|stream|juggler)\.(cgi|pl|dll|exe)
2884   /.*/adbanners/
2885   /.*/adserver
2886   /.*/adstream\.cgi
2887   /.*/adv((er)?ts?|ertis(ing|ements?))?/
2888   /.*/banner_?ads/
2889   /.*/banners?/
2890   /.*/banners?\.cgi/
2891   /.*/cgi-bin/centralad/getimage
2892   /.*/images/addver\.gif
2893   /.*/images/marketing/.*\.(gif|jpe?g)
2894   /.*/popupads/
2895   /.*/siteads/
2896   /.*/sponsor.*\.gif
2897   /.*/sponsors?[0-9]?/
2898   /.*/advert[0-9]+\.jpg
2899   /Media/Images/Adds/
2900   /ad_images/
2901   /adimages/
2902   /.*/ads/
2903   /bannerfarm/
2904   /grafikk/annonse/
2905   /graphics/defaultAd/
2906   /image\.ng/AdType
2907   /image\.ng/transactionID
2908   /images/.*/.*_anim\.gif # alvin brattli
2909   /ip_img/.*\.(gif|jpe?g)
2910   /rotateads/
2911   /rotations/ 
2912   /worldnet/ad\.cgi
2913   /cgi-bin/nph-adclick.exe/
2914   /.*/Image/BannerAdvertising/
2915   /.*/ad-bin/
2916   /.*/adlib/server\.cgi
2917   /autoads/
2918    </literallayout>
2919   </msgtext> 
2920  </literal>
2921 </para>
2922
2923 <para>
2924  Note that many of these actions have the potential to cause a page to
2925  misbehave, possibly even not to display at all. There are many ways 
2926  a site designer may choose to design his site, and what HTTP header 
2927  content he may depend on. There is no way to have hard and fast rules 
2928  for all sites. See the <link linkend="ACTIONSANAT">Appendix</link>
2929  for a brief example on troubleshooting actions.
2930
2931 </para>
2932
2933 </sect3>
2934
2935 <!--  ~  End section  ~  -->
2936
2937
2938 <!--   ~~~~~       New section      ~~~~~     -->
2939 <sect3>
2940 <title>Aliases</title>
2941 <para>
2942  Custom <quote>actions</quote>, known to <application>Privoxy</application>
2943  as <quote>aliases</quote>, can be defined by combining other <quote>actions</quote>.
2944  These can in turn be invoked just like the built-in <quote>actions</quote>.
2945  Currently, an alias can contain any character except space, tab, <quote>=</quote>,
2946  <quote>{</quote> or <quote>}</quote>. But please use only <quote>a</quote>-
2947  <quote>z</quote>, <quote>0</quote>-<quote>9</quote>, <quote>+</quote>, and
2948  <quote>-</quote>. Alias names are not case sensitive, and 
2949  <emphasis>must be defined  before anything</emphasis> else in the
2950  <filename>default.action</filename>file! And there can only be one set of
2951  <quote>aliases</quote> defined.
2952 </para>
2953
2954 <para>
2955  Now let's define a few aliases:
2956 </para>
2957
2958 <para>
2959  <literal>
2960   <msgtext> 
2961    <literallayout>
2962  # Useful customer aliases we can use later. These must come first!
2963  {{alias}}
2964  +no-cookies = +no-cookies-set +no-cookies-read
2965  -no-cookies = -no-cookies-set -no-cookies-read
2966  fragile     = -block -no-cookies -filter -fast-redirects -hide-referer -no-popups
2967  shop        = -no-cookies -filter -fast-redirects
2968  +imageblock = +block +image
2969
2970  #For people who don't like to type too much:  ;-)
2971  c0 = +no-cookies
2972  c1 = -no-cookies
2973  c2 = -no-cookies-set +no-cookies-read
2974  c3 = +no-cookies-set -no-cookies-read
2975  #... etc.  Customize to your heart's content.
2976    </literallayout>
2977   </msgtext> 
2978  </literal>
2979 </para>
2980
2981 <para>
2982  Some examples using our <quote>shop</quote> and <quote>fragile</quote>
2983  aliases from above:
2984 </para>
2985
2986 <para>
2987  <literal>
2988   <msgtext> 
2989    <literallayout>
2990  # These sites are very complex and require
2991  # minimal interference.
2992  {fragile}
2993  .office.microsoft.com
2994  .windowsupdate.microsoft.com
2995  .nytimes.com
2996
2997  # Shopping sites - still want to block ads.
2998  {shop}
2999  .quietpc.com
3000  .worldpay.com   # for quietpc.com
3001  .jungle.com
3002  .scan.co.uk
3003
3004  # These shops require pop-ups
3005  {shop -no-popups}
3006  .dabs.com
3007  .overclockers.co.uk
3008    </literallayout>
3009   </msgtext> 
3010  </literal>
3011 </para>
3012
3013 <para>
3014  The <quote>shop</quote> and <quote>fragile</quote> aliases are often used for 
3015  <quote>problem</quote> sites that require most actions to be disabled 
3016  in order to function properly.
3017
3018 </para>
3019
3020 </sect3>
3021 </sect2>
3022
3023 <!--  ~  End section  ~  -->
3024
3025
3026 <!--   ~~~~~       New section      ~~~~~     -->
3027 <sect2 id="filterfile">
3028 <title>The Filter File</title>
3029 <para>
3030  Any web page can be dynamically modified with the filter file. This
3031  modification can be removal, or re-writing, of any web page content,
3032  including tags and non-visible content. The default filter file is
3033  <filename>default.filter</filename>, located in the config directory. 
3034 </para>
3035
3036 <para>
3037  This is potentially a very powerful feature, and requires knowledge of both 
3038  <quote>regular expression</quote> and HTML in order create custom 
3039  filters. But, there are a number of useful filters included with 
3040  <application>Privoxy</application> for many common situations.
3041 </para>
3042
3043 <para>
3044  The included example file is divided into sections. Each section begins 
3045  with the <literal>FILTER</literal> keyword, followed by the identifier 
3046  for that section, e.g. <quote>FILTER: webbugs</quote>. Each section performs
3047  a similar type of filtering, such as <quote>html-annoyances</quote>.
3048 </para>
3049
3050 <para>
3051  This file uses regular expressions to alter or remove any string in the
3052  target page. The expressions can only operate on one line at a time. Some
3053  examples from the included default <filename>default.filter</filename>:
3054 </para>
3055
3056 <para>
3057  Stop web pages from displaying annoying messages in the status bar by
3058  deleting such references:
3059 </para>
3060
3061 <para>
3062  <literal>
3063   <msgtext> 
3064    <literallayout>
3065  FILTER: html-annoyances
3066
3067  # New browser windows should be resizeable and have a location and status
3068  # bar. Make it so.
3069  #
3070  s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig
3071  s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig
3072  s/scrolling="?(no|0|Auto)"?/scrolling=1/ig
3073  s/menubar="?(no|0)"?/menubar=1/ig 
3074
3075  # The &lt;BLINK&gt; tag was a crime!
3076  #
3077  s*&lt;blink&gt;|&lt;/blink&gt;**ig
3078
3079  # Is this evil? 
3080  #
3081  #s/framespacing="?(no|0)"?//ig
3082  #s/margin(height|width)=[0-9]*//gi
3083    </literallayout>
3084   </msgtext> 
3085  </literal>
3086 </para>
3087
3088 <para>
3089  Just for kicks, replace any occurrence of <quote>Microsoft</quote> with
3090  <quote>MicroSuck</quote>, and have a little fun with topical buzzwords: 
3091 </para>
3092
3093 <para>
3094  <literal>
3095   <msgtext> 
3096    <literallayout>
3097  FILTER: fun
3098
3099  s/microsoft(?!.com)/MicroSuck/ig
3100
3101  # Buzzword Bingo:
3102  #
3103  s/industry-leading|cutting-edge|award-winning/&lt;font color=red&gt;&lt;b&gt;BINGO!&lt;/b&gt;&lt;/font&gt;/ig
3104    </literallayout>
3105   </msgtext> 
3106  </literal>
3107 </para>
3108
3109 <para>
3110  Kill those pesky little web-bugs:
3111 </para>
3112
3113 <para>
3114  <literal>
3115   <msgtext> 
3116    <literallayout>
3117  # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
3118  FILTER: webbugs
3119
3120  s/&lt;img\s+[^&gt;]*?(width|height)\s*=\s*['"]?1\D[^&gt;]*?(width|height)\s*=\s*['"]?1(\D[^&gt;]*?)?>/&lt;!-- Squished WebBug --&gt;/sig
3121    </literallayout>
3122   </msgtext> 
3123  </literal>
3124 </para>
3125
3126 </sect2>
3127
3128 <!--  ~  End section  ~  -->
3129
3130
3131
3132 <!--   ~~~~~       New section      ~~~~~     -->
3133
3134 <sect2>
3135 <title>Templates</title>
3136 <para>
3137  When <application>Privoxy</application> displays one of its internal 
3138  pages, such as a 404 Not Found error page, it uses the appropriate template.
3139  On Linux, BSD, and Unix, these are located in
3140  <filename>/etc/privoxy/templates</filename> by default. These may be
3141  customized, if desired.
3142 </para>
3143 <para>
3144  The default <quote>Blocked</quote> banner page with the bright red top 
3145  banner, is called just <quote><filename>blocked</filename></quote>. This 
3146  may be customized or replaced with something else if desired.
3147
3148 </para>
3149 </sect2>
3150
3151 </sect1>
3152
3153 <!--  ~  End section  ~  -->
3154
3155
3156
3157 <!--   ~~~~~       New section      ~~~~~     -->
3158
3159 <sect1 id="contact"><title>Contacting the Developers, Bug Reporting and Feature
3160 Requests</title>
3161
3162 <!-- Include contacting.sgml boilerplate: -->
3163
3164  &contacting;
3165
3166 <!-- end boilerplate -->
3167
3168 </sect1>
3169
3170
3171 <!--   ~~~~~       New section      ~~~~~     -->
3172 <sect1 id="copyright"><title>Copyright and History</title>
3173
3174 <sect2><title>Copyright</title>
3175 <!-- Include copyright.sgml: -->
3176  &copyright;
3177 <!-- end copyright -->
3178 </sect2>
3179
3180 <!--  ~  End section  ~  -->
3181
3182
3183 <!--   ~~~~~       New section      ~~~~~     -->
3184
3185 <sect2 id="history"><title>History</title>
3186 <!-- Include history.sgml: -->
3187  &history;
3188 <!-- end history -->
3189 </sect2>
3190 </sect1>
3191
3192 <!--   ~~~~~       New section      ~~~~~     -->
3193 <sect1 id="seealso"><title>See Also</title>
3194 <!-- Include seealso.sgml: -->
3195  &seealso;
3196 <!-- end seealso -->
3197 </sect1>
3198
3199
3200
3201 <!--   ~~~~~       New section      ~~~~~     -->
3202 <sect1 id="appendix"><title>Appendix</title>
3203
3204
3205 <!--   ~~~~~       New section      ~~~~~     -->
3206 <sect2 id="regex">
3207 <title>Regular Expressions</title>
3208 <para>
3209  <application>Privoxy</application> can use <quote>regular expressions</quote> 
3210  in various config files. Assuming support for <quote>pcre</quote> (Perl
3211  Compatible Regular Expressions) is compiled in, which is the default. Such
3212  configuration directives do not require regular expressions, but they can be
3213  used to increase flexibility by matching a pattern with wild-cards against
3214  URLs.
3215 </para>
3216
3217 <para>
3218  If you are reading this, you probably don't understand what <quote>regular
3219  expressions</quote> are, or what they can do. So this will be a very brief
3220  introduction only. A full explanation would require a book ;-)
3221 </para>
3222
3223 <para>
3224  <quote>Regular expressions</quote> is a way of matching one character
3225  expression against another to see if it matches or not. One of the
3226  <quote>expressions</quote> is a literal string of readable characters
3227  (letter, numbers, etc), and the other is a complex string of literal
3228  characters combined with wild-cards, and other special characters, called
3229  meta-characters. The <quote>meta-characters</quote> have special meanings and
3230  are used to build the complex pattern to be matched against. Perl Compatible
3231  Regular Expressions is an enhanced form of the regular expression language
3232  with backward compatibility.
3233 </para>
3234
3235 <para>
3236  To make a simple analogy, we do something similar when we use wild-card
3237  characters when listing files with the <command>dir</command> command in DOS. 
3238  <literal>*.*</literal> matches all filenames. The <quote>special</quote>
3239  character here is the asterisk which matches any and all characters. We can be
3240  more specific and use <literal>?</literal> to match just individual
3241  characters. So <quote>dir file?.text</quote> would match
3242  <quote>file1.txt</quote>, <quote>file2.txt</quote>, etc. We are pattern
3243  matching, using a similar technique to <quote>regular expressions</quote>!
3244 </para>
3245
3246 <para>
3247  Regular expressions do essentially the same thing, but are much, much more
3248  powerful. There are many more <quote>special characters</quote> and ways of 
3249  building complex patterns however. Let's look at a few of the common ones,
3250  and then some examples:
3251 </para>
3252
3253 <simplelist>
3254  <member>
3255   <emphasis>.</emphasis> - Matches any single character, e.g. <quote>a</quote>,
3256   <quote>A</quote>, <quote>4</quote>, <quote>:</quote>, or <quote>@</quote>.
3257  </member>
3258 </simplelist>
3259
3260 <simplelist>
3261  <member>
3262   <emphasis>?</emphasis> - The preceding character or expression is matched ZERO or ONE
3263   times. Either/or.
3264  </member>
3265 </simplelist>
3266
3267 <simplelist>
3268  <member>
3269   <emphasis>+</emphasis> - The preceding character or expression is matched ONE or MORE
3270   times.
3271  </member>
3272 </simplelist>
3273
3274 <simplelist>
3275  <member>
3276   <emphasis>*</emphasis> - The preceding character or expression is matched ZERO or MORE
3277   times.
3278  </member>
3279 </simplelist>
3280
3281 <simplelist>
3282  <member>
3283   <emphasis>\</emphasis> - The <quote>escape</quote> character denotes that
3284   the following character should be taken literally. This is used where one of the 
3285   special characters (e.g. <quote>.</quote>) needs to be taken literally and
3286   not as a special meta-character.
3287  </member>
3288 </simplelist>
3289
3290 <simplelist>
3291  <member>
3292   <emphasis>[]</emphasis> - Characters enclosed in brackets will be matched if
3293   any of the enclosed characters are encountered.
3294  </member>
3295 </simplelist>
3296
3297 <simplelist>
3298  <member>
3299   <emphasis>()</emphasis> - parentheses are used to group a sub-expression,
3300   or multiple sub-expressions.
3301  </member>
3302 </simplelist>
3303
3304 <simplelist>
3305  <member>
3306   <emphasis>|</emphasis> - The <quote>bar</quote> character works like an
3307   <quote>or</quote> conditional statement. A match is successful if the
3308   sub-expression on either side of <quote>|</quote> matches.
3309  </member>
3310 </simplelist>
3311
3312 <simplelist>
3313  <member>
3314   <emphasis>s/string1/string2/g</emphasis> - This is used to rewrite strings of text. 
3315   <quote>string1</quote> is replaced by <quote>string2</quote> in this
3316   example.
3317  </member>
3318 </simplelist>
3319
3320 <para>
3321  These are just some of the ones you are likely to use when matching URLs with 
3322  <application>Privoxy</application>, and is a long way from a definitive
3323  list. This is enough to get us started with a few simple examples which may
3324  be more illuminating:
3325 </para>
3326
3327 <para>
3328  <emphasis><literal>/.*/banners/.*</literal></emphasis> - A  simple example
3329  that uses the common combination of <quote>.</quote> and <quote>*</quote> to 
3330  denote any character, zero or more times. In other words, any string at all.
3331  So we start with a literal forward slash, then our regular expression pattern 
3332  (<quote>.*</quote>) another literal forward slash, the string
3333  <quote>banners</quote>, another forward slash, and lastly another
3334  <quote>.*</quote>. We are building 
3335  a directory path here. This will match any file with the path that has a
3336  directory named <quote>banners</quote> in it. The <quote>.*</quote> matches
3337  any characters, and this could conceivably be more forward slashes, so it
3338  might expand into a much longer looking path. For example, this could match:
3339  <quote>/eye/hate/spammers/banners/annoy_me_please.gif</quote>, or just
3340  <quote>/banners/annoying.html</quote>, or almost an infinite number of other
3341  possible combinations, just so it has <quote>banners</quote> in the path
3342  somewhere.
3343 </para>
3344
3345 <para>
3346  A now something a little more complex:
3347 </para>
3348
3349 <para>
3350  <emphasis><literal>/.*/adv((er)?ts?|ertis(ing|ements?))?/</literal></emphasis> - 
3351  We have several literal forward slashes again (<quote>/</quote>), so we are
3352  building another expression that is a file path statement. We have another 
3353  <quote>.*</quote>, so we are matching against any conceivable sub-path, just so
3354  it matches our expression. The only true literal that <emphasis>must
3355  match</emphasis> our pattern is <application>adv</application>, together with
3356  the forward slashes. What comes after the <quote>adv</quote> string is the
3357  interesting part. 
3358 </para>
3359
3360 <para>
3361  Remember the <quote>?</quote> means the preceding expression (either a
3362  literal character or anything grouped with <quote>(...)</quote> in this case)
3363  can exist or not, since this means either zero or one match. So
3364  <quote>((er)?ts?|ertis(ing|ements?))</quote> is optional, as are the
3365  individual sub-expressions: <quote>(er)</quote>,
3366  <quote>(ing|ements?)</quote>, and the <quote>s</quote>. The <quote>|</quote>
3367  means <quote>or</quote>. We have two of those. For instance, 
3368  <quote>(ing|ements?)</quote>, can expand to match either <quote>ing</quote> 
3369  <emphasis>OR</emphasis> <quote>ements?</quote>. What is being done here, is an
3370  attempt at matching as many variations of <quote>advertisement</quote>, and 
3371  similar, as possible. So this would expand to match just <quote>adv</quote>,
3372  or <quote>advert</quote>, or <quote>adverts</quote>, or
3373  <quote>advertising</quote>, or <quote>advertisement</quote>, or
3374  <quote>advertisements</quote>. You get the idea. But it would not match 
3375  <quote>advertizements</quote> (with a <quote>z</quote>). We could fix that by
3376  changing our regular expression to: 
3377  <quote>/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/</quote>, which would then match
3378  either spelling.
3379 </para>
3380
3381 <para>
3382  <emphasis><literal>/.*/advert[0-9]+\.(gif|jpe?g)</literal></emphasis> - Again 
3383  another path statement with forward slashes. Anything in the square brackets 
3384  <quote>[]</quote> can be matched. This is using <quote>0-9</quote> as a
3385  shorthand expression to mean any digit one through nine. It is the same as
3386  saying <quote>0123456789</quote>. So any digit matches. The <quote>+</quote>
3387  means one or more of the preceding expression must be included. The preceding 
3388  expression here is what is in the square brackets -- in this case, any digit 
3389  one through nine. Then, at the end, we have a grouping: <quote>(gif|jpe?g)</quote>. 
3390  This includes a <quote>|</quote>, so this needs to match the expression on
3391  either side of that bar character also. A simple <quote>gif</quote> on one side, and the other
3392  side will in turn match either <quote>jpeg</quote> or <quote>jpg</quote>,
3393  since the <quote>?</quote> means the letter <quote>e</quote> is optional and
3394  can be matched once or not at all. So we are building an expression here to
3395  match image GIF or JPEG type image file. It must include the literal
3396  string <quote>advert</quote>, then one or more digits, and a <quote>.</quote>
3397  (which is now a literal, and not a special character, since it is escaped
3398  with <quote>\</quote>), and lastly either <quote>gif</quote>, or
3399  <quote>jpeg</quote>, or <quote>jpg</quote>. Some possible matches would
3400  include: <quote>//advert1.jpg</quote>,
3401  <quote>/nasty/ads/advert1234.gif</quote>,
3402  <quote>/banners/from/hell/advert99.jpg</quote>. It would not match
3403  <quote>advert1.gif</quote> (no leading slash), or
3404  <quote>/adverts232.jpg</quote> (the expression does not include an
3405  <quote>s</quote>), or <quote>/advert1.jsp</quote> (<quote>jsp</quote> is not
3406  in the expression anywhere).
3407 </para>
3408
3409 <para>
3410  <emphasis><literal>s/microsoft(?!.com)/MicroSuck/i</literal></emphasis> - This is 
3411  a substitution. <quote>MicroSuck</quote> will replace any occurrence of 
3412  <quote>microsoft</quote>.  The <quote>i</quote> at the end of the expression
3413  means ignore case. The <quote>(?!.com)</quote> means 
3414  the match should fail if <quote>microsoft</quote> is followed by
3415  <quote>.com</quote>. In other words, this acts like a <quote>NOT</quote>
3416  modifier. In case this is a hyperlink, we don't want to break it ;-).
3417 </para>
3418
3419 <para>
3420  We are barely scratching the surface of regular expressions here so that you
3421  can understand the default <application>Privoxy</application>
3422  configuration files, and maybe use this knowledge to customize your own
3423  installation. There is much, much more that can be done with regular
3424  expressions. Now that you know enough to get started, you can learn more on
3425  your own :/
3426 </para>
3427
3428 <para>
3429  More reading on Perl Compatible Regular expressions: 
3430  <ulink url="http://www.perldoc.com/perl5.6/pod/perlre.html">http://www.perldoc.com/perl5.6/pod/perlre.html</ulink>
3431 </para>
3432
3433 </sect2>
3434
3435 <!--  ~  End section  ~  -->
3436
3437
3438 <!--   ~~~~~       New section      ~~~~~     -->
3439 <sect2>
3440 <title><application>Privoxy</application>'s Internal Pages</title>
3441
3442 <para>
3443  Since <application>Privoxy</application> proxies each requested 
3444  web page, it is easy for <application>Privoxy</application> to 
3445  trap certain special URLs. In this way, we can talk directly to
3446  <application>Privoxy</application>, and see how it is 
3447  configured, see how our rules are being applied, change these 
3448  rules and other configuration options, and even turn
3449  <application>Privoxy's</application> filtering off, all with 
3450  a web browser.
3451
3452 </para>
3453
3454 <para>
3455  The URLs listed below are the special ones that allow direct access 
3456  to <application>Privoxy</application>. Of course,
3457  <application>Privoxy</application> must be running to access these. If 
3458  not, you will get a friendly error message. Internet access is not 
3459  necessary either.
3460 </para>
3461
3462 <para>
3463  <itemizedlist>
3464
3465  <listitem>
3466   <para>  
3467    Privoxy main page: 
3468   </para>
3469   <blockquote>
3470    <para> 
3471      <ulink url="http://config.privoxy.org/">http://config.privoxy.org/</ulink>
3472    </para>
3473   </blockquote>
3474   <para>
3475    Alternately, this may be reached at <ulink
3476    url="http://p.p/">http://p.p/</ulink>, but this
3477    variation may not work as reliably as the above in some configurations.
3478   </para>
3479  </listitem>
3480
3481  <listitem>
3482   <para>  
3483     Show information about the current configuration: 
3484   </para>
3485    <blockquote>
3486    <para> 
3487     <ulink url="http://config.privoxy.org/show-status">http://config.privoxy.org/show-status</ulink>
3488    </para>
3489   </blockquote>
3490  </listitem>
3491  
3492  <listitem>
3493   <para>  
3494     Show the source code version numbers:
3495   </para>
3496   <blockquote>
3497    <para> 
3498     <ulink url="http://config.privoxy.org/show-version">http://config.privoxy.org/show-version</ulink>
3499    </para>
3500   </blockquote>
3501  </listitem>
3502  
3503  <listitem>
3504   <para>  
3505    Show the client's request headers:
3506   </para>
3507   <blockquote>
3508    <para> 
3509     <ulink url="http://config.privoxy.org/show-request">http://config.privoxy.org/show-request</ulink>
3510    </para>
3511   </blockquote>
3512  </listitem>
3513  
3514  <listitem>
3515   <para>  
3516    Show which actions apply to a URL and why:
3517   </para>
3518    <blockquote>
3519    <para> 
3520     <ulink url="http://config.privoxy.org/show-url-info">http://config.privoxy.org/show-url-info</ulink>
3521    </para>
3522   </blockquote>
3523  </listitem>
3524  
3525  <listitem>
3526   <para>  
3527    Toggle Privoxy on or off. In this case, <quote>Privoxy</quote> continues 
3528    to run, but only as a pass-through proxy, with no actions taking place:
3529   </para>
3530    <blockquote>
3531    <para> 
3532     <ulink url="http://config.privoxy.org/toggle">http://config.privoxy.org/toggle</ulink>
3533    </para>
3534   </blockquote>
3535   <para>
3536    Short cuts. Turn off, then on: 
3537   </para>
3538    <blockquote>
3539    <para> 
3540      <ulink url="http://config.privoxy.org/toggle?set=disable">http://config.privoxy.org/toggle?set=disable</ulink>
3541    </para>
3542   </blockquote>
3543    <blockquote>
3544    <para> 
3545      <ulink url="http://config.privoxy.org/toggle?set=enable">http://config.privoxy.org/toggle?set=enable</ulink>
3546    </para>
3547   </blockquote>
3548  </listitem>
3549
3550  <listitem>
3551   <para>  
3552    Edit the actions list file:
3553   </para>
3554    <blockquote>
3555    <para> 
3556     <ulink url="http://config.privoxy.org/edit-actions">http://config.privoxy.org/edit-actions</ulink>
3557    </para>
3558   </blockquote>
3559  </listitem>
3560  
3561  </itemizedlist>
3562 </para>
3563
3564 <para>
3565  These may be bookmarked for quick reference.
3566
3567 </para>
3568
3569 <sect3 id="bookmarklets">
3570 <title>Bookmarklets</title>
3571 <para>
3572  Here are some bookmarklets to allow you to easily access a
3573  <quote>mini</quote> version of this page. They are designed for MS Internet
3574  Explorer, but should work equally well in Netscape, Mozilla, and other
3575  browsers which support JavaScript. They are designed to run directly from
3576  your bookmarks - not by clicking the links below (although that will work for
3577  testing).
3578 </para>
3579 <para>
3580  To save them, right-click the link and choose <quote>Add to Favorites</quote>
3581  (IE) or <quote>Add Bookmark</quote> (Netscape). You will get a warning that
3582  the bookmark <quote>may not be safe</quote> - just click OK. Then you can run the
3583  Bookmarklet directly from your favourites/bookmarks. For even faster access,
3584  you can put them on the <quote>Links</quote> bar (IE) or the <quote>Personal
3585  Toolbar</quote> (Netscape), and run them with a single click. 
3586 </para>
3587
3588 <para>
3589  <itemizedlist>
3590
3591   <listitem>
3592    <para>
3593     <ulink 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());">Enable Privoxy</ulink>
3594    </para>
3595   </listitem> 
3596
3597   <listitem>
3598    <para>
3599     <ulink 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());">Disable Privoxy</ulink>
3600    </para>
3601   </listitem> 
3602
3603   <listitem>
3604    <para>
3605     <ulink 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());">Toggle Privoxy</ulink> (Toggles between enabled and disabled)
3606    </para>
3607   </listitem> 
3608
3609   <listitem>
3610    <para>
3611     <ulink 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());">View Privoxy Status</ulink>
3612    </para>
3613   </listitem> 
3614
3615  </itemizedlist>
3616 </para>
3617
3618 <para>
3619  Credit: The site which gave me the general idea for these bookmarklets is
3620  <ulink url="http://www.bookmarklets.com">www.bookmarklets.com</ulink>. They
3621  have more information about bookmarklets. 
3622 </para>
3623
3624
3625 </sect3>
3626
3627 </sect2>
3628
3629
3630 <!--   ~~~~~       New section      ~~~~~     -->
3631 <sect2 id="actionsanat">
3632 <title>Anatomy of an Action</title>
3633
3634 <para>
3635  The way <application>Privoxy</application> applies <quote>actions</quote>
3636  and <quote>filters</quote> to any given URL can be complex, and not always so
3637  easy to understand what is happening. And sometimes we need to be able to
3638  <emphasis>see</emphasis> just what <application>Privoxy</application> is
3639  doing. Especially, if something <application>Privoxy</application> is doing
3640  is causing us a problem inadvertantly. It can be a little daunting to look at
3641  the actions and filters files themselves, since they tend to be filled with
3642  <quote>regular expressions</quote> whose consequences are not always 
3643  so obvious. <application>Privoxy</application> provides the 
3644  <ulink url="http://config.privoxy.org/show-url-info">http://config.privoxy.org/show-url-info</ulink>
3645  page that can show us very specifically how <application>actions</application>
3646  are being applied to any given URL. This is a big help for troubleshooting.
3647  </para>
3648
3649 <para>
3650  First, enter one URL (or partial URL) at the prompt, and then
3651  <application>Privoxy</application> will tell us 
3652  how the current configuration will handle it. This will not
3653  help with filtering effects from the <filename>default.filter</filename> file! It
3654  also will not tell you about any other URLs that may be embedded within the
3655  URL you are testing. For instance, images such as ads are expressed as URLs
3656  within the raw page source of HTML pages. So you will only get info for the
3657  actual URL that is pasted into the prompt area -- not any sub-URLs. If you
3658  want to know about embedded URLs like ads, you will have to dig those out of
3659  the HTML source. Use your browser's <quote>View Page Source</quote> option
3660  for this.
3661 </para>
3662
3663 <para>
3664  Let's look at an example, <ulink url="http://google.com">google.com</ulink>, 
3665  one section at a time:
3666 </para>
3667
3668 <para>
3669  <screen>
3670  System default actions:
3671
3672  { -add-header -block -deanimate-gifs -downgrade -fast-redirects -filter 
3673    -hide-forwarded -hide-from -hide-referer -hide-user-agent -image 
3674    -image-blocker -limit-connect -no-compression -no-cookies-keep 
3675    -no-cookies-read -no-cookies-set -no-popups -vanilla-wafer -wafer }
3676  
3677  </screen>
3678 </para>
3679
3680 <para>
3681  This is the top section, and only tells us of the compiled in defaults. This 
3682  is basically what <application>Privoxy</application> would do if there 
3683  were not any <quote>actions</quote> defined, i.e. it does nothing. Every action 
3684  is disabled. This is not particularly informative for our purposes here. OK,
3685  next section:
3686 </para>
3687
3688 <para>
3689  <screen>
3690
3691  Matches for http://google.com:
3692
3693  { -add-header -block +deanimate-gifs -downgrade +fast-redirects 
3694    +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups} 
3695    +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal} 
3696    +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge} 
3697    -hide-user-agent -image +image-blocker{blank} +no-compression 
3698    +no-cookies-keep -no-cookies-read -no-cookies-set +no-popups 
3699    -vanilla-wafer -wafer }
3700    /
3701
3702  { -no-cookies-keep -no-cookies-read -no-cookies-set }
3703   .google.com
3704
3705  { -fast-redirects }
3706   .google.com
3707
3708  </screen>
3709 </para>
3710
3711 <para>
3712  This is much more informative, and tells us how we have defined our 
3713  <quote>actions</quote>, and which ones match for our example, 
3714  <quote>google.com</quote>. The first grouping shows our default 
3715  settings, which would apply to all URLs. If you look at your <quote>actions</quote>
3716  file, this would be the section just below the <quote>aliases</quote> section 
3717  near the top. This applies to all URLs as signified by the single forward
3718  slash -- <quote>/</quote>.
3719  
3720 </para>
3721
3722 <para>
3723  These are the default actions we have enabled. But we can define additional
3724  actions that would be exceptions to these general rules, and then list 
3725  specific URLs that these exceptions would apply to. Last match wins.
3726  Just below this then are two explict matches for <quote>.google.com</quote>.
3727  The first is negating our various cookie blocking actions (i.e. we will allow
3728  cookies here). The second is allowing <quote>fast-redirects</quote>. Note
3729  that there is a leading dot here -- <quote>.google.com</quote>. This will
3730  match any hosts and sub-domains, in the google.com domain also, such as
3731  <quote>www.google.com</quote>. So, apparently, we have these actions defined
3732  somewhere in the lower part of our actions file, and
3733  <quote>google.com</quote> is referenced in these sections.
3734
3735 </para>
3736
3737 <para>
3738  And now we pull it altogether in the bottom section and summarize how
3739  <application>Privoxy</application> is appying all its <quote>actions</quote> 
3740  to <quote>google.com</quote>:
3741
3742 </para>
3743
3744 <para>
3745  <screen>
3746
3747  Final results:
3748
3749  -add-header -block -deanimate-gifs -downgrade -fast-redirects 
3750  +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups} 
3751  +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal} 
3752  +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge} 
3753  -hide-user-agent -image +image-blocker{blank} -limit-connect +no-compression 
3754  -no-cookies-keep -no-cookies-read -no-cookies-set +no-popups -vanilla-wafer 
3755  -wafer
3756
3757  </screen>
3758 </para>
3759
3760 <para>
3761  Now another example, <quote>ad.doubleclick.net</quote>:
3762 </para>
3763
3764 <para>
3765  <screen>
3766
3767  { +block +image }
3768   .ad.doubleclick.net
3769
3770  { +block +image }
3771   ad*.
3772
3773  { +block +image }
3774   .doubleclick.net
3775
3776  </screen>
3777 </para>
3778
3779 <para>
3780  We'll just show the interesting part here, the explicit matches. It is 
3781  matched three different times. Each as an <quote>+block +image</quote>,
3782  which is the expanded form of one of our aliases that had been defined as: 
3783  <quote>+imageblock</quote>. (<quote>Aliases</quote> are defined in the 
3784  first section of the actions file and typically used to combine more 
3785  than one action.)
3786 </para>
3787
3788 <para>
3789  Any one of these would have done the trick and blocked this as an unwanted 
3790  image. This is unnecessarily redundant since the last case effectively 
3791  would also cover the first. No point in taking chances with these guys 
3792  though ;-) Note that if you want an ad or obnoxious 
3793  URL to be invisible, it should be defined as <quote>ad.doubleclick.net</quote>
3794  is done here -- as both a <quote>+block</quote> <emphasis>and</emphasis> an
3795  <quote>+image</quote>. The custom alias <quote>+imageblock</quote> does this
3796  for us.
3797 </para>
3798
3799 <para>
3800  One last example. Let's try <quote>http://www.rhapsodyk.net/adsl/HOWTO/</quote>.
3801  This one is giving us problems. We are getting a blank page. Hmmm...
3802 </para>
3803
3804 <para>
3805  <screen>
3806
3807  Matches for http://www.rhapsodyk.net/adsl/HOWTO/:
3808
3809  { -add-header -block +deanimate-gifs -downgrade +fast-redirects 
3810    +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups} 
3811    +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal} 
3812    +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge} 
3813    -hide-user-agent -image +image-blocker{blank} +no-compression 
3814    +no-cookies-keep -no-cookies-read -no-cookies-set +no-popups 
3815    -vanilla-wafer -wafer }
3816    /
3817
3818  { +block +image }
3819   /ads
3820
3821  </screen>
3822 </para>
3823
3824 <para>
3825  Ooops, the <quote>/adsl/</quote> is matching <quote>/ads</quote>! But 
3826  we did not want this at all! Now we see why we get the blank page. We could
3827  now add a new action below this that explictly does <emphasis>not</emphasis>
3828  block (-block) pages with <quote>adsl</quote>. There are various ways to
3829  handle such exceptions. Example:
3830 </para>
3831
3832 <para>
3833  <screen>
3834
3835  { -block }
3836   /adsl
3837  
3838  </screen>
3839 </para>
3840
3841 <para>
3842  Now the page displays ;-) Be sure to flush your browser's caches when 
3843  making such changes. Or, try using <literal>Shift+Reload</literal>.
3844
3845 </para>
3846
3847 <para>
3848  But now what about a situation where we get no explicit matches like 
3849  we did with:
3850
3851 </para>
3852
3853 <para>
3854  <screen>
3855
3856  { -block }
3857   /adsl
3858  
3859  </screen>
3860 </para>
3861
3862 <para>
3863  That actually was very telling and pointed us quickly to where the problem
3864  was. If you don't get this kind of match, then it means one of the default 
3865  rules in the first section is causing the problem. This would require some 
3866  guesswork, and maybe a little trial and error to isolate the offending rule.
3867  One likely cause would be one of the <quote>{+filter}</quote> actions. Try 
3868  adding the URL for the site to one of aliases that turn off <quote>+filter</quote>:
3869 </para>
3870
3871 <para>
3872  <screen>
3873
3874  {shop}
3875  .quietpc.com
3876  .worldpay.com   # for quietpc.com
3877  .jungle.com
3878  .scan.co.uk
3879  .forbes.com
3880  
3881  </screen>
3882 </para>
3883
3884 <para>
3885  <quote>{shop}</quote> is an <quote>alias</quote> that expands to 
3886  <quote>{ -filter -no-cookies -no-cookies-keep }</quote>. Or you could do 
3887  your own exception to negate filtering:
3888
3889 </para>
3890
3891 <para>
3892  <screen>
3893
3894  {-filter}
3895  .forbes.com
3896  
3897  </screen>
3898 </para>
3899
3900 <para>
3901  <quote>{fragile}</quote> is an alias that disables most actions. This can be 
3902  used as a last resort for problem sites. Remember to flush caches! If this 
3903  still does not work, you will have to go through the remaining actions one by
3904  one to find which one(s) is causing the problem.
3905 </para>
3906
3907 </sect2>
3908
3909 </sect1>
3910
3911  <!--
3912
3913  This program is free software; you can redistribute it 
3914  and/or modify it under the terms of the GNU General
3915  Public License as published by the Free Software
3916  Foundation; either version 2 of the License, or (at
3917  your option) any later version.
3918
3919  This program is distributed in the hope that it will
3920  be useful, but WITHOUT ANY WARRANTY; without even the
3921  implied warranty of MERCHANTABILITY or FITNESS FOR A
3922  PARTICULAR PURPOSE.  See the GNU General Public
3923  License for more details.
3924
3925  The GNU General Public License should be included with
3926  this file.  If not, you can view it at
3927  http://www.gnu.org/copyleft/gpl.html
3928  or write to the Free Software Foundation, Inc., 59
3929  Temple Place - Suite 330, Boston, MA  02111-1307, USA.
3930
3931  $Log: user-manual.sgml,v $
3932  Revision 1.66  2002/04/04 06:48:37  hal9
3933  Structural changes to allow for conditional inclusion/exclusion of content
3934  based on entity toggles, e.g. 'entity % p-not-stable  "INCLUDE"'. And
3935  definition of internal entities, e.g. 'entity p-version "2.9.13"' that will
3936  eventually be set by Makefile.
3937  More boilerplate text for use across multiple docs.
3938
3939  Revision 1.65  2002/04/03 19:52:07  swa
3940  enhance squid section due to user suggestion
3941
3942  Revision 1.64  2002/04/03 03:53:43  hal9
3943  A few minor bug fixes, and touch ups. Ready for review.
3944
3945  Revision 1.63  2002/04/01 16:24:49  hal9
3946  Define entities to include boilerplate text. See doc/source/*.
3947
3948  Revision 1.62  2002/03/30 04:15:53  hal9
3949  - Fix privoxy.org/config links.
3950  - Paste in Bookmarklets from Toggle page.
3951  - Move Quickstart nearer top, and minor rework.
3952
3953  Revision 1.61  2002/03/29 01:31:08  hal9
3954  Minor update.
3955
3956  Revision 1.60  2002/03/27 01:57:34  hal9
3957  Added more to Anatomy section.
3958
3959  Revision 1.59  2002/03/27 00:54:33  hal9
3960  Touch up intro for new name.
3961
3962  Revision 1.58  2002/03/26 22:29:55  swa
3963  we have a new homepage!
3964
3965  Revision 1.57  2002/03/24 20:33:30  hal9
3966  A few minor catch ups with name change.
3967
3968  Revision 1.56  2002/03/24 16:17:06  swa
3969  configure needs to be generated.
3970
3971  Revision 1.55  2002/03/24 16:08:08  swa
3972  we are too lazy to make a block-built
3973  privoxy logo. hence removed the option.
3974
3975  Revision 1.54  2002/03/24 15:46:20  swa
3976  name change related issue.
3977
3978  Revision 1.53  2002/03/24 11:51:00  swa
3979  name change. changed filenames.
3980
3981  Revision 1.52  2002/03/24 11:01:06  swa
3982  name change
3983
3984  Revision 1.51  2002/03/23 15:13:11  swa
3985  renamed every reference to the old name with foobar.
3986  fixed "application foobar application" tag, fixed
3987  "the foobar" with "foobar". left junkbustser in cvs
3988  comments and remarks to history untouched.
3989
3990  Revision 1.50  2002/03/23 05:06:21  hal9
3991  Touch up.
3992
3993  Revision 1.49  2002/03/21 17:01:05  hal9
3994  New section in Appendix.
3995
3996  Revision 1.48  2002/03/12 06:33:01  hal9
3997  Catching up to Andreas and re_filterfile changes.
3998
3999  Revision 1.47  2002/03/11 13:13:27  swa
4000  correct feedback channels
4001
4002  Revision 1.46  2002/03/10 00:51:08  hal9
4003  Added section on JB internal pages in Appendix.
4004
4005  Revision 1.45  2002/03/09 17:43:53  swa
4006  more distros
4007
4008  Revision 1.44  2002/03/09 17:08:48  hal9
4009  New section on Jon's actions file editor, and move some stuff around.
4010
4011  Revision 1.43  2002/03/08 00:47:32  hal9
4012  Added imageblock{pattern}.
4013
4014  Revision 1.42  2002/03/07 18:16:55  swa
4015  looks better
4016
4017  Revision 1.41  2002/03/07 16:46:43  hal9
4018  Fix a few markup problems for jade.
4019
4020  Revision 1.40  2002/03/07 16:28:39  swa
4021  provide correct feedback channels
4022
4023  Revision 1.39  2002/03/06 16:19:28  hal9
4024  Note on perceived filtering slowdown per FR.
4025
4026  Revision 1.38  2002/03/05 23:55:14  hal9
4027  Stupid I did it again. Double hyphen in comment breaks jade.
4028
4029  Revision 1.37  2002/03/05 23:53:49  hal9
4030  jade barfs on '- -' embedded in comments. - -user option broke it.
4031
4032  Revision 1.36  2002/03/05 22:53:28  hal9
4033  Add new - - user option.
4034
4035  Revision 1.35  2002/03/05 00:17:27  hal9
4036  Added section on command line options.
4037
4038  Revision 1.34  2002/03/04 19:32:07  oes
4039  Changed default port to 8118
4040
4041  Revision 1.33  2002/03/03 19:46:13  hal9
4042  Emphasis on where/how to report bugs, etc
4043
4044  Revision 1.32  2002/03/03 09:26:06  joergs
4045  AmigaOS changes, config is now loaded from PROGDIR: instead of
4046  AmiTCP:db/junkbuster/ if no configuration file is specified on the
4047  command line.
4048
4049  Revision 1.31  2002/03/02 22:45:52  david__schmidt
4050  Just tweaking
4051
4052  Revision 1.30  2002/03/02 22:00:14  hal9
4053  Updated 'New Features' list. Ran through spell-checker.
4054
4055  Revision 1.29  2002/03/02 20:34:07  david__schmidt
4056  Update OS/2 build section
4057
4058  Revision 1.28  2002/02/24 14:34:24  jongfoster
4059  Formatting changes.  Now changing the doctype to DocBook XML 4.1
4060  will work - no other changes are needed.
4061
4062  Revision 1.27  2002/01/11 14:14:32  hal9
4063  Added a very short section on Templates
4064
4065  Revision 1.26  2002/01/09 20:02:50  hal9
4066  Fix bug re: auto-detect config file changes.
4067
4068  Revision 1.25  2002/01/09 18:20:30  hal9
4069  Touch ups for *.action files.
4070
4071  Revision 1.24  2001/12/02 01:13:42  hal9
4072  Fix typo.
4073
4074  Revision 1.23  2001/12/02 00:20:41  hal9
4075  Updates for recent changes.
4076
4077  Revision 1.22  2001/11/05 23:57:51  hal9
4078  Minor update for startup now daemon mode.
4079
4080  Revision 1.21  2001/10/31 21:11:03  hal9
4081  Correct 2 minor errors
4082
4083  Revision 1.18  2001/10/24 18:45:26  hal9
4084  *** empty log message ***
4085
4086  Revision 1.17  2001/10/24 17:10:55  hal9
4087  Catching up with Jon's recent work, and a few other things.
4088
4089  Revision 1.16  2001/10/21 17:19:21  swa
4090  wrong url in documentation
4091
4092  Revision 1.15  2001/10/14 23:46:24  hal9
4093  Various minor changes. Fleshed out SEE ALSO section.
4094
4095  Revision 1.13  2001/10/10 17:28:33  hal9
4096  Very minor changes.
4097
4098  Revision 1.12  2001/09/28 02:57:04  hal9
4099  Ditto :/
4100
4101  Revision 1.11  2001/09/28 02:25:20  hal9
4102  Ditto.
4103
4104  Revision 1.9  2001/09/27 23:50:29  hal9
4105  A few changes. A short section on regular expression in appendix.
4106
4107  Revision 1.8  2001/09/25 00:34:59  hal9
4108  Some additions, and re-arranging.
4109
4110  Revision 1.7  2001/09/24 14:31:36  hal9
4111  Diddling.
4112
4113  Revision 1.6  2001/09/24 14:10:32  hal9
4114  Including David's OS/2 installation instructions.
4115
4116  Revision 1.2  2001/09/13 15:27:40  swa
4117  cosmetics
4118
4119  Revision 1.1  2001/09/12 15:36:41  swa
4120  source files for junkbuster documentation
4121
4122  Revision 1.3  2001/09/10 17:43:59  swa
4123  first proposal of a structure.
4124
4125  Revision 1.2  2001/06/13 14:28:31  swa
4126  docs should have an author.
4127
4128  Revision 1.1  2001/06/13 14:20:37  swa
4129  first import of project's documentation for the webserver.
4130
4131  -->
4132
4133 </article>