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