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