Move the user-manual config directive to top of section. Add note about
[privoxy.git] / doc / text / user-manual.txt
1 Privoxy User Manual
2
3 By: Privoxy Developers
4
5 $Id: user-manual.sgml,v 1.100 2002/04/29 03:05:55 hal9 Exp $
6
7 The user manual gives users information on how to install, configure and use 
8 Privoxy.
9
10 Privoxy is a web proxy with advanced filtering capabilities for protecting
11 privacy, filtering web page content, managing cookies, controlling access, and
12 removing ads, banners, pop-ups and other obnoxious Internet junk. Privoxy has a
13 very flexible configuration and can be customized to suit individual needs and
14 tastes. Privoxy has application for both stand-alone systems and multi-user
15 networks.
16
17 Privoxy is based on Internet Junkbuster (tm).
18
19 You can find the latest version of the user manual at http://www.privoxy.org/
20 user-manual/. Please see the Contact section on how to contact the developers.
21
22 -------------------------------------------------------------------------------
23
24 Table of Contents
25  
26 1. Introduction
27    
28     1.1. Features
29    
30 3. Installation
31    
32     3.1. Red Hat and SuSE RPMs
33     3.2. Debian
34     3.3. Windows
35     3.4. Solaris, NetBSD, FreeBSD, HP-UX
36     3.5. OS/2
37     3.6. Max OSX
38     3.7. AmigaOS
39    
40 4. Note to Upgraders
41 5. Quickstart to Using Privoxy
42 6. Starting Privoxy
43    
44     6.1. RedHat and Debian
45     6.2. SuSE
46     6.3. Windows
47     6.4. Solaris, NetBSD, FreeBSD, HP-UX and others
48     6.5. OS/2
49     6.6. MAX OSX
50     6.7. AmigaOS
51     6.8. Command Line Options
52    
53 7. Privoxy Configuration
54    
55     7.1. Controlling Privoxy with Your Web Browser
56     7.2. Configuration Files Overview
57    
58 8. The Main Configuration File
59    
60     8.1. Configuration and Log File Locations
61        
62         8.1.1. user-manual
63         8.1.2. confdir
64         8.1.3. logdir
65         8.1.4. actionsfile
66         8.1.5. filterfile
67         8.1.6. logfile
68         8.1.7. jarfile
69         8.1.8. trustfile
70        
71     8.2. Local Set-up Documentation
72        
73         8.2.1. trust-info-url
74         8.2.2. admin-address
75         8.2.3. proxy-info-url
76        
77     8.3. Debugging
78        
79         8.3.1. debug
80         8.3.2. single-threaded
81        
82     8.4. Access Control and Security
83        
84         8.4.1. listen-address
85         8.4.2. toggle
86         8.4.3. enable-remote-toggle
87         8.4.4. enable-edit-actions
88         8.4.5. ACLs: permit-access and deny-access
89         8.4.6. buffer-limit
90        
91     8.5. Forwarding
92        
93         8.5.1. forward
94         8.5.2. forward-socks4 and forward-socks4a
95         8.5.3. Advanced Forwarding Examples
96        
97     8.6. Windows GUI Options
98    
99 9. Actions Files
100    
101     9.1. Finding the Right Mix
102     9.2. How to Edit
103     9.3. How Actions are Applied to URLs
104     9.4. Patterns
105        
106         9.4.1. The Domain Pattern
107         9.4.2. The Path Pattern
108        
109     9.5. Actions
110        
111         9.5.1. +add-header
112         9.5.2. +block
113         9.5.3. +deanimate-gifs
114         9.5.4. +downgrade-http-version
115         9.5.5. +fast-redirects
116         9.5.6. +filter
117         9.5.7. +hide-forwarded-for-headers
118         9.5.8. +hide-from-header
119         9.5.9. +hide-referer
120         9.5.10. +hide-user-agent
121         9.5.11. +handle-as-image
122         9.5.12. +set-image-blocker
123         9.5.13. +limit-connect
124         9.5.14. +prevent-compression
125         9.5.15. +session-cookies-only
126         9.5.16. +prevent-reading-cookies
127         9.5.17. +prevent-setting-cookies
128         9.5.18. +kill-popups
129         9.5.19. +send-vanilla-wafer
130         9.5.20. +send-wafer
131         9.5.21. Summary
132         9.5.22. Sample Actions Files
133        
134     9.6. Aliases
135    
136 10. The Filter File
137    
138     10.1. The +filter Action
139    
140 11. Templates
141 12. Contacting the Developers, Bug Reporting and Feature Requests
142    
143     12.1. Get Support
144     12.2. Report bugs
145     12.3. Request new features
146     12.4. Report ads or other filter problems
147     12.5. Other
148    
149 13. Copyright and History
150    
151     13.1. Copyright
152     13.2. History
153    
154 14. See Also
155 15. Appendix
156    
157     15.1. Regular Expressions
158     15.2. Privoxy's Internal Pages
159        
160         15.2.1. Bookmarklets
161        
162     15.3. Chain of Events
163     15.4. Anatomy of an Action
164    
165 -------------------------------------------------------------------------------
166
167 1. Introduction
168
169 This documentation is included with the current beta version of Privoxy,
170 v.2.9.14, and is mostly complete at this point. The most up to date reference
171 for the time being is still the comments in the source files and in the
172 individual configuration files. Development of version 3.0 is currently nearing
173 completion, and includes many significant changes and enhancements over earlier
174 versions. The target release date for stable v3.0 is "soon" ;-).
175
176 Since this is a beta version, not all new features are well tested. This
177 documentation may be slightly out of sync as a result (especially with CVS
178 sources). And there may be bugs, though hopefully not many!
179
180 -------------------------------------------------------------------------------
181
182 1.1. Features
183
184 In addition to Internet Junkbuster's traditional features of ad and banner
185 blocking and cookie management, Privoxy provides new features, some of them
186 currently under development:
187
188   * FIXME: complete the list of features. change the order: most important
189     features to the top of the list. prefix new features with "NEW".
190    
191   * Integrated browser based configuration and control utility at http://
192     config.privoxy.org/ (shortcut: http://p.p/). Browser-based tracing of rule
193     and filter effects. Remote toggling.
194    
195   * Blocking of annoying pop-up browser windows.
196    
197   * HTTP/1.1 compliant (but not all optional 1.1 features are supported).
198    
199   * Support for Perl Compatible Regular Expressions in the configuration files,
200     and generally a more sophisticated and flexible configuration syntax over
201     previous versions.
202    
203   * GIF de-animation.
204    
205   * Web page content filtering (removes banners based on size, invisible
206     "web-bugs", JavaScript and HTML annoyances, pop-ups, etc.)
207    
208   * Bypass many click-tracking scripts (avoids script redirection).
209    
210   * Multi-threaded (POSIX and native threads).
211    
212   * Auto-detection and re-reading of config file changes.
213    
214   * User-customizable HTML templates (e.g. 404 error page).
215    
216   * Improved cookie management features (e.g. session based cookies).
217    
218   * Improved signal handling, and a true daemon mode (Unix).
219    
220   * Every feature now controllable on a per-site or per-location basis,
221     configuration more powerful and versatile over-all.
222    
223   * Many smaller new features added, limitations and bugs removed, and security
224     holes fixed.
225    
226 -------------------------------------------------------------------------------
227
228 3. Installation
229
230 Privoxy is available both in convenient pre-compiled packages for a wide range
231 of operating systems, and as raw source code. For most users, we recommend
232 using the packages, which can be downloaded from our Privoxy Project Page. For
233 installing and compiling the source code, please look into our Developer
234 Manual.
235
236 If you like to live on the bleeding edge and are not afraid of using possibly
237 unstable development versions, you can check out the up-to-the-minute version
238 directly from the CVS repository or simply download the nightly CVS tarball.
239 Again, we refer you to the Developer Manual.
240
241 At present, Privoxy is known to run on Windows(95, 98, ME, 2000, XP), Linux
242 (RedHat, Suse, Debian), Mac OSX, OS/2, AmigaOS, FreeBSD, NetBSD, BeOS, and many
243 more flavors of Unix.
244
245 Note: If you have a previous Junkbuster or Privoxy installation on your system,
246 you will need to remove it. Some platforms do this for you as part of their
247 installation procedure. (See below for your platform).
248
249 In any case be sure to backup your old configuration if it is valuable to you.
250 See the note to upgraders section below.
251
252 -------------------------------------------------------------------------------
253
254 3.1. Red Hat and SuSE RPMs
255
256 RPMs can be installed with rpm -Uvh privoxy-2.9.14-1.rpm, and will use /etc/
257 privoxy for the location of configuration files.
258
259 Note that on Red Hat, Privoxy will not be automatically started on system boot.
260 You will need to enable that using chkconfig, ntsysv, or similar methods. Note
261 that SuSE will automatically start Privoxy in the boot process.
262
263 If you have problems with failed dependencies, try rebuilding the SRC RPM: rpm
264 --rebuild privoxy-2.9.14-1.src.rpm;. This will use your locally installed
265 libraries and RPM version.
266
267 Also note that if you have a Junkbuster RPM installed on your system, you need
268 to remove it first, because the packages conflict. Otherwise, RPM will try to
269 remove Junkbuster automatically, before installing Privoxy.
270
271 -------------------------------------------------------------------------------
272
273 3.2. Debian
274
275 FIXME.
276
277 -------------------------------------------------------------------------------
278
279 3.3. Windows
280
281 Just double-click the installer, which will guide you through the installation
282 process. You will find the configuration files in the same directory as you
283 installed Privoxy in. We do not use the registry of Windows.
284
285 -------------------------------------------------------------------------------
286
287 3.4. Solaris, NetBSD, FreeBSD, HP-UX
288
289 Create a new directory, cd to it, then unzip and untar the archive. For the
290 most part, you'll have to figure out where things go. FIXME.
291
292 -------------------------------------------------------------------------------
293
294 3.5. OS/2
295
296 First, make sure that no previous installations of Junkbuster and / or Privoxy
297 are left on your system. You can do this by
298
299 Then, just double-click the WarpIN self-installing archive, which will guide
300 you through the installation process. A shadow of the Privoxy executable will
301 be placed in your startup folder so it will start automatically whenever OS/2
302 starts.
303
304 The directory you choose to install Privoxy into will contain all of the
305 configuration files.
306
307 -------------------------------------------------------------------------------
308
309 3.6. Max OSX
310
311 Unzip the downloaded package (you can either double-click on the file in the
312 finder, or on the desktop if you downloaded it there). Then, double-click on
313 the package installer icon and follow the installation process. Privoxy will be
314 installed in the subdirectory /Applications/Privoxy.app. Privoxy will set
315 itself up to start automatically on system bring-up via /System/Library/
316 StartupItems/Privoxy.
317
318 -------------------------------------------------------------------------------
319
320 3.7. AmigaOS
321
322 Copy and then unpack the lha archive to a suitable location. All necessary
323 files will be installed into Privoxy directory, including all configuration and
324 log files. To uninstall, just remove this directory.
325
326 Start Privoxy (with RUN <>NIL:) in your startnet script (AmiTCP), in s:
327 user-startup (RoadShow), as startup program in your startup script (Genesis),
328 or as startup action (Miami and MiamiDx). Privoxy will automatically quit when
329 you quit your TCP/IP stack (just ignore the harmless warning your TCP/IP stack
330 may display that Privoxy is still running).
331
332 -------------------------------------------------------------------------------
333
334 4. Note to Upgraders
335
336 There are very significant changes from older versions of Junkbuster to the
337 current Privoxy. Configuration is substantially changed. Junkbuster 2.0.x and
338 earlier configuration files will not migrate. The functionality of the old
339 blockfile, cookiefile and imagelist, are now combined into the "actions files".
340 default.action, is the main actions file. Local exceptions should best be put
341 into user.action.
342
343 A "filter file" (typically default.filter) is new as of Privoxy 2.9.x, and
344 provides some of the new sophistication (explained below). config is much the
345 same as before.
346
347 If upgrading from a 2.0.x version, you will have to use the new config files,
348 and possibly adapt any personal rules from your older files. When porting
349 personal rules over from the old blockfile to the new actions files, please
350 note that even the pattern syntax has changed. If upgrading from 2.9.x
351 development versions, it is still recommended to use the new configuration
352 files.
353
354 A quick list of things to be aware of before upgrading:
355
356   * The default listening port is now 8118 due to a conflict with another
357     service (NAS).
358    
359   * Some installers may remove earlier versions completely. Save any important
360     configuration files!
361    
362   * Privoxy is controllable with a web browser at the special URL: http://
363     config.privoxy.org/ (Shortcut: http://p.p/). Many aspects of configuration
364     can be done here, including temporarily disabling Privoxy.
365    
366   * The primary configuration file for cookie management, ad and banner
367     blocking, and many other aspects of Privoxy configuration is in the actions
368     files. It is strongly recommended to become familiar with the new actions
369     concept below, before modifying these files. Locally defined rules should
370     go into user.action.
371    
372   * Some installers may not automatically start Privoxy after installation.
373    
374 -------------------------------------------------------------------------------
375
376 5. Quickstart to Using Privoxy
377
378   * Install Privoxy. See the section Installing.
379    
380   * Start Privoxy. See the section Starting Privoxy.
381    
382   * Change your browser's configuration to use the proxy localhost on port
383     8118. See the section Starting Privoxy.
384    
385   * Enjoy surfing with enhanced comfort and privacy. Please see the section 
386     Contacting the Developers on how to report bugs or problems with websites
387     or to get help. You may want to change the file user.action to further
388     tweak your new browsing experience.
389    
390 -------------------------------------------------------------------------------
391
392 6. Starting Privoxy
393
394 Before launching Privoxy for the first time, you will want to configure your
395 browser(s) to use Privoxy as a HTTP and HTTPS proxy. The default is localhost
396 for the proxy address, and port 8118 (earlier versions used port 8000). This is
397 the one configuration step that must be done!
398
399 With Netscape (and Mozilla), this can be set under Edit -> Preferences ->
400 Advanced -> Proxies -> HTTP Proxy. For Internet Explorer: Tools -> Internet
401 Properties -> Connections -> LAN Setting. Then, check "Use Proxy" and fill in
402 the appropriate info (Address: localhost, Port: 8118). Include if HTTPS proxy
403 support too.
404
405 After doing this, flush your browser's disk and memory caches to force a
406 re-reading of all pages and to get rid of any ads that may be cached. You are
407 now ready to start enjoying the benefits of using Privoxy!
408
409 Privoxy is typically started by specifying the main configuration file to be
410 used on the command line. If no configuration file is specified on the command
411 line, Privoxy will look for a file named config in the current directory.
412 Except on Win32 where it will try config.txt.
413
414 -------------------------------------------------------------------------------
415
416 6.1. RedHat and Debian
417
418 We use a script. Note that RedHat does not start Privoxy upon booting per
419 default. It will use the file /etc/privoxy/config as its main configuration
420 file. FIXME: Debian??
421
422  # /etc/rc.d/init.d/privoxy start                                              
423
424 -------------------------------------------------------------------------------
425
426 6.2. SuSE
427
428 We use a script. It will use the file /etc/privoxy/config as its main
429 configuration file. Note that SuSE starts Privoxy upon booting your PC.
430
431  # rcprivoxy start                                                             
432
433 -------------------------------------------------------------------------------
434
435 6.3. Windows
436
437 Click on the Privoxy Icon to start Privoxy. If no configuration file is
438 specified on the command line, Privoxy will look for a file named config.txt.
439 Note that Windows will automatically start Privoxy upon booting you PC.
440
441 -------------------------------------------------------------------------------
442
443 6.4. Solaris, NetBSD, FreeBSD, HP-UX and others
444
445 Example Unix startup command:
446
447  # /usr/sbin/privoxy /etc/privoxy/config                                       
448
449 -------------------------------------------------------------------------------
450
451 6.5. OS/2
452
453 FIXME.
454
455 -------------------------------------------------------------------------------
456
457 6.6. MAX OSX
458
459 FIXME.
460
461 -------------------------------------------------------------------------------
462
463 6.7. AmigaOS
464
465 FIXME.
466
467 -------------------------------------------------------------------------------
468
469 6.8. Command Line Options
470
471 Privoxy may be invoked with the following command-line options:
472
473   * --version
474    
475     Print version info and exit. Unix only.
476    
477   * --help
478    
479     Print short usage info and exit. Unix only.
480    
481   * --no-daemon
482    
483     Don't become a daemon, i.e. don't fork and become process group leader, and
484     don't detach from controlling tty. Unix only.
485    
486   * --pidfile FILE
487    
488     On startup, write the process ID to FILE. Delete the FILE on exit. Failure
489     to create or delete the FILE is non-fatal. If no FILE option is given, no
490     PID file will be used. Unix only.
491    
492   * --user USER[.GROUP]
493    
494     After (optionally) writing the PID file, assume the user ID of USER, and if
495     included the GID of GROUP. Exit if the privileges are not sufficient to do
496     so. Unix only.
497    
498   * configfile
499    
500     If no configfile is included on the command line, Privoxy will look for a
501     file named "config" in the current directory (except on Win32 where it will
502     look for "config.txt" instead). Specify full path to avoid confusion. If no
503     config file is found, Privoxy will fail to start.
504    
505 -------------------------------------------------------------------------------
506
507 7. Privoxy Configuration
508
509 All Privoxy configuration is stored in text files. These files can be edited
510 with a text editor. Many important aspects of Privoxy can also be controlled
511 easily with a web browser.
512
513 -------------------------------------------------------------------------------
514
515 7.1. Controlling Privoxy with Your Web Browser
516
517 Privoxy's user interface can be reached through the special URL http://
518 config.privoxy.org/ (shortcut: http://p.p/), which is a built-in page and works
519 without Internet access. You will see the following section: 
520
521  Privoxy Menu                                                                  
522         ?  View & change the current configuration                             
523         ?  View the source code version numbers                                
524         ?  View the request headers.                                           
525         ?  Look up which actions apply to a URL and why                        
526         ?  Toggle Privoxy on or off                                            
527                                                                                
528
529 This should be self-explanatory. Note the first item leads to an editor for the
530 "actions list", which is where the ad, banner, cookie, and URL blocking magic
531 is configured as well as other advanced features of Privoxy. This is an easy
532 way to adjust various aspects of Privoxy configuration. The actions file, and
533 other configuration files, are explained in detail below.
534
535 "Toggle Privoxy On or Off" is handy for sites that might have problems with
536 your current actions and filters. You can in fact use it as a test to see
537 whether it is Privoxy causing the problem or not. Privoxy continues to run as a
538 proxy in this case, but all filtering is disabled. There is even a toggle 
539 Bookmarklet offered, so that you can toggle Privoxy with one click from your
540 browser.
541
542 -------------------------------------------------------------------------------
543
544 7.2. Configuration Files Overview
545
546 For Unix, *BSD and Linux, all configuration files are located in /etc/privoxy/
547 by default. For MS Windows, OS/2, and AmigaOS these are all in the same
548 directory as the Privoxy executable. The name and number of configuration files
549 has changed from previous versions, and is subject to change as development
550 progresses.
551
552 The installed defaults provide a reasonable starting point, though some
553 settings may be aggressive by some standards. For the time being, the principle
554 configuration files are:
555
556   * The main configuration file is named config on Linux, Unix, BSD, OS/2, and
557     AmigaOS and config.txt on Windows. This is a required file.
558    
559   * default.action (the main actions file) is used to define the default
560     settings for various "actions" relating to images, banners, pop-ups, access
561     restrictions, banners and cookies.
562    
563     Multiple actions files may be defined in config. These are processed in the
564     order they are defined. Local customizations and locally preferred
565     exceptions to the default policies as defined in default.action are
566     probably best applied in user.action, which should be preserved across
567     upgrades. standard.action is also included. This is mostly for Privoxy's
568     internal use.
569    
570     There is also a web based editor that can be accessed from http://
571     config.privoxy.org/show-status/ (Shortcut: http://p.p/show-status/) for the
572     various actions files.
573    
574   * default.filter (the filter file) can be used to re-write the raw page
575     content, including viewable text as well as embedded HTML and JavaScript,
576     and whatever else lurks on any given web page. The filtering jobs are only
577     pre-defined here; whether to apply them or not is up to the actions files.
578    
579 All files use the "#" character to denote a comment (the rest of the line will
580 be ignored) angd understand line continuation through placing a backslash ("\")
581 as the very last character in a line. If the # is preceded by a backslash, it
582 looses its special function. Placing a # in front of an otherwise valid
583 configuration line to prevent it from being interpreted is called "commenting
584 out" that line.
585
586 The actions files and default.filter can use Perl style regular expressions for
587 maximum flexibility.
588
589 After making any changes, there is no need to restart Privoxy in order for the
590 changes to take effect. Privoxy detects such changes automatically. Note,
591 however, that it may take one or two additional requests for the change to take
592 effect. When changing the listening address of Privoxy, these "wake up"
593 requests must obviously be sent to the old listening address.
594
595 While under development, the configuration content is subject to change. The
596 below documentation may not be accurate by the time you read this. Also, what
597 constitutes a "default" setting, may change, so please check all your
598 configuration files on important issues.
599
600 -------------------------------------------------------------------------------
601
602 8. The Main Configuration File
603
604 Again, the main configuration file is named config on Linux/Unix/BSD and OS/2,
605 and config.txt on Windows. Configuration lines consist of an initial keyword
606 followed by a list of values, all separated by whitespace (any number of spaces
607 or tabs). For example:
608
609   confdir /etc/privoxy
610    
611
612 Assigns the value /etc/privoxy to the option confdir and thus indicates that
613 the configuration directory is named "/etc/privoxy/".
614
615 All options in the config file except for confdir and logdir are optional.
616 Watch out in the below description for what happens if you leave them unset.
617
618 The main config file controls all aspects of Privoxy's operation that are not
619 location dependent (i.e. they apply universally, no matter where you may be
620 surfing).
621
622 -------------------------------------------------------------------------------
623
624 8.1. Configuration and Log File Locations
625
626 Privoxy can (and normally does) use a number of other files for additional
627 configuration, help and logging. This section of the configuration file tells
628 Privoxy where to find those other files.
629
630 The user running Privoxy, must have read permission for all configuration
631 files, and write permission to any files that would be modified, such as log
632 files.
633
634 -------------------------------------------------------------------------------
635
636 8.1.1. user-manual
637
638 Specifies:
639    
640     Location of the Privoxy User Manual.
641    
642 Type of value:
643    
644     A fully qualified URI
645    
646 Default value:
647    
648     http://www.privoxy.org/user-manual/
649    
650 Effect if unset:
651    
652     The default will be used.
653    
654 Notes:
655    
656     The User Manual is used for help hints from some of the internal CGI pages.
657     It is normally packaged with the binary distributions, and would make more
658     sense to have this pointed at a locally installed copy.
659    
660     A more useful example (Unix):
661    
662       user-manual  file:///usr/share/doc/privoxy-2.9.14/user-manual/
663    
664     +-----------------------------------------------------------------+
665     |                             Warning                             |
666     |-----------------------------------------------------------------|
667     |If this option is defined, it must come first! It is needed      |
668     |before the rest of config is read.                               |
669     +-----------------------------------------------------------------+
670
671 -------------------------------------------------------------------------------
672
673 8.1.2. confdir
674
675 Specifies:
676    
677     The directory where the other configuration files are located
678    
679 Type of value:
680    
681     Path name
682    
683 Default value:
684    
685     /etc/privoxy (Unix) or Privoxy installation dir (Windows)
686    
687 Effect if unset:
688    
689     Mandatory
690    
691 Notes:
692    
693     No trailing "/", please
694    
695     When development goes modular and multi-user, the blocker, filter, and
696     per-user config will be stored in subdirectories of "confdir". For now, the
697     configuration directory structure is flat, except for confdir/templates,
698     where the HTML templates for CGI output reside (e.g. Privoxy's 404 error
699     page).
700    
701 -------------------------------------------------------------------------------
702
703 8.1.3. logdir
704
705 Specifies:
706    
707     The directory where all logging takes place (i.e. where logfile and jarfile
708     are located)
709    
710 Type of value:
711    
712     Path name
713    
714 Default value:
715    
716     /var/log/privoxy (Unix) or Privoxy installation dir (Windows)
717    
718 Effect if unset:
719    
720     Mandatory
721    
722 Notes:
723    
724     No trailing "/", please
725    
726 -------------------------------------------------------------------------------
727
728 8.1.4. actionsfile
729
730 Specifies:
731    
732     The actions file(s) to use
733    
734 Type of value:
735    
736     File name, relative to confdir
737    
738 Default value:
739    
740       standard     # Internal purposes, recommended not editing
741                                                                
742       default      # Main actions file                         
743                                                                
744       user         # User customizations                       
745    
746 Effect if unset:
747    
748     No actions are taken at all. Simple neutral proxying.
749    
750 Notes:
751    
752     Multiple actionsfile lines are permitted, and are in fact recommended!
753    
754     The default values include standard.action, which is used for internal
755     purposes and should be loaded, default.action, which is the "main" actions
756     file maintained by the developers, and user.action, where you can make your
757     personal additions.
758    
759     Actions files are where all the per site and per URL configuration is done
760     for ad blocking, cookie management, privacy considerations, etc. There is
761     no point in using Privoxy without at least one actions file.
762    
763 -------------------------------------------------------------------------------
764
765 8.1.5. filterfile
766
767 Specifies:
768    
769     The filter file to use
770    
771 Type of value:
772    
773     File name, relative to confdir
774    
775 Default value:
776    
777     default.filter (Unix) or default.filter.txt (Windows)
778    
779 Effect if unset:
780    
781     No textual content filtering takes place, i.e. all +filter{name} actions in
782     the actions files are turned off
783    
784 Notes:
785    
786     The "default.filter" file contains content modification rules that use
787     "regular expressions". These rules permit powerful changes on the content
788     of Web pages, e.g., you could disable your favorite JavaScript annoyances,
789     re-write the actual displayed text, or just have some fun replacing
790     "Microsoft" with "MicroSuck" wherever it appears on a Web page.
791    
792 -------------------------------------------------------------------------------
793
794 8.1.6. logfile
795
796 Specifies:
797    
798     The log file to use
799    
800 Type of value:
801    
802     File name, relative to logdir
803    
804 Default value:
805    
806     logfile (Unix) or privoxy.log (Windows)
807    
808 Effect if unset:
809    
810     No log file is used, all log messages go to the console (stderr).
811    
812 Notes:
813    
814     The windows version will additionally log to the console.
815    
816     The logfile is where all logging and error messages are written. The level
817     of detail and number of messages are set with the debug option (see below).
818     The logfile can be useful for tracking down a problem with Privoxy (e.g.,
819     it's not blocking an ad you think it should block) but in most cases you
820     probably will never look at it.
821    
822     Your logfile will grow indefinitely, and you will probably want to
823     periodically remove it. On Unix systems, you can do this with a cron job
824     (see "man cron"). For Red Hat, a logrotate script has been included.
825    
826     On SuSE Linux systems, you can place a line like "/var/log/privoxy.* +1024k
827     644 nobody.nogroup" in /etc/logfiles, with the effect that cron.daily will
828     automatically archive, gzip, and empty the log, when it exceeds 1M size.
829    
830     Any log files must be writable by whatever user Privoxy is being run as
831     (default on UNIX, user id is "privoxy").
832    
833 -------------------------------------------------------------------------------
834
835 8.1.7. jarfile
836
837 Specifies:
838    
839     The file to store intercepted cookies in
840    
841 Type of value:
842    
843     File name, relative to logdir
844    
845 Default value:
846    
847     jarfile (Unix) or privoxy.jar (Windows)
848    
849 Effect if unset:
850    
851     Intercepted cookies are not stored at all.
852    
853 Notes:
854    
855     The jarfile may grow to ridiculous sizes over time.
856    
857 -------------------------------------------------------------------------------
858
859 8.1.8. trustfile
860
861 Specifies:
862    
863     The trust file to use
864    
865 Type of value:
866    
867     File name, relative to confdir
868    
869 Default value:
870    
871     Unset (commented out). When activated: trust (Unix) or trust.txt (Windows)
872    
873 Effect if unset:
874    
875     The whole trust mechanism is turned off.
876    
877 Notes:
878    
879     The trust mechanism is an experimental feature for building white-lists and
880     should be used with care. It is NOT recommended for the casual user.
881    
882     If you specify a trust file, Privoxy will only allow access to sites that
883     are named in the trustfile. You can also mark sites as trusted referrers
884     (with +), with the effect that access to untrusted sites will be granted,
885     if a link from a trusted referrer was used. The link target will then be
886     added to the "trustfile". Possible applications include limiting Internet
887     access for children.
888    
889     If you use + operator in the trust file, it may grow considerably over
890     time.
891    
892 -------------------------------------------------------------------------------
893
894 8.2. Local Set-up Documentation
895
896 If you intend to operate Privoxy for more users that just yourself, it might be
897 a good idea to let them know how to reach you, what you block and why you do
898 that, your policies etc.
899
900 -------------------------------------------------------------------------------
901
902 8.2.1. trust-info-url
903
904 Specifies:
905    
906     A URL to be displayed in the error page that users will see if access to an
907     untrusted page is denied.
908    
909 Type of value:
910    
911     URL
912    
913 Default value:
914    
915     Two example URL are provided
916    
917 Effect if unset:
918    
919     No links are displayed on the "untrusted" error page.
920    
921 Notes:
922    
923     The value of this option only matters if the experimental trust mechanism
924     has been activated. (See trustfile above.)
925    
926     If you use the trust mechanism, it is a good idea to write up some on-line
927     documentation about your trust policy and to specify the URL(s) here. Use
928     multiple times for multiple URLs.
929    
930     The URL(s) should be added to the trustfile as well, so users don't end up
931     locked out from the information on why they were locked out in the first
932     place!
933    
934 -------------------------------------------------------------------------------
935
936 8.2.2. admin-address
937
938 Specifies:
939    
940     An email address to reach the proxy administrator.
941    
942 Type of value:
943    
944     Email address
945    
946 Default value:
947    
948     Unset
949    
950 Effect if unset:
951    
952     No email address is displayed on error pages and the CGI user interface.
953    
954 Notes:
955    
956     If both admin-address and proxy-info-url are unset, the whole "Local
957     Privoxy Support" box on all generated pages will not be shown.
958    
959 -------------------------------------------------------------------------------
960
961 8.2.3. proxy-info-url
962
963 Specifies:
964    
965     A URL to documentation about the local Privoxy setup, configuration or
966     policies.
967    
968 Type of value:
969    
970     URL
971    
972 Default value:
973    
974     Unset
975    
976 Effect if unset:
977    
978     No link to local documentation is displayed on error pages and the CGI user
979     interface.
980    
981 Notes:
982    
983     If both admin-address and proxy-info-url are unset, the whole "Local
984     Privoxy Support" box on all generated pages will not be shown.
985    
986     This URL shouldn't be blocked ;-)
987    
988 -------------------------------------------------------------------------------
989
990 8.3. Debugging
991
992 These options are mainly useful when tracing a problem. Note that you might
993 also want to invoke Privoxy with the --no-daemon command line option when
994 debugging.
995
996 -------------------------------------------------------------------------------
997
998 8.3.1. debug
999
1000 Specifies:
1001    
1002     Key values that determine what information gets logged.
1003    
1004 Type of value:
1005    
1006     Integer values
1007    
1008 Default value:
1009    
1010     12289 (i.e.: URLs plus informational and warning messages)
1011    
1012 Effect if unset:
1013    
1014     Nothing gets logged.
1015    
1016 Notes:
1017    
1018     The available debug levels are:
1019    
1020       debug         1 # show each GET/POST/CONNECT request             
1021       debug         2 # show each connection status                    
1022       debug         4 # show I/O status                                
1023       debug         8 # show header parsing                            
1024       debug        16 # log all data into the logfile                  
1025       debug        32 # debug force feature                            
1026       debug        64 # debug regular expression filter                
1027       debug       128 # debug fast redirects                           
1028       debug       256 # debug GIF de-animation                         
1029       debug       512 # Common Log Format                              
1030       debug      1024 # debug kill pop-ups                             
1031       debug      4096 # Startup banner and warnings.                   
1032       debug      8192 # Non-fatal errors                               
1033    
1034     To select multiple debug levels, you can either add them or use multiple
1035     debug lines.
1036    
1037     A debug level of 1 is informative because it will show you each request as
1038     it happens. 1, 4096 and 8192 are highly recommended so that you will notice
1039     when things go wrong. The other levels are probably only of interest if you
1040     are hunting down a specific problem. They can produce a hell of an output
1041     (especially 16).
1042    
1043     The reporting of fatal errors (i.e. ones which crash Privoxy) is always on
1044     and cannot be disabled.
1045    
1046     If you want to use CLF (Common Log Format), you should set "debug 512" ONLY
1047     and not enable anything else.
1048    
1049 -------------------------------------------------------------------------------
1050
1051 8.3.2. single-threaded
1052
1053 Specifies:
1054    
1055     Whether to run only one server thread
1056    
1057 Type of value:
1058    
1059     None
1060    
1061 Default value:
1062    
1063     Unset
1064    
1065 Effect if unset:
1066    
1067     Multi-threaded (or, where unavailable: forked) operation, i.e. the ability
1068     to serve multiple requests simultaneously.
1069    
1070 Notes:
1071    
1072     This option is only there for debug purposes and you should never need to
1073     use it. It will drastically reduce performance.
1074    
1075 -------------------------------------------------------------------------------
1076
1077 8.4. Access Control and Security
1078
1079 This section of the config file controls the security-relevant aspects of
1080 Privoxy's configuration.
1081
1082 -------------------------------------------------------------------------------
1083
1084 8.4.1. listen-address
1085
1086 Specifies:
1087    
1088     The IP address and TCP port on which Privoxy will listen for client
1089     requests.
1090    
1091 Type of value:
1092    
1093     [IP-Address]:Port
1094    
1095 Default value:
1096    
1097     localhost:8118
1098    
1099 Effect if unset:
1100    
1101     Bind to localhost (127.0.0.1), port 8118. This is suitable and recommended
1102     for home users who run Privoxy on the same machine as their browser.
1103    
1104 Notes:
1105    
1106     You will need to configure your browser(s) to this proxy address and port.
1107    
1108     If you already have another service running on port 8118, or if you want to
1109     serve requests from other machines (e.g. on your local network) as well,
1110     you will need to override the default.
1111    
1112     If you leave out the IP address, Privoxy will bind to all interfaces
1113     (addresses) on your machine and may become reachable from the Internet. In
1114     that case, consider using access control lists (ACL's) (see "ACLs" below),
1115     or a firewall.
1116    
1117 Example:
1118    
1119     Suppose you are running Privoxy on a machine which has the address
1120     192.168.0.1 on your local private network (192.168.0.0) and has another
1121     outside connection with a different address. You want it to serve requests
1122     from inside only:
1123    
1124       listen-address  192.168.0.1:8118                                 
1125    
1126 -------------------------------------------------------------------------------
1127
1128 8.4.2. toggle
1129
1130 Specifies:
1131    
1132     Initial state of "toggle" status
1133    
1134 Type of value:
1135    
1136     1 or 0
1137    
1138 Default value:
1139    
1140     1
1141    
1142 Effect if unset:
1143    
1144     Act as if toggled on
1145    
1146 Notes:
1147    
1148     If set to 0, Privoxy will start in "toggled off" mode, i.e. behave like a
1149     normal, content-neutral proxy. See enable-remote-toggle below. This is not
1150     really useful anymore, since toggling is much easier via the web interface
1151     than via editing the conf file.
1152    
1153     The windows version will only display the toggle icon in the system tray if
1154     this option is present.
1155    
1156 -------------------------------------------------------------------------------
1157
1158 8.4.3. enable-remote-toggle
1159
1160 Specifies:
1161    
1162     Whether or not the web-based toggle feature may be used
1163    
1164 Type of value:
1165    
1166     0 or 1
1167    
1168 Default value:
1169    
1170     1
1171    
1172 Effect if unset:
1173    
1174     The web-based toggle feature is disabled.
1175    
1176 Notes:
1177    
1178     When toggled off, Privoxy acts like a normal, content-neutral proxy, i.e.
1179     it acts as if none of the actions applied to any URL.
1180    
1181     For the time being, access to the toggle feature can not be controlled
1182     separately by "ACLs" or HTTP authentication, so that everybody who can
1183     access Privoxy (see "ACLs" and listen-address above) can toggle it for all
1184     users. So this option is not recommended for multi-user environments with
1185     untrusted users.
1186    
1187     Note that you must have compiled Privoxy with support for this feature,
1188     otherwise this option has no effect.
1189    
1190 -------------------------------------------------------------------------------
1191
1192 8.4.4. enable-edit-actions
1193
1194 Specifies:
1195    
1196     Whether or not the web-based actions file editor may be used
1197    
1198 Type of value:
1199    
1200     0 or 1
1201    
1202 Default value:
1203    
1204     1
1205    
1206 Effect if unset:
1207    
1208     The web-based actions file editor is disabled.
1209    
1210 Notes:
1211    
1212     For the time being, access to the editor can not be controlled separately
1213     by "ACLs" or HTTP authentication, so that everybody who can access Privoxy
1214     (see "ACLs" and listen-address above) can modify its configuration for all
1215     users. So this option is not recommended for multi-user environments with
1216     untrusted users.
1217    
1218     Note that you must have compiled Privoxy with support for this feature,
1219     otherwise this option has no effect.
1220    
1221 -------------------------------------------------------------------------------
1222
1223 8.4.5. ACLs: permit-access and deny-access
1224
1225 Specifies:
1226    
1227     Who can access what.
1228    
1229 Type of value:
1230    
1231     src_addr[/src_masklen] [dst_addr[/dst_masklen]]
1232    
1233     Where src_addr and dst_addr are IP addresses in dotted decimal notation or
1234     valid DNS names, and src_masklen and dst_masklen are subnet masks in CIDR
1235     notation, i.e. integer values from 2 to 30 representing the length (in
1236     bits) of the network address. The masks and the whole destination part are
1237     optional.
1238    
1239 Default value:
1240    
1241     Unset
1242    
1243 Effect if unset:
1244    
1245     Don't restrict access further than implied by listen-address
1246    
1247 Notes:
1248    
1249     Access controls are included at the request of ISPs and systems
1250     administrators, and are not usually needed by individual users. For a
1251     typical home user, it will normally suffice to ensure that Privoxy only
1252     listens on the localhost or internal (home) network address by means of the
1253     listen-address option.
1254    
1255     Please see the warnings in the FAQ that this proxy is not intended to be a
1256     substitute for a firewall or to encourage anyone to defer addressing basic
1257     security weaknesses.
1258    
1259     Multiple ACL lines are OK. If any ACLs are specified, then the Privoxy
1260     talks only to IP addresses that match at least one permit-access line and
1261     don't match any subsequent deny-access line. In other words, the last match
1262     wins, with the default being deny-access.
1263    
1264     If Privoxy is using a forwarder (see forward below) for a particular
1265     destination URL, the dst_addr that is examined is the address of the
1266     forwarder and NOT the address of the ultimate target. This is necessary
1267     because it may be impossible for the local Privoxy to determine the IP
1268     address of the ultimate target (that's often what gateways are used for).
1269    
1270     You should prefer using IP addresses over DNS names, because the address
1271     lookups take time. All DNS names must resolve! You can not use domain
1272     patterns like "*.org" or partial domain names. If a DNS name resolves to
1273     multiple IP addresses, only the first one is used.
1274    
1275     Denying access to particular sites by ACL may have undesired side effects
1276     if the site in question is hosted on a machine which also hosts other
1277     sites.
1278    
1279 Examples:
1280    
1281     Explicitly define the default behavior if no ACL and listen-address are
1282     set: "localhost" is OK. The absence of a dst_addr implies that all
1283     destination addresses are OK:
1284    
1285       permit-access  localhost                                         
1286    
1287     Allow any host on the same class C subnet as www.privoxy.org access to
1288     nothing but www.example.com:
1289    
1290       permit-access  www.privoxy.org/24 www.example.com/32             
1291    
1292     Allow access from any host on the 26-bit subnet 192.168.45.64 to anywhere,
1293     with the exception that 192.168.45.73 may not access
1294     www.dirty-stuff.example.com:
1295    
1296       permit-access  192.168.45.64/26                                  
1297       deny-access    192.168.45.73    www.dirty-stuff.example.com      
1298    
1299 -------------------------------------------------------------------------------
1300
1301 8.4.6. buffer-limit
1302
1303 Specifies:
1304    
1305     Maximum size of the buffer for content filtering.
1306    
1307 Type of value:
1308    
1309     Size in Kbytes
1310    
1311 Default value:
1312    
1313     4096
1314    
1315 Effect if unset:
1316    
1317     Use a 4MB (4096 KB) limit.
1318    
1319 Notes:
1320    
1321     For content filtering, i.e. the +filter and +deanimate-gif actions, it is
1322     necessary that Privoxy buffers the entire document body. This can be
1323     potentially dangerous, since a server could just keep sending data
1324     indefinitely and wait for your RAM to exhaust -- with nasty consequences.
1325     Hence this option.
1326    
1327     When a document buffer size reaches the buffer-limit, it is flushed to the
1328     client unfiltered and no further attempt to filter the rest of the document
1329     is made. Remember that there may be multiple threads running, which might
1330     require up to buffer-limit Kbytes each, unless you have enabled
1331     "single-threaded" above.
1332    
1333 -------------------------------------------------------------------------------
1334
1335 8.5. Forwarding
1336
1337 This feature allows routing of HTTP requests through a chain of multiple
1338 proxies. It can be used to better protect privacy and confidentiality when
1339 accessing specific domains by routing requests to those domains through an
1340 anonymous public proxy (see e.g. http://www.multiproxy.org/anon_list.htm) Or to
1341 use a caching proxy to speed up browsing. Or chaining to a parent proxy may be
1342 necessary because the machine that Privoxy runs on has no direct Internet
1343 access.
1344
1345 Also specified here are SOCKS proxies. Privoxy supports the SOCKS 4 and SOCKS
1346 4A protocols.
1347
1348 -------------------------------------------------------------------------------
1349
1350 8.5.1. forward
1351
1352 Specifies:
1353    
1354     To which parent HTTP proxy specific requests should be routed.
1355    
1356 Type of value:
1357    
1358     target_domain[:port] http_parent[/port]
1359    
1360     Where target_domain is a domain name pattern (see the chapter on domain
1361     matching in the default.action file), http_parent is the address of the
1362     parent HTTP proxy as an IP addresses in dotted decimal notation or as a
1363     valid DNS name (or "." to denote "no forwarding", and the optional port
1364     parameters are TCP ports, i.e. integer values from 1 to 64535
1365    
1366 Default value:
1367    
1368     Unset
1369    
1370 Effect if unset:
1371    
1372     Don't use parent HTTP proxies.
1373    
1374 Notes:
1375    
1376     If http_parent is ".", then requests are not forwarded to another HTTP
1377     proxy but are made directly to the web servers.
1378    
1379     Multiple lines are OK, they are checked in sequence, and the last match
1380     wins.
1381    
1382 Examples:
1383    
1384     Everything goes to an example anonymizing proxy, except SSL on port 443
1385     (which it doesn't handle):
1386    
1387       forward   .*     anon-proxy.example.org:8080                     
1388       forward   :443   .                                               
1389    
1390     Everything goes to our example ISP's caching proxy, except for requests to
1391     that ISP's sites:
1392    
1393       forward   .*.                caching-proxy.example-isp.net:8000  
1394       forward   .example-isp.net   .                                   
1395    
1396 -------------------------------------------------------------------------------
1397
1398 8.5.2. forward-socks4 and forward-socks4a
1399
1400 Specifies:
1401    
1402     Through which SOCKS proxy (and to which parent HTTP proxy) specific
1403     requests should be routed.
1404    
1405 Type of value:
1406    
1407     target_domain[:port] socks_proxy[/port] http_parent[/port]
1408    
1409     Where target_domain is a domain name pattern (see the chapter on domain
1410     matching in the default.action file), http_parent and socks_proxy are IP
1411     addresses in dotted decimal notation or valid DNS names (http_parent may be
1412     "." to denote "no HTTP forwarding"), and the optional port parameters are
1413     TCP ports, i.e. integer values from 1 to 64535
1414    
1415 Default value:
1416    
1417     Unset
1418    
1419 Effect if unset:
1420    
1421     Don't use SOCKS proxies.
1422    
1423 Notes:
1424    
1425     Multiple lines are OK, they are checked in sequence, and the last match
1426     wins.
1427    
1428     The difference between forward-socks4 and forward-socks4a is that in the
1429     SOCKS 4A protocol, the DNS resolution of the target hostname happens on the
1430     SOCKS server, while in SOCKS 4 it happens locally.
1431    
1432     If http_parent is ".", then requests are not forwarded to another HTTP
1433     proxy but are made (HTTP-wise) directly to the web servers, albeit through
1434     a SOCKS proxy.
1435    
1436 Examples:
1437    
1438     From the company example.com, direct connections are made to all "internal"
1439     domains, but everything outbound goes through their ISP's proxy by way of
1440     example.com's corporate SOCKS 4A gateway to the Internet.
1441    
1442       forward-socks4a   .*.            socks-gw.example.com:1080  www-cache.example-isp.net:8080 
1443       forward           .example.com   .                                                         
1444    
1445     A rule that uses a SOCKS 4 gateway for all destinations but no HTTP parent
1446     looks like this:
1447    
1448       forward-socks4   .*.            socks-gw.example.com:1080  .     
1449    
1450 -------------------------------------------------------------------------------
1451
1452 8.5.3. Advanced Forwarding Examples
1453
1454 If you have links to multiple ISPs that provide various special content only to
1455 their subscribers, you can configure multiple Privoxies which have connections
1456 to the respective ISPs to act as forwarders to each other, so that your users
1457 can see the internal content of all ISPs.
1458
1459 Assume that host-a has a PPP connection to isp-a.net. And host-b has a PPP
1460 connection to isp-b.net. Both run Privoxy. Their forwarding configuration can
1461 look like this:
1462
1463 host-a:
1464
1465   forward    .*.         .                                                     
1466   forward    .isp-b.net  host-b:8118                                           
1467
1468 host-b:
1469
1470   forward    .*.         .                                                     
1471   forward    .isp-a.net  host-a:8118                                           
1472
1473 Now, your users can set their browser's proxy to use either host-a or host-b
1474 and be able to browse the internal content of both isp-a and isp-b.
1475
1476 If you intend to chain Privoxy and squid locally, then chain as browser ->
1477 squid -> privoxy is the recommended way.
1478
1479 Assuming that Privoxy and squid run on the same box, your squid configuration
1480 could then look like this:
1481
1482   # Define Privoxy as parent proxy (without ICP)                               
1483   cache_peer 127.0.0.1 parent 8118 7 no-query                                  
1484                                                                                
1485   # Define ACL for protocol FTP                                                
1486   acl ftp proto FTP                                                            
1487                                                                                
1488   # Do not forward FTP requests to Privoxy                                     
1489   always_direct allow ftp                                                      
1490                                                                                
1491   # Forward all the rest to Privoxy                                            
1492   never_direct allow all                                                       
1493
1494 You would then need to change your browser's proxy settings to squid's address
1495 and port. Squid normally uses port 3128. If unsure consult http_port in
1496 squid.conf.
1497
1498 -------------------------------------------------------------------------------
1499
1500 8.6. Windows GUI Options
1501
1502 Privoxy has a number of options specific to the Windows GUI interface:
1503
1504 If "activity-animation" is set to 1, the Privoxy icon will animate when
1505 "Privoxy" is active. To turn off, set to 0.
1506
1507   activity-animation 1
1508    
1509
1510 If "log-messages" is set to 1, Privoxy will log messages to the console window:
1511
1512   log-messages 1
1513    
1514
1515 If "log-buffer-size" is set to 1, the size of the log buffer, i.e. the amount
1516 of memory used for the log messages displayed in the console window, will be
1517 limited to "log-max-lines" (see below).
1518
1519 Warning: Setting this to 0 will result in the buffer to grow infinitely and eat
1520 up all your memory!
1521
1522   log-buffer-size 1
1523    
1524
1525 log-max-lines is the maximum number of lines held in the log buffer. See above.
1526
1527   log-max-lines 200
1528    
1529
1530 If "log-highlight-messages" is set to 1, Privoxy will highlight portions of the
1531 log messages with a bold-faced font:
1532
1533   log-highlight-messages 1
1534    
1535
1536 The font used in the console window:
1537
1538   log-font-name Comic Sans MS
1539    
1540
1541 Font size used in the console window:
1542
1543   log-font-size 8
1544    
1545
1546 "show-on-task-bar" controls whether or not Privoxy will appear as a button on
1547 the Task bar when minimized:
1548
1549   show-on-task-bar 0
1550    
1551
1552 If "close-button-minimizes" is set to 1, the Windows close button will minimize
1553 Privoxy instead of closing the program (close with the exit option on the File
1554 menu).
1555
1556   close-button-minimizes 1
1557    
1558
1559 The "hide-console" option is specific to the MS-Win console version of Privoxy.
1560 If this option is used, Privoxy will disconnect from and hide the command
1561 console.
1562
1563   #hide-console
1564    
1565
1566 -------------------------------------------------------------------------------
1567
1568 9. Actions Files
1569
1570 The actions files are used to define what actions Privoxy takes for which URLs,
1571 and thus determines how ad images, cookies and various other aspects of HTTP
1572 content and transactions are handled, and on which sites (or even parts
1573 thereof). There are three such files included with Privoxy (as of version
1574 2.9.15), with differing purposes:
1575
1576   * standard.action - is used by the web based editor, to set various
1577     pre-defined sets of rules for the default actions section in
1578     default.action. These have increasing levels of aggressiveness. It is not
1579     recommend to edit this file.
1580    
1581   * default.action - is the primary action file that sets the initial values
1582     for all actions. It is intended to provide a base level of functionality
1583     for Privoxy's array of features. So it is a set of broad rules that should
1584     work reasonably well for users everywhere. This is the file that the
1585     developers are keeping updated, and making available to users.
1586    
1587   * user.action - is intended to be for local site preferences and exceptions.
1588     As an example, if your ISP or your bank has specific requirements, and need
1589     special handling, this kind of thing should go here. This file will not be
1590     upgraded.
1591    
1592 The list of actions files to be used are defined in the main configuration
1593 file, and are processed in the order they are defined. The content of these can
1594 all be viewed and edited from http://config.privoxy.org/show-status.
1595
1596 An actions file typically has sections. Near the top, "aliases" are optionally
1597 defined (discussed below), then the default set of rules which will apply
1598 universally to all sites and pages. And then below that, exceptions to the
1599 defined universal policies.
1600
1601 Actions can be used to block anything you want, including ads, banners, or just
1602 some obnoxious URL that you would rather not see. Cookies can be accepted or
1603 rejected, or accepted only during the current browser session (i.e. not written
1604 to disk), content can be modified, JavaScripts tamed, user-tracking fooled, and
1605 much more. See below for a complete list of actions.
1606
1607 -------------------------------------------------------------------------------
1608
1609 9.1. Finding the Right Mix
1610
1611 Note that some actions, like cookie suppression or script disabling, may render
1612 some sites unusable that rely on these techniques to work properly. Finding the
1613 right mix of actions is not always easy and certainly a matter of personal
1614 taste. In general, it can be said that the more "aggressive" your default
1615 settings (in the top section of the actions file) are, the more exceptions for
1616 "trusted" sites you will have to make later. If, for example, you want to kill
1617 popup windows per default, you'll have to make exceptions from that rule for
1618 sites that you regularly use and that require popups for actually useful
1619 content, like maybe your bank, favorite shop, or newspaper.
1620
1621 We have tried to provide you with reasonable rules to start from in the
1622 distribution actions files. But there is no general rule of thumb on these
1623 things. There just are too many variables, and sites are constantly changing.
1624 Sooner or later you will want to change the rules (and read this chapter again
1625 :).
1626
1627 -------------------------------------------------------------------------------
1628
1629 9.2. How to Edit
1630
1631 The easiest way to edit the "actions" files is with a browser by using our
1632 browser-based editor, which can be reached from http://config.privoxy.org/
1633 show-status.
1634
1635 If you prefer plain text editing to GUIs, you can of course also directly edit
1636 the the actions files.
1637
1638 -------------------------------------------------------------------------------
1639
1640 9.3. How Actions are Applied to URLs
1641
1642 Actions files are divided into sections. There are special sections, like the "
1643 alias" sections which will be discussed later. For now let's concentrate on
1644 regular sections: They have a heading line (often split up to multiple lines
1645 for readability) which consist of a list of actions, separated by whitespace
1646 and enclosed in curly braces. Below that, there is a list of URL patterns, each
1647 on a separate line.
1648
1649 To determine which actions apply to a request, the URL of the request is
1650 compared to all patterns in this file. Every time it matches, the list of
1651 applicable actions for the URL is incrementally updated, using the heading of
1652 the section in which the pattern is located. If multiple matches for the same
1653 URL set the same action differently, the last match wins. If not, the effects
1654 are aggregated (e.g. a URL might match both the "+handle-as-image" and "+block"
1655 actions).
1656
1657 You can trace this process by visiting http://config.privoxy.org/show-url-info.
1658
1659 More detail on this is provided in the Appendix, Anatomy of an Action.
1660
1661 -------------------------------------------------------------------------------
1662
1663 9.4. Patterns
1664
1665 Generally, a pattern has the form <domain>/<path>, where both the <domain> and
1666 <path> are optional. (This is why the pattern / matches all URLs).
1667
1668 www.example.com/
1669    
1670     is a domain-only pattern and will match any request to www.example.com,
1671     regardless of which document on that server is requested.
1672    
1673 www.example.com
1674    
1675     means exactly the same. For domain-only patterns, the trailing / may be
1676     omitted.
1677    
1678 www.example.com/index.html
1679    
1680     matches only the single document /index.html on www.example.com.
1681    
1682 /index.html
1683    
1684     matches the document /index.html, regardless of the domain, i.e. on any web
1685     server.
1686    
1687 index.html
1688    
1689     matches nothing, since it would be interpreted as a domain name and there
1690     is no top-level domain called .html.
1691    
1692 -------------------------------------------------------------------------------
1693
1694 9.4.1. The Domain Pattern
1695
1696 The matching of the domain part offers some flexible options: if the domain
1697 starts or ends with a dot, it becomes unanchored at that end. For example:
1698
1699 .example.com
1700    
1701     matches any domain that ENDS in .example.com
1702    
1703 www.
1704    
1705     matches any domain that STARTS with www.
1706    
1707 .example.
1708    
1709     matches any domain that CONTAINS .example. (Correctly speaking: It matches
1710     any FQDN that contains example as a domain.)
1711    
1712 Additionally, there are wild-cards that you can use in the domain names
1713 themselves. They work pretty similar to shell wild-cards: "*" stands for zero
1714 or more arbitrary characters, "?" stands for any single character, you can
1715 define character classes in square brackets and all of that can be freely
1716 mixed:
1717
1718 ad*.example.com
1719    
1720     matches "adserver.example.com", "ads.example.com", etc but not
1721     "sfads.example.com"
1722    
1723 *ad*.example.com
1724    
1725     matches all of the above, and then some.
1726    
1727 .?pix.com
1728    
1729     matches www.ipix.com, pictures.epix.com, a.b.c.d.e.upix.com etc.
1730    
1731 www[1-9a-ez].example.c*
1732    
1733     matches www1.example.com, www4.example.cc, wwwd.example.cy,
1734     wwwz.example.com etc., but not wwww.example.com.
1735    
1736 -------------------------------------------------------------------------------
1737
1738 9.4.2. The Path Pattern
1739
1740 Privoxy uses Perl compatible regular expressions (through the PCRE library) for
1741 matching the path.
1742
1743 There is an Appendix with a brief quick-start into regular expressions, and
1744 full (very technical) documentation on PCRE regex syntax is available on-line
1745 at http://www.pcre.org/man.txt. You might also find the Perl man page on
1746 regular expressions (man perlre) useful, which is available on-line at http://
1747 www.perldoc.com/perl5.6/pod/perlre.html.
1748
1749 Note that the path pattern is automatically left-anchored at the "/", i.e. it
1750 matches as if it would start with a "^" (regular expression speak for the
1751 beginning of a line).
1752
1753 Please also note that matching in the path is case INSENSITIVE by default, but
1754 you can switch to case sensitive at any point in the pattern by using the "(?
1755 -i)" switch: www.example.com/(?-i)PaTtErN.* will match only documents whose
1756 path starts with PaTtErN in exactly this capitalization.
1757
1758 -------------------------------------------------------------------------------
1759
1760 9.5. Actions
1761
1762 All actions are disabled by default, until they are explicitly enabled
1763 somewhere in an actions file. Actions are turned on if preceded with a "+", and
1764 turned off if preceded with a "-". So a "+action" means "do that action", e.g.
1765 "+block" means please "block the following URL patterns".
1766
1767 Actions are invoked by enclosing the action name in curly braces (e.g.
1768 {+some_action}), followed by a list of URLs (or patterns that match URLs) to
1769 which the action applies. There are three classes of actions:
1770
1771   * Boolean, i.e the action can only be "on" or "off". Examples:
1772    
1773       {+name}        # enable this action
1774       {-name}        # disable this action
1775          
1776    
1777   * Parameterized, e.g. "+/-hide-user-agent{ Mozilla 1.0 }", where some value
1778     is required in order to enable this type of action. Examples:
1779    
1780       {+name{param}}  # enable action and set parameter to "param"
1781       {-name}         # disable action ("parameter") can be omitted
1782          
1783    
1784   * Multi-value, e.g. "{+/-add-header{Name: value}}" or "{+/-send-wafer{name=
1785     value}}"), where some value needs to be defined in addition to simply
1786     enabling the action. Examples:
1787    
1788       {+name{param=value}}   # enable action and set "param" to "value"
1789       {-name{param=value}}   # remove the parameter "param" completely
1790       {-name}                # disable this action totally and remove param too
1791          
1792    
1793 If nothing is specified in any actions file, no "actions" are taken. So in this
1794 case Privoxy would just be a normal, non-blocking, non-anonymizing proxy. You
1795 must specifically enable the privacy and blocking features you need (although
1796 the provided default actions files will give a good starting point).
1797
1798 Later defined actions always over-ride earlier ones. So exceptions to any rules
1799 you make, should come in the latter part of the file (or in a file that is
1800 processed later when using multiple actions files). For multi-valued actions,
1801 the actions are applied in the order they are specified. Actions files are
1802 processed in the order they are defined in config (the default installation has
1803 three actions files). It also quite possible for any given URL pattern to match
1804 more than one action!
1805
1806 The list of valid Privoxy "actions" are:
1807
1808 -------------------------------------------------------------------------------
1809
1810 9.5.1. +add-header
1811
1812 Type:
1813    
1814     Multi-value.
1815    
1816 Typical uses:
1817    
1818     Send a user defined HTTP header to the web server.
1819    
1820 Possible values:
1821    
1822     Any value is possible. Validity of the defined HTTP headers is not checked.
1823    
1824 Example usage:
1825    
1826          {+add-header{X-User-Tracking: sucks}}
1827          .example.com
1828         
1829    
1830 Notes:
1831    
1832     This action may be specified multiple times, in order to define multiple
1833     headers. This is rarely needed for the typical user. If you don't know what
1834     "HTTP headers" are, you definitely don't need to worry about this one.
1835    
1836 -------------------------------------------------------------------------------
1837
1838 9.5.2. +block
1839
1840 Type:
1841    
1842     Boolean.
1843    
1844 Typical uses:
1845    
1846     Used to block a URL from reaching your browser. The URL may be anything,
1847     but is typically used to block ads or other obnoxious content.
1848    
1849 Possible values:
1850    
1851     N/A
1852    
1853 Example usage:
1854    
1855          {+block}
1856          .banners.example.com
1857          .ads.r.us
1858         
1859    
1860 Notes:
1861    
1862     If a URL matches one of the blocked patterns, Privoxy will intercept the
1863     URL and display its special "BLOCKED" page instead. If there is sufficient
1864     space, a large red banner will appear with a friendly message about why the
1865     page was blocked, and a way to go there anyway. If there is insufficient
1866     space a smaller "BLOCKED" page will appear without the red banner. Click
1867     here to view the default blocked HTML page (Privoxy must be running for
1868     this to work as intended!).
1869    
1870     A very important exception is if the URL matches both "+block" and 
1871     "+handle-as-image", then it will be handled by "+set-image-blocker" (see
1872     below). It is important to understand this process, in order to understand
1873     how Privoxy is able to deal with ads and other objectionable content.
1874    
1875     The "+filter" action can also perform some of the same functionality as
1876     "+block", but by virtue of very different programming techniques, and is
1877     most often used for different reasons.
1878    
1879 -------------------------------------------------------------------------------
1880
1881 9.5.3. +deanimate-gifs
1882
1883 Type:
1884    
1885     Parameterized.
1886    
1887 Typical uses:
1888    
1889     To stop those annoying, distracting animated GIF images.
1890    
1891 Possible values:
1892    
1893     "last" or "first"
1894    
1895 Example usage:
1896    
1897           {+deanimate-gifs{last}}
1898           .example.com
1899         
1900    
1901 Notes:
1902    
1903     De-animate all animated GIF images, i.e. reduce them to their last frame.
1904     This will also shrink the images considerably (in bytes, not pixels!). If
1905     the option "first" is given, the first frame of the animation is used as
1906     the replacement. If "last" is given, the last frame of the animation is
1907     used instead, which probably makes more sense for most banner animations,
1908     but also has the risk of not showing the entire last frame (if it is only a
1909     delta to an earlier frame).
1910    
1911 -------------------------------------------------------------------------------
1912
1913 9.5.4. +downgrade-http-version
1914
1915 Type:
1916    
1917     Boolean.
1918    
1919 Typical uses:
1920    
1921     "+downgrade-http-version" will downgrade HTTP/1.1 client requests to HTTP/
1922     1.0 and downgrade the responses as well.
1923    
1924 Possible values:
1925    
1926     N/A
1927    
1928 Example usage:
1929    
1930          {+downgrade-http-version}
1931          .example.com
1932         
1933    
1934 Notes:
1935    
1936     Use this action for servers that use HTTP/1.1 protocol features that
1937     Privoxy doesn't handle well yet. HTTP/1.1 is only partially implemented.
1938     Default is not to downgrade requests. This is an infrequently needed
1939     action, and is used to help with rare problem sites only.
1940    
1941 -------------------------------------------------------------------------------
1942
1943 9.5.5. +fast-redirects
1944
1945 Type:
1946    
1947     Boolean.
1948    
1949 Typical uses:
1950    
1951     The "+fast-redirects" action enables interception of "redirect" requests
1952     from one server to another, which are used to track users.Privoxy can cut
1953     off all but the last valid URL in a redirect request and send a local
1954     redirect back to your browser without contacting the intermediate site(s).
1955    
1956 Possible values:
1957    
1958     N/A
1959    
1960 Example usage:
1961    
1962          {+fast-redirects}
1963          .example.com
1964         
1965    
1966 Notes:
1967    
1968     Many sites, like yahoo.com, don't just link to other sites. Instead, they
1969     will link to some script on their own server, giving the destination as a
1970     parameter, which will then redirect you to the final target. URLs resulting
1971     from this scheme typically look like: http://some.place/some_script?http://
1972     some.where-else.
1973    
1974     Sometimes, there are even multiple consecutive redirects encoded in the
1975     URL. These redirections via scripts make your web browsing more traceable,
1976     since the server from which you follow such a link can see where you go to.
1977     Apart from that, valuable bandwidth and time is wasted, while your browser
1978     ask the server for one redirect after the other. Plus, it feeds the
1979     advertisers.
1980    
1981     This is a normally "on" feature, and often requires exceptions for sites
1982     that are sensitive to defeating this mechanism.
1983    
1984 -------------------------------------------------------------------------------
1985
1986 9.5.6. +filter
1987
1988 Type:
1989    
1990     Parameterized.
1991    
1992 Typical uses:
1993    
1994     Apply page filtering as defined by named sections of the default.filter
1995     file to the specified site(s). "Filtering" can be any modification of the
1996     raw page content, including re-writing or deletion of content.
1997    
1998 Possible values:
1999    
2000     "+filter" must include the name of one of the section identifiers from
2001     default.filter (or whatever filterfile is specified in config).
2002    
2003 Example usage (from the current default.filter):
2004    
2005     +filter{html-annoyances}: Get rid of particularly annoying HTML abuse.
2006    
2007     +filter{js-annoyances}: Get rid of particularly annoying JavaScript abuse
2008    
2009     +filter{content-cookies}: Kill cookies that come in the HTML or JS content
2010    
2011     +filter{popups}: Kill all popups in JS and HTML
2012    
2013     +filter{frameset-borders}: Give frames a border and make them resizable
2014    
2015     +filter{webbugs}: Squish WebBugs (1x1 invisible GIFs used for user         
2016     tracking)                                                                  
2017    
2018     +filter{refresh-tags}: Kill automatic refresh tags (for dial-on-demand     
2019     setups)                                                                    
2020    
2021     +filter{fun}: Text replacements for subversive browsing fun!
2022    
2023     +filter{nimda}: Remove Nimda (virus) code.
2024    
2025     +filter{banners-by-size}: Kill banners by size (very efficient!)
2026    
2027     +filter{shockwave-flash}: Kill embedded Shockwave Flash objects
2028    
2029     +filter{crude-parental}: Kill all web pages that contain the words "sex" or
2030     "warez"                                                                    
2031    
2032 Notes:
2033    
2034     This is potentially a very powerful feature! And requires a knowledge of
2035     regular expressions if you want to "roll your own". Filtering operates on a
2036     line by line basis throughout the entire page.
2037    
2038     Filtering requires buffering the page content, which may appear to slow
2039     down page rendering since nothing is displayed until all content has passed
2040     the filters. (It does not really take longer, but seems that way since the
2041     page is not incrementally displayed.) This effect will be more noticeable
2042     on slower connections.
2043    
2044     Filtering can achieve some of the effects as the "+block" action, i.e. it
2045     can be used to block ads and banners. In the overall scheme of things,
2046     filtering is one of the first things "Privoxy" does with a web page. So
2047     other most other actions are applied to the already "filtered" page.
2048    
2049 -------------------------------------------------------------------------------
2050
2051 9.5.7. +hide-forwarded-for-headers
2052
2053 Type:
2054    
2055     Boolean.
2056    
2057 Typical uses:
2058    
2059     Block any existing X-Forwarded-for HTTP header, and do not add a new one.
2060    
2061 Possible values:
2062    
2063     N/A
2064    
2065 Example usage:
2066    
2067          {+hide-forwarded-for-headers}
2068          .example.com
2069         
2070    
2071 Notes:
2072    
2073     It is fairly safe to leave this on. It does not seem to break many sites.
2074    
2075 -------------------------------------------------------------------------------
2076
2077 9.5.8. +hide-from-header
2078
2079 Type:
2080    
2081     Parameterized.
2082    
2083 Typical uses:
2084    
2085     To block the browser from sending your email address in a "From:" header.
2086    
2087 Possible values:
2088    
2089     Keyword: "block", or any user defined value.
2090    
2091 Example usage:
2092    
2093          {+hide-from-header{block}}
2094          .example.com
2095         
2096    
2097 Notes:
2098    
2099     The keyword "block" will completely remove the header (not to be confused
2100     with the "+block" action). Alternately, you can specify any value you
2101     prefer to send to the web server.
2102    
2103 -------------------------------------------------------------------------------
2104
2105 9.5.9. +hide-referer
2106
2107 Type:
2108    
2109     Parameterized.
2110    
2111 Typical uses:
2112    
2113     Don't send the "Referer:" (sic) HTTP header to the web site. Or,
2114     alternately send a forged header instead.
2115    
2116 Possible values:
2117    
2118     Prevent the header from being sent with the keyword, "block". Or, "forge" a
2119     URL to one from the same server as the request. Or, set to user defined
2120     value of your choice.
2121    
2122 Example usage:
2123    
2124          {+hide-referer{forge}}
2125          .example.com
2126         
2127    
2128 Notes:
2129    
2130     "forge" is the preferred option here, since some servers will not send
2131     images back otherwise.
2132    
2133     "+hide-referrer" is an alternate spelling of "+hide-referer". It has the
2134     exact same parameters, and can be freely mixed with, "+hide-referer".
2135     ("referrer" is the correct English spelling, however the HTTP specification
2136     has a bug - it requires it to be spelled as "referer".)
2137    
2138 -------------------------------------------------------------------------------
2139
2140 9.5.10. +hide-user-agent
2141
2142 Type:
2143    
2144     Parameterized.
2145    
2146 Typical uses:
2147    
2148     To change the "User-Agent:" header so web servers can't tell your browser
2149     type. Who's business is it anyway?
2150    
2151 Possible values:
2152    
2153     Any user defined string.
2154    
2155 Example usage:
2156    
2157          {+hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}}
2158          .msn.com
2159         
2160    
2161 Notes:
2162    
2163     Warning! This breaks many web sites that depend on this in order to
2164     determine how the target browser will respond to various requests. Use with
2165     caution.
2166    
2167 -------------------------------------------------------------------------------
2168
2169 9.5.11. +handle-as-image
2170
2171 Type:
2172    
2173     Boolean.
2174    
2175 Typical uses:
2176    
2177     To define what Privoxy should treat automatically as an image, and is an
2178     important ingredient of how ads are handled.
2179    
2180 Possible values:
2181    
2182     N/A
2183    
2184 Example usage:
2185    
2186          {+handle-as-image}
2187          /.*\.(gif|jpg|jpeg|png|bmp|ico)
2188         
2189    
2190 Notes:
2191    
2192     This only has meaning if the URL (or pattern) also is "+block"ed, in which
2193     case a user definable image can be sent rather than a HTML page. This is
2194     integral to the whole concept of ad blocking: the URL must match both a 
2195     "+block" rule, and "+handle-as-image". (See "+set-image-blocker" below for
2196     control over what will actually be displayed by the browser.)
2197    
2198     There is little reason to change the default definition for this action.
2199    
2200 -------------------------------------------------------------------------------
2201
2202 9.5.12. +set-image-blocker
2203
2204 Type:
2205    
2206     Parameterized.
2207    
2208 Typical uses:
2209    
2210     Decide what to do with URLs that end up tagged with both "+block" and 
2211     "+handle-as-image", e.g an advertisement.
2212    
2213 Possible values:
2214    
2215     There are four available options: "-set-image-blocker" will send a HTML
2216     "blocked" page, usually resulting in a "broken image" icon.
2217     "+set-image-blocker{blank}" will send a 1x1 transparent GIF image.
2218     "+set-image-blocker{pattern}" will send a checkerboard type pattern (the
2219     default). And finally, "+set-image-blocker{http://xyz.com}" will send a
2220     HTTP temporary redirect to the specified image. This has the advantage of
2221     the icon being being cached by the browser, which will speed up the
2222     display.
2223    
2224 Example usage:
2225    
2226          {+set-image-blocker{blank}}
2227          .example.com
2228         
2229    
2230 Notes:
2231    
2232     If you want invisible ads, they need to meet criteria as matching both
2233     images and blocked actions. And then, "image-blocker" should be set to
2234     "blank" for invisibility. Note you cannot treat HTML pages as images in
2235     most cases. For instance, frames require an HTML page to display. So a
2236     frame that is an ad, typically cannot be treated as an image. Forcing an
2237     "image" in this situation just will not work reliably.
2238    
2239 -------------------------------------------------------------------------------
2240
2241 9.5.13. +limit-connect
2242
2243 Type:
2244    
2245     Parameterized.
2246    
2247 Typical uses:
2248    
2249     By default, Privoxy only allows HTTP CONNECT requests to port 443 (the
2250     standard, secure HTTPS port). Use "+limit-connect" to disable this
2251     altogether, or to allow more ports.
2252    
2253 Possible values:
2254    
2255     Any valid port number, or port number range.
2256    
2257 Example usages:
2258    
2259          +limit-connect{443}                       #
2260      This is the default and need not be specified.
2261          +limit-connect{80,443}                  # Ports 80 and 443 are OK.
2262          +limit-connect{-3, 7, 20-100, 500-}   #
2263      Port less than 3, 7, 20 to 100 and above 500 are OK.
2264         
2265    
2266 Notes:
2267    
2268     The CONNECT methods exists in HTTP to allow access to secure websites
2269     (https:// URLs) through proxies. It works very simply: the proxy connects
2270     to the server on the specified port, and then short-circuits its
2271     connections to the client and to the remote proxy. This can be a big
2272     security hole, since CONNECT-enabled proxies can be abused as TCP relays
2273     very easily.
2274    
2275     If you want to allow CONNECT for more ports than this, or want to forbid
2276     CONNECT altogether, you can specify a comma separated list of ports and
2277     port ranges (the latter using dashes, with the minimum defaulting to 0 and
2278     max to 65K).
2279    
2280     If you don't know what any of this means, there probably is no reason to
2281     change this one.
2282    
2283 -------------------------------------------------------------------------------
2284
2285 9.5.14. +prevent-compression
2286
2287 Type:
2288    
2289     Boolean.
2290    
2291 Typical uses:
2292    
2293     Prevent the specified websites from compressing HTTP data.
2294    
2295 Possible values:
2296    
2297     N/A
2298    
2299 Example usage:
2300    
2301          {+prevent-compression}
2302          .example.com
2303         
2304    
2305 Notes:
2306    
2307     Some websites do this, which can be a problem for Privoxy, since "+filter",
2308     "+kill-popups" and "+gif-deanimate" will not work on compressed data. This
2309     will slow down connections to those websites, though. Default typically is
2310     to turn "prevent-compression" on.
2311    
2312 -------------------------------------------------------------------------------
2313
2314 9.5.15. +session-cookies-only
2315
2316 Type:
2317    
2318     Boolean.
2319    
2320 Typical uses:
2321    
2322     Allow cookies for the current browser session only.
2323    
2324 Possible values:
2325    
2326     N/A
2327    
2328 Example usage (disabling):
2329    
2330          {-session-cookies-only}
2331          .example.com
2332         
2333    
2334 Notes:
2335    
2336     If websites set cookies, "+session-cookies-only" will make sure they are
2337     erased when you exit and restart your web browser. This makes profiling
2338     cookies useless, but won't break sites which require cookies so that you
2339     can log in for transactions. This is generally turned on for all sites, and
2340     is the recommended setting.
2341    
2342     "+prevent-*-cookies" actions should be turned off as well (see below), for
2343     "+session-cookies-only" to work. Or, else no cookies will get through at
2344     all. For, "persistent" cookies that survive across browser sessions, see
2345     below as well.
2346    
2347 -------------------------------------------------------------------------------
2348
2349 9.5.16. +prevent-reading-cookies
2350
2351 Type:
2352    
2353     Boolean.
2354    
2355 Typical uses:
2356    
2357     Explicitly prevent the web server from reading any cookies on your system.
2358    
2359 Possible values:
2360    
2361     N/A
2362    
2363 Example usage:
2364    
2365          {+prevent-reading-cookies}
2366          .example.com
2367         
2368    
2369 Notes:
2370    
2371     Often used in conjunction with "+prevent-setting-cookies" to disable
2372     cookies completely. Note that "+session-cookies-only" requires these to
2373     both be disabled (or else it never gets any cookies to cache).
2374    
2375     For "persistent" cookies to work (i.e. they survive across browser sessions
2376     and reboots), all three cookie settings should be "off" for the specified
2377     sites.
2378    
2379 -------------------------------------------------------------------------------
2380
2381 9.5.17. +prevent-setting-cookies
2382
2383 Type:
2384    
2385     Boolean.
2386    
2387 Typical uses:
2388    
2389     Explicitly block the web server from storing cookies on your system.
2390    
2391 Possible values:
2392    
2393     N/A
2394    
2395 Example usage:
2396    
2397          {+prevent-setting-cookies}
2398          .example.com
2399         
2400    
2401 Notes:
2402    
2403     Often used in conjunction with "+prevent-reading-cookies" to disable
2404     cookies completely (see above).
2405    
2406 -------------------------------------------------------------------------------
2407
2408 9.5.18. +kill-popups
2409
2410 Type:
2411    
2412     Boolean.
2413    
2414 Typical uses:
2415    
2416     Stop those annoying JavaScript pop-up windows!
2417    
2418 Possible values:
2419    
2420     N/A
2421    
2422 Example usage:
2423    
2424          {+kill-popups}
2425          .example.com
2426         
2427    
2428 Notes:
2429    
2430     "+kill-popups" uses a built in filter to disable pop-ups that use the
2431     window.open() function, etc. This is one of the first actions processed by
2432     Privoxy as it contacts the remote web server. This action is not always
2433     100% reliable, and is supplemented by "+filter{popups}".
2434    
2435 -------------------------------------------------------------------------------
2436
2437 9.5.19. +send-vanilla-wafer
2438
2439 Type:
2440    
2441     Boolean.
2442    
2443 Typical uses:
2444    
2445     Sends a cookie for every site stating that you do not accept any copyright
2446     on cookies sent to you, and asking them not to track you.
2447    
2448 Possible values:
2449    
2450     N/A
2451    
2452 Example usage:
2453    
2454          {+send-vanilla-wafer}
2455          .example.com
2456         
2457    
2458 Notes:
2459    
2460     This action only applies if you are using a jarfile for saving cookies. Of
2461     course, this is a (relatively) unique header and could conceivably be used
2462     to track you.
2463    
2464 -------------------------------------------------------------------------------
2465
2466 9.5.20. +send-wafer
2467
2468 Type:
2469    
2470     Multi-value.
2471    
2472 Typical uses:
2473    
2474     This allows you to send an arbitrary, user definable cookie.
2475    
2476 Possible values:
2477    
2478     User specified cookie name and corresponding value.
2479    
2480 Example usage:
2481    
2482          {+send-wafer{name=value}}
2483          .example.com
2484         
2485    
2486 Notes:
2487    
2488     This can be specified multiple times in order to add as many cookies as you
2489     like.
2490    
2491 -------------------------------------------------------------------------------
2492
2493 9.5.21. Summary
2494
2495 Note that many of these actions have the potential to cause a page to
2496 misbehave, possibly even not to display at all. There are many ways a site
2497 designer may choose to design his site, and what HTTP header content, and other
2498 criteria, he may depend on. There is no way to have hard and fast rules for all
2499 sites. See the Appendix for a brief example on troubleshooting actions.
2500
2501 -------------------------------------------------------------------------------
2502
2503 9.5.22. Sample Actions Files
2504
2505 Remember that the meaning of any of the above references is reversed by
2506 preceding the action with a "-", in place of the "+". Also, that some actions
2507 are turned on in the default section of the actions file, and require little to
2508 no additional configuration. These are just "on".
2509
2510 But, other actions that are turned on in the default section do typically
2511 require exceptions to be listed in the latter sections of one of our actions
2512 file. For instance, by default no URLs are "blocked" (i.e. in the default
2513 definitions of default.action). We need exceptions to this in order to enable
2514 ad blocking in the lower sections. But we need to be very selective about what
2515 we do block. Thus, the default is "off" for blocking.
2516
2517 Below is a liberally commented sample default.action file to demonstrate how
2518 all the pieces come together. And to show how exceptions to the default
2519 policies can be handled. This is followed by a brief user.action with similar
2520 examples.
2521
2522 # Sample default.action file <developers@privoxy.org>
2523
2524 # Settings -- Don't change! For internal Privoxy use ONLY.
2525 {{settings}}
2526 for-privoxy-version=3.0
2527
2528
2529 ##########################################################################
2530 # Aliases must be defined *before* they are used. These are
2531 # easier to remember, and can combine several actions into one. Once 
2532 # defined they can be used just like any built-in action -- but within 
2533 # this file only! Aliases do not require a + or - sign.
2534 ##########################################################################
2535
2536 # Some useful aliases.
2537 # Alias to turn off cookie handling, ie allow all cookies unmolested.
2538  -prevent-cookies = -prevent-setting-cookies -prevent-reading-cookies \
2539                     -session-cookies-only
2540
2541 # Alias to both block and treat as if an image for ad blocking
2542 # purposes.
2543  +imageblock      = +block +handle-as-image
2544
2545 # Fragile sites should have the minimum changes:
2546  fragile     = -block -deanimate-gifs -fast-redirects -filter -hide-referer \
2547                -prevent-cookies -kill-popups
2548
2549 # Shops should be allowed to set persistent cookies
2550  shop        = -filter -prevent-cookies -session-cookies-only
2551
2552
2553 ##########################################################################
2554 # Begin default action settings. Anything in this section will match 
2555 # all URLs -- UNLESS we have exceptions that also match, defined below this 
2556 # section. We will show all potential actions here whether they are on 
2557 # or off. We could omit any disabled action if we wanted, since all 
2558 # actions are 'off' by default anyway. Shown for completeness only.
2559 # Actions are enabled if preceded by a '+', otherwise they are disabled 
2560 # (unless an alias has been defined without this).
2561 ##########################################################################
2562  { \
2563  -add-header \
2564  -block \
2565  -deanimate-gifs \
2566  -downgrade-http-version \
2567  +fast-redirects \
2568  +filter{html-annoyances} \
2569  +filter{js-annoyances} \
2570  -filter{content-cookies} \
2571  -filter{popups} \
2572  +filter{webbugs} \
2573  -filter{refresh-tags} \
2574  -filter{fun} \
2575  +filter{nimda} \
2576  +filter{banners-by-size} \
2577  -filter{shockwave-flash} \
2578  -filter{crude-prental} \
2579  +hide-forwarded-for-headers \
2580  +hide-from-header{block} \
2581  -hide-referrer \
2582  -hide-user-agent \
2583  -handle-as-image \
2584  +set-image-blocker{pattern} \
2585  -limit-connect \
2586  +prevent-compression \
2587  -session-cookies-only \
2588  -prevent-reading-cookies \
2589  -prevent-setting-cookies \
2590  -kill-popups \
2591  -send-vanilla-wafer \
2592  -send-wafer \
2593  }
2594  / # forward slash will match *all* potential URL patterns. 
2595
2596 ##########################################################################
2597 # Default behavior is now set. Now we will define some exceptions to our 
2598 # default action policies.
2599 ##########################################################################
2600
2601 # These sites are very complex and require very minimal interference.
2602 # We'll disable most actions with our 'fragile' alias:
2603  { fragile }
2604  .office.microsoft.com           # surprise, surprise!
2605  .windowsupdate.microsoft.com
2606
2607
2608 # Shopping sites - not as fragile but require some special 
2609 # handling. We still want to block ads, and we will allow 
2610 # persistant cookies via the 'shop' alias:
2611  { shop }
2612  .quietpc.com 
2613  .worldpay.com   # for quietpc.com
2614  .jungle.com
2615  .scan.co.uk
2616
2617
2618 # These sites require pop-ups too :(  We'll combine our 'shop' 
2619 # alias with two other actions into one rule to allow all popups.
2620  { shop -kill-popups -filter{popups} }
2621  .dabs.com
2622  .overclockers.co.uk
2623
2624
2625 # The 'Fast-redirects' action breaks some sites. Disable this action
2626 # for these known sensitive sites:
2627  { -fast-redirects }
2628  login.yahoo.com
2629  edit.europe.yahoo.com
2630  .google.com
2631  .altavista.com/.*(like|url|link):http
2632  .altavista.com/trans.*urltext=http
2633  .nytimes.com
2634
2635
2636 # Define which file types will be treated as images. Important
2637 # for ad blocking.
2638  { +handle-as-image }
2639  /.*\.(gif|jpe?g|png|bmp|ico)
2640
2641
2642 # Now lets list some domains that are known ad generators. And
2643 # our alias that we use here will block these as well as force 
2644 # them to be treated as images. This combination of actions is 
2645 # important for ad blocking. What the browser will show instead is 
2646 # determined by the setting of "+set-image-blocker"
2647  { +imageblock }
2648  ar.atwola.com 
2649  .ad.doubleclick.net
2650  .a.yimg.com/(?:(?!/i/).)*$
2651  .a[0-9].yimg.com/(?:(?!/i/).)*$
2652  bs*.gsanet.com
2653  bs*.einets.com
2654  .qkimg.net
2655  ad.*.doubleclick.net
2656
2657
2658 # These will just simply be blocked. They will generate the BLOCKED
2659 # banner page, if matched. Heavy use of wildcards and regular 
2660 # expressions in this example. Enable block action:
2661  { +block }
2662  ad*.
2663  .*ads.
2664  banner?.
2665  count*.
2666  /.*count(er)?\.(pl|cgi|exe|dll|asp|php[34]?)
2667  /(?:.*/)?(publicite|werbung|rekla(ma|me|am)|annonse|maino(kset|nta|s)?)/
2668  .hitbox.com 
2669
2670
2671 # The above block section will probably inadvertantly catch some 
2672 # sites we DO NOT want blocked via the wildcards and regular expressions. 
2673 # Now let's set exceptions to the exceptions so the good guys get better 
2674 # treatment. Disable block action:
2675  { -block }
2676  advogato.org
2677  adsl.
2678  ad[ud]*.
2679  advice.
2680 # Let's just trust all .edu top level domains.
2681  .edu
2682  www.ugu.com/sui/ugu/adv
2683 # We'll need to access to path names containing 'download' 
2684  .*downloads.
2685  /downloads/
2686 # 'adv' is for globalintersec and means advanced, not advertisement
2687  www.globalintersec.com/adv
2688
2689
2690 # Don't filter *anything* from our friends at sourceforge.
2691 # Notice we don't have to name the individual filter 
2692 # identifiers -- we just turn them all off in one fell swoop.
2693 # Disable all filters for this one site:
2694  { -filter }
2695  .sourceforge.net
2696    
2697
2698 So far we are painting with a broad brush by setting general policies. The
2699 above would be a reasonable starting point for many situations. Now, we want to
2700 be more specific and have customized rules that are more suitable to our
2701 personal habits and preferences. These would be for narrowly defined situations
2702 like your ISP or your bank, and should be placed in user.action, which is
2703 parsed after all other actions files and should not be clobbered by upgrades.
2704 So any settings here, will have the last word and over-ride any previously
2705 defined actions.
2706
2707 Now a few examples of some things that one might do with a user.action file.
2708
2709 # Sample user.action file.
2710
2711 # Any aliases you want to use need to be re-defined here.
2712 # Alias to turn off cookie handling, ie allow all cookies unmolested.
2713  -prevent-cookies = -prevent-setting-cookies -prevent-reading-cookies \
2714                     -session-cookies-only
2715
2716 # Fragile sites should have the minimum changes:
2717  fragile     = -block -deanimate-gifs -fast-redirects -filter -hide-referer \
2718                -prevent-cookies -kill-popups
2719
2720 # Allow persistent cookies for a few regular sites that we 
2721 # trust via our above alias. These will be saved from one browser session 
2722 # to the next. We are explicity turning off any and all cookie handling, 
2723 # even though the prevent-*-cookie settings were disabled in our above 
2724 # default.action anyway. So cookies from these domains will come through 
2725 # unmolested.
2726  { -prevent-cookies }
2727  .sun.com
2728  .yahoo.com
2729  .msdn.microsoft.com
2730  .redhat.com
2731
2732
2733 # My ISP uses obnoxious self promoting images on many pages.
2734 # Nuke them :) Note that "+handle-as-image" need not be specified,
2735 # since all URLs ending in .gif will be tagged as images by the
2736 # general rules in default.action anyway.
2737  { +block }
2738  www.my-isp-example.com/logo[0-9].gif
2739
2740
2741 # Say the site where you do your homebanking needs to open
2742 # popup windows, but you have chosen to kill popups by
2743 # default. This will allow it for your-example-bank.com:
2744 #
2745  { -filter{popups} -kill-popups }
2746  .my-example-bank.com
2747
2748
2749 # This site is delicate, and requires kid-glove 
2750 # treatment.
2751  { fragile }
2752  .forbes.com
2753    
2754
2755 -------------------------------------------------------------------------------
2756
2757 9.6. Aliases
2758
2759 Custom "actions", known to Privoxy as "aliases", can be defined by combining
2760 other "actions". These can in turn be invoked just like the built-in "actions".
2761 Currently, an alias can contain any character except space, tab, "=", "{" or "}
2762 ". But please use only "a"- "z", "0"-"9", "+", and "-". Alias names are not
2763 case sensitive, and must be defined before other actions in the actions file!
2764 And there can only be one set of "aliases" defined per file. Each actions file
2765 may have its own aliases, but they are only visible within that file. Aliases
2766 do not requir a "+" or "-" sign in front, since they are merely expanded.
2767
2768 Now let's define a few aliases:
2769
2770  # Useful custom aliases we can use later. These must come first!
2771  {{alias}}
2772  +prevent-cookies = +prevent-setting-cookies +prevent-reading-cookies
2773  -prevent-cookies = -prevent-setting-cookies -prevent-reading-cookies
2774  fragile     =
2775  -block -prevent-cookies -filter -fast-redirects -hide-referer -kill-popups
2776  shop        = -prevent-cookies -filter -fast-redirects
2777  +imageblock = +block +handle-as-image
2778
2779  # Aliases defined from other aliases, for people who don't like to type 
2780  # too much:  ;-)
2781  c0 = +prevent-cookies
2782  c1 = -prevent-cookies
2783  #... etc.  Customize to your heart's content.
2784    
2785
2786 Some examples using our "shop" and "fragile" aliases from above. These would
2787 appear in the lower sections of an actions file as exceptions to the default
2788 actions (as defined in the upper section):
2789
2790  # These sites are very complex and require
2791  # minimal interference.
2792  {fragile}
2793   .office.microsoft.com
2794   .windowsupdate.microsoft.com
2795   .nytimes.com
2796
2797  # Shopping sites - but we still want to block ads.
2798  {shop}
2799   .quietpc.com
2800   .worldpay.com   # for quietpc.com
2801   .scan.co.uk
2802
2803  # These shops require pop-ups also 
2804  {shop -kill-popups}
2805   .dabs.com
2806   .overclockers.co.uk
2807    
2808
2809 The "shop" and "fragile" aliases are often used for "problem" sites that
2810 require most actions to be disabled in order to function properly. 
2811
2812 -------------------------------------------------------------------------------
2813
2814 10. The Filter File
2815
2816 Any web page can be dynamically modified with the filter file. This
2817 modification can be removal, or re-writing, of any web page content, including
2818 tags and non-visible content. The default filter file is oddly enough
2819 default.filter, located in the config directory.
2820
2821 This is potentially a very powerful feature, and requires knowledge of both
2822 "regular expression" and HTML in order create custom filters. But, there are a
2823 number of useful filters included with Privoxy for many common situations.
2824
2825 The included example file is divided into sections. Each section begins with
2826 the FILTER keyword, followed by the identifier for that section, e.g. "FILTER:
2827 webbugs". Each section performs a similar type of filtering, such as
2828 "html-annoyances".
2829
2830 This file uses regular expressions to alter or remove any string in the target
2831 page. The expressions can only operate on one line at a time. Some examples
2832 from the included default default.filter:
2833
2834 Stop web pages from displaying annoying messages in the status bar by deleting
2835 such references:
2836
2837  FILTER: html-annoyances
2838
2839  # New browser windows should be resizeable and have a location and status
2840  # bar. Make it so.
2841  #
2842  s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig
2843  s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig
2844  s/scrolling="?(no|0|Auto)"?/scrolling=1/ig
2845  s/menubar="?(no|0)"?/menubar=1/ig 
2846
2847  # The <BLINK> tag was a crime!
2848  #
2849  s*<blink>|</blink>**ig
2850
2851  # Is this evil? 
2852  #
2853  #s/framespacing="?(no|0)"?//ig
2854  #s/margin(height|width)=[0-9]*//gi
2855    
2856
2857 Just for kicks, replace any occurrence of "Microsoft" with "MicroSuck", and
2858 have a little fun with topical buzzwords:
2859
2860  FILTER: fun
2861
2862  s/microsoft(?!.com)/MicroSuck/ig
2863
2864  # Buzzword Bingo:
2865  #
2866  s/industry-leading|cutting-edge|award-winning/<font color=red><b>BINGO!</b></
2867 font>/ig
2868    
2869
2870 Kill those pesky little web-bugs:
2871
2872  # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
2873  FILTER: webbugs
2874
2875  s/<img\s+[^>]*?(width|height)\s*=\s*['"]?1\D[^>]*?(width|height)\s*=\s*['"]?1
2876 (\D[^>]*?)?>/<!-- Squished WebBug -->/sig
2877    
2878
2879 -------------------------------------------------------------------------------
2880
2881 10.1. The +filter Action
2882
2883 Filters are enabled with the "+filter" action from within one of the actions
2884 files. "+filter" requires one parameter, which should match one of the section
2885 identifiers in the filter file itself. Example:
2886
2887   +filter{html-annoyances}                                                     
2888
2889 This would activate that particular filter. Similarly, "+filter" can be turned
2890 off for selected sites as: "-filter{html-annoyances}". Remember too, all
2891 actions are off by default, unless they are explicity enabled in one of the
2892 actions files.
2893
2894 -------------------------------------------------------------------------------
2895
2896 11. Templates
2897
2898 When Privoxy displays one of its internal pages, such as a 404 Not Found error
2899 page (Privoxy must be running for link to work as intended), it uses the
2900 appropriate template. On Linux, BSD, and Unix, these are located in /etc/
2901 privoxy/templates by default. These may be customized, if desired.
2902 cgi-style.css is used to control the HTML attributes (fonts, etc).
2903
2904 The default Blocked (Privoxy needs to be running for page to display) banner
2905 page with the bright red top banner, is called just "blocked". This may be
2906 customized or replaced with something else if desired. 
2907
2908 -------------------------------------------------------------------------------
2909
2910 12. Contacting the Developers, Bug Reporting and Feature Requests
2911
2912 We value your feedback. However, to provide you with the best support, please
2913 note the following sections.
2914
2915 -------------------------------------------------------------------------------
2916
2917 12.1. Get Support
2918
2919 To get support, use the Sourceforge Support Forum:
2920
2921     http://sourceforge.net/tracker/?group_id=11118&atid=211118
2922
2923 -------------------------------------------------------------------------------
2924
2925 12.2. Report bugs
2926
2927 To submit bugs, use the Sourceforge Bug Forum:
2928
2929     http://sourceforge.net/tracker/?group_id=11118&atid=111118. 
2930
2931 Make sure that the bug has not already been submitted. Please try to verify
2932 that it is a Privoxy bug, and not a browser or site bug first. If you are using
2933 your own custom configuration, please try the stock configs to see if the
2934 problem is a configuration related bug. And if not using the latest development
2935 snapshot, please try the latest one. Or even better, CVS sources. Please be
2936 sure to include the Privoxy version, platform, browser, any pertinent log data,
2937 any other relevant details (please be specific) and, if possible, some way to
2938 reproduce the bug.
2939
2940 -------------------------------------------------------------------------------
2941
2942 12.3. Request new features
2943
2944 To submit ideas on new features, use the Sourceforge feature request forum:
2945
2946     http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse.
2947
2948 -------------------------------------------------------------------------------
2949
2950 12.4. Report ads or other filter problems
2951
2952 You can also send feedback on websites that Privoxy has problems with. Please
2953 bookmark the following link: "Privoxy - Submit Filter Feedback". Once you surf
2954 to a page with problems, use the bookmark to send us feedback. We will look
2955 into the issue as soon as possible.
2956
2957 New, improved default.action files will occasionally be made available based on
2958 your feedback. These will be announced on the ijbswa-announce list.
2959
2960 -------------------------------------------------------------------------------
2961
2962 12.5. Other
2963
2964 For any other issues, feel free to use the mailing lists:
2965  
2966     http://sourceforge.net/mail/?group_id=11118.
2967
2968 Anyone interested in actively participating in development and related
2969 discussions can also join the appropriate mailing list. Archives are available,
2970 too. See the page on Sourceforge.
2971
2972 -------------------------------------------------------------------------------
2973
2974 13. Copyright and History
2975
2976 13.1. Copyright
2977
2978 Privoxy is free software; you can redistribute it and/or modify it under the
2979 terms of the GNU General Public License as published by the Free Software
2980 Foundation; either version 2 of the License, or (at your option) any later
2981 version.
2982
2983 This program is distributed in the hope that it will be useful, but WITHOUT ANY
2984 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
2985 PARTICULAR PURPOSE. See the GNU General Public License for more details, which
2986 is available from the Free Software Foundation, Inc, 59 Temple Place - Suite
2987 330, Boston, MA 02111-1307, USA.
2988
2989 You should have received a copy of the GNU General Public License along with
2990 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
2991 Place, Suite 330, Boston, MA 02111-1307 USA.
2992
2993 -------------------------------------------------------------------------------
2994
2995 13.2. History
2996
2997 Privoxy is evolved, and derived from, the Internet Junkbuster, with many
2998 improvments and enhancements over the original.
2999
3000 Junkbuster was originally written by Anonymous Coders and Junkbusters
3001 Corporation, and was released as free open-source software under the GNU GPL. 
3002 Stefan Waldherr made many improvements, and started the SourceForge project
3003 Privoxy to rekindle development. There are now several active developers
3004 contributing. The last stable release of Junkbuster was v2.0.2, which has now
3005 grown whiskers ;-).
3006
3007 -------------------------------------------------------------------------------
3008
3009 14. See Also
3010
3011 Other references and sites of interest to Privoxy users:
3012
3013 http://www.privoxy.org/, The Privoxy Home page.
3014
3015 http://sourceforge.net/projects/ijbswa, the Project Page for Privoxy on        
3016 Sourceforge.                                                                   
3017
3018 http://p.p/, access Privoxy from your browser. Alternately, http://            
3019 config.privoxy.org may work in some situations where the first does not.       
3020
3021 http://p.p/, and select "Privoxy - Submit Filter Feedback" to submit "misses"  
3022 to the developers.                                                             
3023
3024 http://www.junkbusters.com/ht/en/cookies.html
3025
3026 http://www.waldherr.org/junkbuster/
3027
3028 http://privacy.net/analyze/
3029
3030 http://www.squid-cache.org/
3031
3032  
3033
3034 -------------------------------------------------------------------------------
3035
3036 15. Appendix
3037
3038 15.1. Regular Expressions
3039
3040 Privoxy can use "regular expressions" in various config files. Assuming support
3041 for "pcre" (Perl Compatible Regular Expressions) is compiled in, which is the
3042 default. Such configuration directives do not require regular expressions, but
3043 they can be used to increase flexibility by matching a pattern with wild-cards
3044 against URLs.
3045
3046 If you are reading this, you probably don't understand what "regular
3047 expressions" are, or what they can do. So this will be a very brief
3048 introduction only. A full explanation would require a book ;-)
3049
3050 "Regular expressions" is a way of matching one character expression against
3051 another to see if it matches or not. One of the "expressions" is a literal
3052 string of readable characters (letter, numbers, etc), and the other is a
3053 complex string of literal characters combined with wild-cards, and other
3054 special characters, called meta-characters. The "meta-characters" have special
3055 meanings and are used to build the complex pattern to be matched against. Perl
3056 Compatible Regular Expressions is an enhanced form of the regular expression
3057 language with backward compatibility.
3058
3059 To make a simple analogy, we do something similar when we use wild-card
3060 characters when listing files with the dir command in DOS. *.* matches all
3061 filenames. The "special" character here is the asterisk which matches any and
3062 all characters. We can be more specific and use ? to match just individual
3063 characters. So "dir file?.text" would match "file1.txt", "file2.txt", etc. We
3064 are pattern matching, using a similar technique to "regular expressions"!
3065
3066 Regular expressions do essentially the same thing, but are much, much more
3067 powerful. There are many more "special characters" and ways of building complex
3068 patterns however. Let's look at a few of the common ones, and then some
3069 examples:
3070
3071 . - Matches any single character, e.g. "a", "A", "4", ":", or "@".
3072
3073 ? - The preceding character or expression is matched ZERO or ONE times. Either/
3074 or.                                                                            
3075
3076 + - The preceding character or expression is matched ONE or MORE times.
3077
3078 * - The preceding character or expression is matched ZERO or MORE times.
3079
3080 \ - The "escape" character denotes that the following character should be taken
3081 literally. This is used where one of the special characters (e.g. ".") needs to
3082 be taken literally and not as a special meta-character. Example: "example      
3083 \.com", makes sure the period is recognized only as a period (and not expanded 
3084 to its meta-character meaning of any single character).                        
3085
3086 [] - Characters enclosed in brackets will be matched if any of the enclosed    
3087 characters are encountered. For instance, "[0-9]" matches any numeric digit    
3088 (zero through nine). As an example, we can combine this with "+" to match any  
3089 digit one of more times: "[0-9]+".                                             
3090
3091 () - parentheses are used to group a sub-expression, or multiple               
3092 sub-expressions.                                                               
3093
3094 | - The "bar" character works like an "or" conditional statement. A match is   
3095 successful if the sub-expression on either side of "|" matches. As an example: 
3096 "/(this|that) example/" uses grouping and the bar character and would match    
3097 either "this example" or "that example", and nothing else.                     
3098
3099 s/string1/string2/g - This is used to rewrite strings of text. "string1" is    
3100 replaced by "string2" in this example. There must of course be a match on      
3101 "string1" first.                                                               
3102
3103 These are just some of the ones you are likely to use when matching URLs with
3104 Privoxy, and is a long way from a definitive list. This is enough to get us
3105 started with a few simple examples which may be more illuminating:
3106
3107 /.*/banners/.* - A simple example that uses the common combination of "." and "
3108 *" to denote any character, zero or more times. In other words, any string at
3109 all. So we start with a literal forward slash, then our regular expression
3110 pattern (".*") another literal forward slash, the string "banners", another
3111 forward slash, and lastly another ".*". We are building a directory path here.
3112 This will match any file with the path that has a directory named "banners" in
3113 it. The ".*" matches any characters, and this could conceivably be more forward
3114 slashes, so it might expand into a much longer looking path. For example, this
3115 could match: "/eye/hate/spammers/banners/annoy_me_please.gif", or just "/
3116 banners/annoying.html", or almost an infinite number of other possible
3117 combinations, just so it has "banners" in the path somewhere.
3118
3119 A now something a little more complex:
3120
3121 /.*/adv((er)?ts?|ertis(ing|ements?))?/ - We have several literal forward
3122 slashes again ("/"), so we are building another expression that is a file path
3123 statement. We have another ".*", so we are matching against any conceivable
3124 sub-path, just so it matches our expression. The only true literal that must
3125 match our pattern is adv, together with the forward slashes. What comes after
3126 the "adv" string is the interesting part.
3127
3128 Remember the "?" means the preceding expression (either a literal character or
3129 anything grouped with "(...)" in this case) can exist or not, since this means
3130 either zero or one match. So "((er)?ts?|ertis(ing|ements?))" is optional, as
3131 are the individual sub-expressions: "(er)", "(ing|ements?)", and the "s". The "
3132 |" means "or". We have two of those. For instance, "(ing|ements?)", can expand
3133 to match either "ing" OR "ements?". What is being done here, is an attempt at
3134 matching as many variations of "advertisement", and similar, as possible. So
3135 this would expand to match just "adv", or "advert", or "adverts", or
3136 "advertising", or "advertisement", or "advertisements". You get the idea. But
3137 it would not match "advertizements" (with a "z"). We could fix that by changing
3138 our regular expression to: "/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/", which
3139 would then match either spelling.
3140
3141 /.*/advert[0-9]+\.(gif|jpe?g) - Again another path statement with forward
3142 slashes. Anything in the square brackets "[]" can be matched. This is using
3143 "0-9" as a shorthand expression to mean any digit one through nine. It is the
3144 same as saying "0123456789". So any digit matches. The "+" means one or more of
3145 the preceding expression must be included. The preceding expression here is
3146 what is in the square brackets -- in this case, any digit one through nine.
3147 Then, at the end, we have a grouping: "(gif|jpe?g)". This includes a "|", so
3148 this needs to match the expression on either side of that bar character also. A
3149 simple "gif" on one side, and the other side will in turn match either "jpeg"
3150 or "jpg", since the "?" means the letter "e" is optional and can be matched
3151 once or not at all. So we are building an expression here to match image GIF or
3152 JPEG type image file. It must include the literal string "advert", then one or
3153 more digits, and a "." (which is now a literal, and not a special character,
3154 since it is escaped with "\"), and lastly either "gif", or "jpeg", or "jpg".
3155 Some possible matches would include: "//advert1.jpg", "/nasty/ads/
3156 advert1234.gif", "/banners/from/hell/advert99.jpg". It would not match
3157 "advert1.gif" (no leading slash), or "/adverts232.jpg" (the expression does not
3158 include an "s"), or "/advert1.jsp" ("jsp" is not in the expression anywhere).
3159
3160 s/microsoft(?!.com)/MicroSuck/i - This is a substitution. "MicroSuck" will
3161 replace any occurrence of "microsoft". The "i" at the end of the expression
3162 means ignore case. The "(?!.com)" means the match should fail if "microsoft" is
3163 followed by ".com". In other words, this acts like a "NOT" modifier. In case
3164 this is a hyperlink, we don't want to break it ;-).
3165
3166 We are barely scratching the surface of regular expressions here so that you
3167 can understand the default Privoxy configuration files, and maybe use this
3168 knowledge to customize your own installation. There is much, much more that can
3169 be done with regular expressions. Now that you know enough to get started, you
3170 can learn more on your own :/
3171
3172 More reading on Perl Compatible Regular expressions: http://www.perldoc.com/
3173 perl5.6/pod/perlre.html
3174
3175 -------------------------------------------------------------------------------
3176
3177 15.2. Privoxy's Internal Pages
3178
3179 Since Privoxy proxies each requested web page, it is easy for Privoxy to trap
3180 certain special URLs. In this way, we can talk directly to Privoxy, and see how
3181 it is configured, see how our rules are being applied, change these rules and
3182 other configuration options, and even turn Privoxy's filtering off, all with a
3183 web browser. 
3184
3185 The URLs listed below are the special ones that allow direct access to Privoxy.
3186 Of course, Privoxy must be running to access these. If not, you will get a
3187 friendly error message. Internet access is not necessary either.
3188
3189   * Privoxy main page:
3190    
3191         http://config.privoxy.org/
3192        
3193     Alternately, this may be reached at http://p.p/, but this variation may not
3194     work as reliably as the above in some configurations.
3195    
3196   * Show information about the current configuration, including viewing and
3197     editing of actions files:
3198    
3199         http://config.privoxy.org/show-status
3200        
3201   * Show the source code version numbers:
3202    
3203         http://config.privoxy.org/show-version
3204        
3205   * Show the browser's request headers:
3206    
3207         http://config.privoxy.org/show-request
3208        
3209   * Show which actions apply to a URL and why:
3210    
3211         http://config.privoxy.org/show-url-info
3212        
3213   * Toggle Privoxy on or off. In this case, "Privoxy" continues to run, but
3214     only as a pass-through proxy, with no actions taking place:
3215    
3216         http://config.privoxy.org/toggle
3217        
3218     Short cuts. Turn off, then on:
3219    
3220         http://config.privoxy.org/toggle?set=disable
3221        
3222         http://config.privoxy.org/toggle?set=enable
3223        
3224 These may be bookmarked for quick reference. See next. 
3225
3226 -------------------------------------------------------------------------------
3227
3228 15.2.1. Bookmarklets
3229
3230 Below are some "bookmarklets" to allow you to easily access a "mini" version of
3231 some of Privoxy's special pages. They are designed for MS Internet Explorer,
3232 but should work equally well in Netscape, Mozilla, and other browsers which
3233 support JavaScript. They are designed to run directly from your bookmarks - not
3234 by clicking the links below (although that should work for testing).
3235
3236 To save them, right-click the link and choose "Add to Favorites" (IE) or "Add
3237 Bookmark" (Netscape). You will get a warning that the bookmark "may not be
3238 safe" - just click OK. Then you can run the Bookmarklet directly from your
3239 favorites/bookmarks. For even faster access, you can put them on the "Links"
3240 bar (IE) or the "Personal Toolbar" (Netscape), and run them with a single
3241 click.
3242
3243   * Privoxy - Enable
3244    
3245   * Privoxy - Disable
3246    
3247   * Privoxy - Toggle Privoxy (Toggles between enabled and disabled)
3248    
3249   * Privoxy- View Status
3250    
3251   * Privoxy - Submit Filter Feedback
3252    
3253 Credit: The site which gave me the general idea for these bookmarklets is 
3254 www.bookmarklets.com. They have more information about bookmarklets.
3255
3256 -------------------------------------------------------------------------------
3257
3258 15.3. Chain of Events
3259
3260 Let's take a quick look at the basic sequence of events when a web page is
3261 requested by your browser and Privoxy is on duty:
3262
3263   * First, your web browser requests a web page. The browser knows to send the
3264     request to Privoxy, which will in turn, relay the request to the remote web
3265     server after passing the following tests:
3266    
3267   * Privoxy traps any request for its own internal CGI pages (e.g http://p.p/)
3268     and sends the CGI page back to the browser.
3269    
3270   * Next, Privoxy checks to see if the URL matches any "+block" patterns. If
3271     so, the URL is then blocked, and the remote web server will not be
3272     contacted. "+handle-as-image" is then checked and if it does not match, an
3273     HTML "BLOCKED" page is sent back. Otherwise, if it does match, an image is
3274     returned. The type of image depends on the setting of "+set-image-blocker"
3275     (blank, checkerboard pattern, or an HTTP redirect to an image elsewhere).
3276    
3277   * Untrusted URLs are blocked. If URLs are being added to the trust file, then
3278     that is done.
3279    
3280   * If the URL pattern matches the "+fast-redirects" action, it is then
3281     processed. Unwanted parts of the requested URL are stripped.
3282    
3283   * Now the rest of the client browser's request headers are processed. If any
3284     of these match any of the relevant actions (e.g. "+hide-user-agent", etc.),
3285     headers are suppressed or forged as determined by these actions and their
3286     parameters.
3287    
3288   * Now the web server starts sending its response back (i.e. typically a web
3289     page and related data).
3290    
3291   * First, the server headers are read and processed to determine, among other
3292     things, the MIME type (document type) and encoding. The headers are then
3293     filtered as deterimed by the "+prevent-setting-cookies", 
3294     "+session-cookies-only", and "+downgrade-http-version" actions.
3295    
3296   * If the "+kill-popups" action applies, and it is an HTML or JavaScript
3297     document, the popup-code in the response is filtered on-the-fly as it is
3298     received.
3299    
3300   * If a "+filter" or "+deanimate-gifs" action applies (and the document type
3301     fits the action), the rest of the page is read into memory (up to a
3302     configurable limit). Then the filter rules (from default.filter) are
3303     processed against the buffered content. Filters are applied in the order
3304     they are specified in the default.filter file. Animated GIFs, if present,
3305     are reduced to either the first or last frame, depending on the action
3306     setting.The entire page, which is now filtered, is then sent by Privoxy
3307     back to your browser.
3308    
3309     If neither "+filter" or "+deanimate-gifs" matches, then Privoxy passes the
3310     raw data through to the client browser as it becomes available.
3311    
3312   * As the browser receives the now (probably filtered) page content, it reads
3313     and then requests any URLs that may be embedded within the page source,
3314     e.g. ad images, stylesheets, JavaScript, other HTML documents (e.g.
3315     frames), sounds, etc. For each of these objects, the browser issues a new
3316     request. And each such request is in turn processed as above. Note that a
3317     complex web page may have many such embedded URLs.
3318    
3319 -------------------------------------------------------------------------------
3320
3321 15.4. Anatomy of an Action
3322
3323 The way Privoxy applies "actions" and "filters" to any given URL can be
3324 complex, and not always so easy to understand what is happening. And sometimes
3325 we need to be able to see just what Privoxy is doing. Especially, if something
3326 Privoxy is doing is causing us a problem inadvertently. It can be a little
3327 daunting to look at the actions and filters files themselves, since they tend
3328 to be filled with "regular expressions" whose consequences are not always so
3329 obvious.
3330
3331 One quick test to see if Privoxy is causing a problem or not, is to disable it
3332 temporarily. This should be the first troubleshooting step. See the
3333 Bookmarklets section on a quick and easy way to do this (be sure to flush
3334 caches afterward!).
3335
3336 Privoxy also provides the http://config.privoxy.org/show-url-info page that can
3337 show us very specifically how actions are being applied to any given URL. This
3338 is a big help for troubleshooting.
3339
3340 First, enter one URL (or partial URL) at the prompt, and then Privoxy will tell
3341 us how the current configuration will handle it. This will not help with
3342 filtering effects (i.e. the "+filter" action) from the default.filter file
3343 since this is handled very differently and not so easy to trap! It also will
3344 not tell you about any other URLs that may be embedded within the URL you are
3345 testing. For instance, images such as ads are expressed as URLs within the raw
3346 page source of HTML pages. So you will only get info for the actual URL that is
3347 pasted into the prompt area -- not any sub-URLs. If you want to know about
3348 embedded URLs like ads, you will have to dig those out of the HTML source. Use
3349 your browser's "View Page Source" option for this. Or right click on the ad,
3350 and grab the URL.
3351
3352 Let's try an example, google.com, and look at it one section at a time:
3353
3354  Matches for http://google.com:                                                     
3355                                                                                     
3356 --- File standard ---                                                               
3357 (no matches in this file)                                                           
3358                                                                                     
3359 --- File default ---                                                                
3360                                                                                     
3361 { -add-header -block +deanimate-gifs{last} -downgrade-http-version +fast-redirects  
3362  -filter{popups} -filter{fun} -filter{shockwave-flash} -filter{crude-parental}      
3363  +filter{html-annoyances} +filter{js-annoyances} +filter{content-cookies}           
3364  +filter{webbugs} +filter{refresh-tags} +filter{nimda} +filter{banners-by-size}     
3365  +hide-forwarded-for-headers +hide-from-header{block} +hide-referer{forge}          
3366  -hide-user-agent -handle-as-image +set-image-blocker{pattern} -limit-connect       
3367  +prevent-compression +session-cookies-only -prevent-reading-cookies                
3368  -prevent-setting-cookies -kill-popups -send-vanilla-wafer -send-wafer }            
3369 /                                                                                   
3370                                                                                     
3371  { -session-cookies-only }                                                          
3372  .google.com                                                                        
3373                                                                                     
3374  { -fast-redirects }                                                                
3375  .google.com                                                                        
3376                                                                                     
3377 --- File user ---                                                                   
3378 (no matches in this file)                                                           
3379
3380 This tells us how we have defined our "actions", and which ones match for our
3381 example, "google.com". The first listing is any matches for the standard.action
3382 file. No hits at all here on "standard". Then next is "default", or our
3383 default.action file. The large, multi-line listing, is how the actions are set
3384 to match for all URLs, i.e. our default settings. If you look at your "actions"
3385 file, this would be the section just below the "aliases" section near the top.
3386 This will apply to all URLs as signified by the single forward slash at the end
3387 of the listing -- "/".
3388
3389 But we can define additional actions that would be exceptions to these general
3390 rules, and then list specific URLs (or patterns) that these exceptions would
3391 apply to. Last match wins. Just below this then are two explicit matches for
3392 ".google.com". The first is negating our previous cookie setting, which was for
3393 "+session-cookies-only" (i.e. not persistent). So we will allow persistent
3394 cookies for google. The second turns off any "+fast-redirects" action, allowing
3395 this to take place unmolested. Note that there is a leading dot here --
3396 ".google.com". This will match any hosts and sub-domains, in the google.com
3397 domain also, such as "www.google.com". So, apparently, we have these two
3398 actions defined somewhere in the lower part of our default.action file, and
3399 "google.com" is referenced somewhere in these latter sections.
3400
3401 Then, for our user.action file, we again have no hits.
3402
3403 And finally we pull it all together in the bottom section and summarize how
3404 Privoxy is applying all its "actions" to "google.com": 
3405
3406  Final results:                                                                    
3407  -add-header -block +deanimate-gifs{last} -downgrade-http-version -fast-redirects  
3408  -filter{popups} -filter{fun} -filter{shockwave-flash} -filter{crude-parental}     
3409  +filter{html-annoyances} +filter{js-annoyances} +filter{content-cookies}          
3410  +filter{webbugs} +filter{refresh-tags} +filter{nimda} +filter{banners-by-size}    
3411  +hide-forwarded-for-headers +hide-from-header{block} +hide-referer{forge}         
3412  -hide-user-agent -handle-as-image +set-image-blocker{pattern} -limit-connect      
3413  +prevent-compression -session-cookies-only -prevent-reading-cookies               
3414  -prevent-setting-cookies -kill-popups -send-vanilla-wafer -send-wafer             
3415
3416 Notice the only difference here to the previous listing, is to "fast-redirects"
3417 and "session-cookies-only".
3418
3419 Now another example, "ad.doubleclick.net":
3420
3421  { +block +handle-as-image }                                                   
3422   .ad.doubleclick.net                                                          
3423                                                                                
3424  { +block +handle-as-image }                                                   
3425   ad*.                                                                         
3426                                                                                
3427  { +block +handle-as-image }                                                   
3428   .doubleclick.net                                                             
3429
3430 We'll just show the interesting part here, the explicit matches. It is matched
3431 three different times. Each as an "+block +handle-as-image", which is the
3432 expanded form of one of our aliases that had been defined as: "+imageblock". (
3433 "Aliases" are defined in the first section of the actions file and typically
3434 used to combine more than one action.)
3435
3436 Any one of these would have done the trick and blocked this as an unwanted
3437 image. This is unnecessarily redundant since the last case effectively would
3438 also cover the first. No point in taking chances with these guys though ;-)
3439 Note that if you want an ad or obnoxious URL to be invisible, it should be
3440 defined as "ad.doubleclick.net" is done here -- as both a "+block" and an 
3441 "+handle-as-image". The custom alias "+imageblock" just simplifies the process
3442 and make it more readable.
3443
3444 One last example. Let's try "http://www.rhapsodyk.net/adsl/HOWTO/". This one is
3445 giving us problems. We are getting a blank page. Hmmm...
3446
3447  Matches for http://www.rhapsodyk.net/adsl/HOWTO/:                                   
3448                                                                                      
3449  { -add-header -block +deanimate-gifs -downgrade-http-version +fast-redirects        
3450    +filter{html-annoyances} +filter{js-annoyances} +filter{kill-popups}              
3451    +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}             
3452    +filter{fun} +hide-forwarded-for-headers +hide-from-header{block}                 
3453    +hide-referer{forge} -hide-user-agent -handle-as-image +set-image-blocker{blank}  
3454    +prevent-compression +session-cookies-only -prevent-setting-cookies               
3455    -prevent-reading-cookies +kill-popups -send-vanilla-wafer -send-wafer }           
3456    /                                                                                 
3457                                                                                      
3458  { +block +handle-as-image }                                                         
3459   /ads                                                                               
3460
3461 Ooops, the "/adsl/" is matching "/ads"! But we did not want this at all! Now we
3462 see why we get the blank page. We could now add a new action below this that
3463 explicitly does not block ("{-block}") paths with "adsl". There are various
3464 ways to handle such exceptions. Example:
3465
3466  { -block }                                                                    
3467   /adsl                                                                        
3468
3469 Now the page displays ;-) Be sure to flush your browser's caches when making
3470 such changes. Or, try using Shift+Reload.
3471
3472 But now what about a situation where we get no explicit matches like we did
3473 with:
3474
3475  { +block +handle-as-image }                                                   
3476  /ads                                                                          
3477
3478 That actually was very telling and pointed us quickly to where the problem was.
3479 If you don't get this kind of match, then it means one of the default rules in
3480 the first section is causing the problem. This would require some guesswork,
3481 and maybe a little trial and error to isolate the offending rule. One likely
3482 cause would be one of the "{+filter}" actions. Try adding the URL for the site
3483 to one of aliases that turn off "+filter":
3484
3485  {shop}                                                                        
3486  .quietpc.com                                                                  
3487  .worldpay.com   # for quietpc.com                                             
3488  .jungle.com                                                                   
3489  .scan.co.uk                                                                   
3490  .forbes.com                                                                   
3491
3492 "{shop}" is an "alias" that expands to "{ -filter -session-cookies-only }". Or
3493 you could do your own exception to negate filtering: 
3494
3495  {-filter}                                                                     
3496  .forbes.com                                                                   
3497
3498 This would probably be most appropriately put in user.action, for local site
3499 exceptions.
3500
3501 "{fragile}" is an alias that disables most actions. This can be used as a last
3502 resort for problem sites. Remember to flush caches! If this still does not
3503 work, you will have to go through the remaining actions one by one to find
3504 which one(s) is causing the problem.
3505