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