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