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