be33d37a9b2c78e87263122fa27d7aa3c40ef38e
[privoxy.git] / doc / text / user-manual.txt
1 Privoxy 2.9.18 User Manual
2
3 Copyright © 2001, 2002 by Privoxy Developers
4
5 $Id: user-manual.sgml,v 1.123.2.14 2002/08/06 09:16:13 oes Exp $
6
7
8 The User Manual gives users information on how to install, configure and use 
9 Privoxy.
10
11 Privoxy is a web proxy with advanced filtering capabilities for protecting
12 privacy, filtering web page content, managing cookies, controlling access, and
13 removing ads, banners, pop-ups and other obnoxious Internet junk. Privoxy has a
14 very flexible configuration and can be customized to suit individual needs and
15 tastes. Privoxy has application for both stand-alone systems and multi-user
16 networks.
17
18 Privoxy is based on Internet Junkbuster (tm).
19
20 You can find the latest version of the User Manual at http://www.privoxy.org/
21 user-manual/. Please see the Contact section on how to contact the developers.
22
23 -------------------------------------------------------------------------------
24 Table of Contents
25 1. Introduction
26     1.1. Features
27    
28    
29 2. Installation
30     2.1. Binary Packages
31         2.1.1. Red Hat, SuSE and Conectiva RPMs
32         2.1.2. Debian
33         2.1.3. Windows
34         2.1.4. Solaris, NetBSD, FreeBSD, HP-UX
35         2.1.5. OS/2
36         2.1.6. Mac OSX
37         2.1.7. AmigaOS
38         2.1.8. Gentoo
39        
40        
41     2.2. Building from Source
42     2.3. Keeping your Installation Up-to-Date
43    
44    
45 3. Note to Upgraders
46 4. Quickstart to Using Privoxy
47     4.1. Quickstart to Ad Blocking
48    
49    
50 5. Starting Privoxy
51     5.1. Red Hat and Conectiva
52     5.2. Debian
53     5.3. SuSE
54     5.4. Windows
55     5.5. Solaris, NetBSD, FreeBSD, HP-UX and others
56     5.6. OS/2
57     5.7. Mac OSX
58     5.8. AmigaOS
59     5.9. Gentoo
60     5.10. Command Line Options
61    
62    
63 6. Privoxy Configuration
64     6.1. Controlling Privoxy with Your Web Browser
65     6.2. Configuration Files Overview
66    
67    
68 7. The Main Configuration File
69     7.1. Configuration and Log File Locations
70         7.1.1. confdir
71         7.1.2. logdir
72         7.1.3. actionsfile
73         7.1.4. filterfile
74         7.1.5. logfile
75         7.1.6. jarfile
76         7.1.7. trustfile
77        
78        
79     7.2. Local Set-up Documentation
80         7.2.1. user-manual
81         7.2.2. trust-info-url
82         7.2.3. admin-address
83         7.2.4. proxy-info-url
84        
85        
86     7.3. Debugging
87         7.3.1. debug
88         7.3.2. single-threaded
89        
90        
91     7.4. Access Control and Security
92         7.4.1. listen-address
93         7.4.2. toggle
94         7.4.3. enable-remote-toggle
95         7.4.4. enable-edit-actions
96         7.4.5. ACLs: permit-access and deny-access
97         7.4.6. buffer-limit
98        
99        
100     7.5. Forwarding
101         7.5.1. forward
102         7.5.2. forward-socks4 and forward-socks4a
103         7.5.3. Advanced Forwarding Examples
104        
105        
106     7.6. Windows GUI Options
107    
108    
109 8. Actions Files
110     8.1. Finding the Right Mix
111     8.2. How to Edit
112     8.3. How Actions are Applied to URLs
113     8.4. Patterns
114         22 
115         8.4.1. The Domain Pattern
116         8.4.2. The Path Pattern
117        
118        
119     8.5. Actions
120         8.5.1. add-header
121         8.5.2. block
122         8.5.3. crunch-incoming-cookies
123         8.5.4. crunch-outgoing-cookies
124         8.5.5. deanimate-gifs
125         8.5.6. downgrade-http-version
126         8.5.7. fast-redirects
127         8.5.8. filter
128         8.5.9. handle-as-image
129         8.5.10. hide-forwarded-for-headers
130         8.5.11. hide-from-header
131         8.5.12. hide-referrer
132         8.5.13. hide-user-agent
133         8.5.14. kill-popups
134         8.5.15. limit-connect
135         8.5.16. prevent-compression
136         8.5.17. send-vanilla-wafer
137         8.5.18. send-wafer
138         8.5.19. session-cookies-only
139         8.5.20. set-image-blocker
140         8.5.21. Summary
141        
142        
143     8.6. Aliases
144     8.7. Actions Files Tutorial
145         8.7.1. default.action
146         8.7.2. user.action
147        
148        
149    
150    
151 9. The Filter File
152     9.1. Filter File Tutorial
153    
154    
155 10. Templates
156 11. Contacting the Developers, Bug Reporting and Feature Requests
157     11.1. Get Support
158     11.2. Report Bugs
159     11.3. Request New Features
160     11.4. Report Ads or Other Actions-Related Problems
161     11.5. Other
162    
163    
164 12. Privoxy Copyright, License and History
165     12.1. License
166     12.2. History
167     12.3. Authors
168    
169    
170 13. See Also
171 14. Appendix
172     14.1. Regular Expressions
173     14.2. Privoxy's Internal Pages
174         14.2.1. Bookmarklets
175        
176        
177     14.3. Chain of Events
178     14.4. Anatomy of an Action
179    
180    
181
182 1. Introduction
183
184 This documentation is included with the current beta version of Privoxy,
185 v.2.9.18, and is mostly complete at this point. The most up to date reference
186 for the time being is still the comments in the source files and in the
187 individual configuration files. Development of version 3.0 is currently nearing
188 completion, and includes many significant changes and enhancements over earlier
189 versions. The target release date for stable v3.0 is "soon" ;-).
190
191 Since this is a beta version, not all new features are well tested. This
192 documentation may be slightly out of sync as a result (especially with CVS
193 sources). And there may be bugs, though hopefully not many!
194 -------------------------------------------------------------------------------
195
196 1.1. Features
197
198 In addition to Internet Junkbuster's traditional features of ad and banner
199 blocking and cookie management, Privoxy provides new features, some of them
200 currently under development:
201
202   * Integrated browser based configuration and control utility at http://
203     config.privoxy.org/ (shortcut: http://p.p/). Browser-based tracing of rule
204     and filter effects. Remote toggling.
205    
206   * Web page content filtering (removes banners based on size, invisible 
207     "web-bugs", JavaScript and HTML annoyances, pop-up windows, etc.)
208    
209   * Modularized configuration that allows for standard settings and user
210     settings to reside in separate files, so that installing updated actions
211     files won't overwrite individual user settings.
212    
213   * HTTP/1.1 compliant (but not all optional 1.1 features are supported).
214    
215   * Support for Perl Compatible Regular Expressions in the configuration files,
216     and generally a more sophisticated and flexible configuration syntax over
217     previous versions.
218    
219   * Improved cookie management features (e.g. session based cookies).
220    
221   * GIF de-animation.
222    
223   * Bypass many click-tracking scripts (avoids script redirection).
224    
225   * Multi-threaded (POSIX and native threads).
226    
227   * User-customizable HTML templates for all proxy-generated pages (e.g.
228     "blocked" page).
229    
230   * Auto-detection and re-reading of config file changes.
231    
232   * Improved signal handling, and a true daemon mode (Unix).
233    
234   * Every feature now controllable on a per-site or per-location basis,
235     configuration more powerful and versatile over-all.
236    
237   * Many smaller new features added, limitations and bugs removed, and security
238     holes fixed.
239    
240
241 -------------------------------------------------------------------------------
242 2. Installation
243
244 Privoxy is available both in convenient pre-compiled packages for a wide range
245 of operating systems, and as raw source code. For most users, we recommend
246 using the packages, which can be downloaded from our Privoxy Project Page.
247
248 Note: If you have a previous Junkbuster or Privoxy installation on your system,
249 you will need to remove it. On some platforms, this may be done for you as part
250 of their installation procedure. (See below for your platform). In any case be
251 sure to backup your old configuration if it is valuable to you. See the note to
252 upgraders section below.
253 -------------------------------------------------------------------------------
254
255 2.1. Binary Packages
256
257 How to install the binary packages depends on your operating system:
258 -------------------------------------------------------------------------------
259
260 2.1.1. Red Hat, SuSE and Conectiva RPMs
261
262 RPMs can be installed with rpm -Uvh privoxy-2.9.18-1.rpm, and will use /etc/
263 privoxy for the location of configuration files.
264
265 Note that on Red Hat, Privoxy will not be automatically started on system boot.
266 You will need to enable that using chkconfig, ntsysv, or similar methods. Note
267 that SuSE will automatically start Privoxy in the boot process.
268
269 If you have problems with failed dependencies, try rebuilding the SRC RPM: rpm
270 --rebuild privoxy-2.9.18-1.src.rpm. This will use your locally installed
271 libraries and RPM version.
272
273 Also note that if you have a Junkbuster RPM installed on your system, you need
274 to remove it first, because the packages conflict. Otherwise, RPM will try to
275 remove Junkbuster automatically, before installing Privoxy.
276 -------------------------------------------------------------------------------
277
278 2.1.2. Debian
279
280 DEBs can be installed with dpkg -i privoxy_2.9.18-1.deb, and will use /etc/
281 privoxy for the location of configuration files.
282 -------------------------------------------------------------------------------
283
284 2.1.3. Windows
285
286 Just double-click the installer, which will guide you through the installation
287 process. You will find the configuration files in the same directory as you
288 installed Privoxy in. We do not use the registry of Windows.
289 -------------------------------------------------------------------------------
290
291 2.1.4. Solaris, NetBSD, FreeBSD, HP-UX
292
293 Create a new directory, cd to it, then unzip and untar the archive. For the
294 most part, you'll have to figure out where things go.
295 -------------------------------------------------------------------------------
296
297 2.1.5. OS/2
298
299 First, make sure that no previous installations of Junkbuster and / or Privoxy
300 are left on your system. Check that no Junkbuster or Privoxy objects are in
301 your startup folder. 
302
303 Then, just double-click the WarpIN self-installing archive, which will guide
304 you through the installation process. A shadow of the Privoxy executable will
305 be placed in your startup folder so it will start automatically whenever OS/2
306 starts.
307
308 The directory you choose to install Privoxy into will contain all of the
309 configuration files.
310 -------------------------------------------------------------------------------
311
312 2.1.6. Mac OSX
313
314 Unzip the downloaded package (you can either double-click on the file in the
315 finder, or on the desktop if you downloaded it there). The Privoxy.pkg package
316 should appear after unzipping. Then, double-click on that Privoxy.pkg package
317 installer icon and follow the installation process. Privoxy will be installed
318 in the folder /Library/Privoxy. It will run automatically whenever you start
319 up. To prevent it from running automatically, remove or rename the folder /
320 Library/StartupItems/Privoxy.
321
322 To run Privoxy by hand, double-click on RunPrivoxy.command. To run Privoxy from
323 Terminal, execute /Library/Privoxy/RunPrivoxy.command.
324 -------------------------------------------------------------------------------
325
326 2.1.7. AmigaOS
327
328 Copy and then unpack the lha archive to a suitable location. All necessary
329 files will be installed into Privoxy directory, including all configuration and
330 log files. To uninstall, just remove this directory.
331 -------------------------------------------------------------------------------
332
333 2.1.8. Gentoo
334
335 Gentoo source packages (Ebuilds) for Privoxy are contained in the Gentoo
336 Portage Tree (they are not on the download page, but there is a Gentoo section,
337 where you can see when a new Privoxy Version is added to the Portage Tree).
338
339 Before installing Privoxy under Gentoo just do first emerge rsync to get the
340 latest changes from the Portage tree. With emerge privoxy you install the
341 latest version.
342
343 Configuration files are in /etc/privoxy, the documentation is in /usr/share/doc
344 /privoxy-2.9.18 and the Log directory is in /var/log/privoxy.
345 -------------------------------------------------------------------------------
346
347 2.2. Building from Source
348
349 The most convenient way to obtain the Privoxy sources is to download the source
350 tarball from our project page.
351
352 If you like to live on the bleeding edge and are not afraid of using possibly
353 unstable development versions, you can check out the up-to-the-minute version
354 directly from the CVS repository or simply download the nightly CVS tarball.
355
356 To build Privoxy from source, autoconf, GNU make (gmake), and, of course, a C
357 compiler like gcc are required.
358
359 When building from a source tarball (either release version or nightly CVS
360 tarball), first unpack the source:
361
362  tar xzvf privoxy-2.9.18-beta-src* [.tgz or .tar.gz]                           
363  cd privoxy-2.9.18-beta                                                        
364
365 For retrieving the current CVS sources, you'll need CVS installed. Note that
366 sources from CVS are development quality, and may not be stable, or well
367 tested. To download CVS source:
368
369   cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login          
370   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current 
371   cd current                                                                         
372
373 This will create a directory named current/, which will contain the source
374 tree.
375
376 Then, in either case, to build from unpacked tarball or CVS source:
377
378  autoheader                                                                    
379  autoconf                                                                      
380  ./configure      # (--help to see options)                                    
381  make             # (the make from gnu, gmake for *BSD)                        
382  su                                                                            
383  make -n install  # (to see where all the files will go)                       
384  make install     # (to really install)                                        
385
386 If you have gnu make, you can have the first four steps automatically done for
387 you by just typing:
388
389   make                                                                         
390
391 in the freshly downloaded or unpacked source directory.
392
393 For more detailed instructions on how to build Redhat and SuSE RPMs, Windows
394 self-extracting installers, building on platforms with special requirements
395 etc, please consult the developer manual.
396 -------------------------------------------------------------------------------
397
398 2.3. Keeping your Installation Up-to-Date
399
400 As user feedback comes in and development continues, we will make updated
401 versions of both the main actions file (as a separate package) and the software
402 itself (including the actions file) available for download.
403
404 If you wish to receive an email notification whenever we release updates of 
405 Privoxy or the actions file, subscribe to our announce mailing list,
406 ijbswa-announce@lists.sourceforge.net.
407
408 In order not to loose your personal changes and adjustments when updating to
409 the latest default.action file we strongly recommend that you use user.action
410 for your customization of Privoxy. See the Chapter on actions files for
411 details.
412 -------------------------------------------------------------------------------
413
414 3. Note to Upgraders
415
416 There are very significant changes from earlier Junkbuster versions to the
417 current Privoxy. The number, names, syntax, and purposes of configuration files
418 have substantially changed. Junkbuster 2.0.x configuration files will not
419 migrate, Junkbuster 2.9.x and Privoxy configurations will need to be ported.
420 The functionalities of the old blockfile, cookiefile and imagelist are now
421 combined into the "actions files". default.action, is the main actions file.
422 Local exceptions should best be put into user.action.
423
424 A "filter file" (typically default.filter) is new as of Privoxy 2.9.x, and
425 provides some of the new sophistication (explained below). config is much the
426 same as before.
427
428 If upgrading from a 2.0.x version, you will have to use the new config files,
429 and possibly adapt any personal rules from your older files. When porting
430 personal rules over from the old blockfile to the new actions files, please
431 note that even the pattern syntax has changed. If upgrading from 2.9.x
432 development versions, it is still recommended to use the new configuration
433 files.
434
435 A quick list of things to be aware of before upgrading:
436
437   * The default listening port is now 8118 due to a conflict with another
438     service (NAS).
439    
440   * Some installers may remove earlier versions completely. Save any important
441     configuration files!
442    
443   * Privoxy is controllable with a web browser at the special URL: http://
444     config.privoxy.org/ (Shortcut: http://p.p/). Many aspects of configuration
445     can be done here, including temporarily disabling Privoxy.
446    
447   * The primary configuration files for cookie management, ad and banner
448     blocking, and many other aspects of Privoxy configuration are the actions
449     files. It is strongly recommended to become familiar with the new actions
450     concept below, before modifying these files. Locally defined rules should
451     go into user.action.
452    
453   * Some installers may not automatically start Privoxy after installation.
454    
455
456 -------------------------------------------------------------------------------
457 4. Quickstart to Using Privoxy
458
459   * If upgrading, from versions before 2.9.16, please back up any configuration
460     files. See the Note to Upgraders Section.
461    
462   * Install Privoxy. See the Installation Section below for platform specific
463     information.
464    
465   * Advanced users and those who want to offer Privoxy service to more than
466     just their local machine should check the main config file, especially the 
467     security-relevant options. These are off by default.
468    
469   * Start Privoxy, if the installation program has not done this already (may
470     vary according to platform). See the section Starting Privoxy.
471    
472   * Set your browser to use Privoxy as HTTP and HTTPS proxy by setting the
473     proxy configuration for address of 127.0.0.1 and port 8118. (Junkbuster and
474     earlier versions of Privoxy used port 8000.) See the section Starting 
475     Privoxy below for more details on this.
476    
477   * Flush your browser's disk and memory caches, to remove any cached ad
478     images.
479    
480   * A default installation should provide a reasonable starting point for most.
481     There will undoubtedly be occasions where you will want to adjust the
482     configuration, but that can be dealt with as the need arises. Little to no
483     initial configuration is required in most cases.
484    
485     See the Configuration section for more configuration options, and how to
486     customize your installation.
487    
488   * If you experience ads that slipped through, innocent images that are
489     blocked, or otherwise feel the need to fine-tune Privoxy's behaviour, take
490     a look at the actions files. As a quick start, you might find the richly
491     commented examples helpful. You can also view and edit the actions files
492     through the web-based user interface. The Appendix "Anatomy of an Action"
493     has hints how to debug actions that "misbehave".
494    
495   * Please see the section Contacting the Developers on how to report bugs or
496     problems with websites or to get help.
497    
498   * Now enjoy surfing with enhanced comfort and privacy!
499    
500
501 -------------------------------------------------------------------------------
502 4.1. Quickstart to Ad Blocking
503
504 Ad blocking is but one of Privoxy's array of features. Many of these features
505 are for the technically minded advanced user. But, ad and banner blocking is
506 surely common ground for everybody.
507
508 This section will provide a quick summary of ad blocking so you can get up to
509 speed quickly without having to read the more extensive information provided
510 below, though this is highly recommended.
511
512 First a bit of a warning ... blocking ads is much like blocking SPAM: the more
513 aggressive you are about it, the more likely you are to block things that were
514 not intended. So there is a trade off here. If you want extreme ad free
515 browsing, be prepared to deal with more "problem" sites, and to spend more time
516 adjusting the configuration to solve these unintended consequences. In short,
517 there is not an easy way to eliminate all ads. Either take the easy way and
518 settle for most ads blocked with the default configuration, or jump in and
519 tweak it for your personal surfing habits and preferences.
520
521 Secondly, a brief explanation of Privoxy's "actions". "Actions" in this
522 context, are the directives we use to tell Privoxy to perform some task
523 relating to HTTP transactions (i.e. web browsing). We tell Privoxy to take some
524 "action". Each action has a unique name and function. While there are many
525 potential actions in Privoxy's arsenal, only a few are used for ad blocking. 
526 Actions, and action configuration files, are explained in depth below.
527
528 Actions are specified in Privoxy's configuration, followed by one or more URLs
529 to which the action should apply. URLs can actually be URL type patterns that
530 use wildcards so they can apply potentially to a range of similar URLs. The
531 actions, together with the URL patterns are called a section.
532
533 When you connect to a website, the full URL will either match one or more of
534 the sections as defined in Privoxy's configuration, or not. If so, then Privoxy
535 will perform the respective actions. If not, then nothing special happens.
536 Furthermore, web pages may contain embedded, secondary URLs that your web
537 browser will use to load additional components of the page, as it parses the
538 original page's HTML content. An ad image for instance, is just an URL embedded
539 in the page somewhere. The image itself may be on the same server, or a server
540 somewhere else on the Internet. Complex web pages will have many such embedded
541 URLs.
542
543 The actions we need to know about for ad blocking are: block, handle-as-image,
544 and set-image-blocker:
545
546   * block - this action stops any contact between your browser and any URL
547     patterns that match this action's configuration. It can be used for
548     blocking ads, but also anything that is determined to be unwanted. By
549     itself, it simply stops any communication with the remote server and sends 
550     Privoxy's own built-in BLOCKED page instead to let you now what has
551     happened.
552    
553   * handle-as-image - tells Privoxy to treat this URL as an image. Privoxy's
554     default configuration already does this for all common image types (e.g.
555     GIF), but there are many situations where this is not so easy to determine.
556     So we'll force it in these cases. This is particularly important for ad
557     blocking, since only if we know that it's an image of some kind, can we
558     replace it with an image of our choosing, instead of the Privoxy BLOCKED
559     page (which would only result in a "broken image" icon). There are some
560     limitations to this though. For instance, you can't just brute-force an
561     image substitution for an entire HTML page in most situations.
562    
563   * set-image-blocker - tells Privoxy what to display in place of an ad image
564     that has hit a block rule. For this to come into play, the URL must match a
565     block action somewhere in the configuration, and, it must also match an 
566     handle-as-image action.
567    
568     The configuration options on what to display instead of the ad are:
569    
570        pattern - a checkerboard pattern, so that an ad replacement is obvious. 
571     This is the default.                                                       
572    
573        blank - A very small empty GIF image is displayed. This is the so-called
574     "invisible" configuration option.                                          
575    
576        http://<URL> - A redirect to any image anywhere of the user's choosing  
577     (advanced usage).                                                          
578    
579    
580
581 The quickest way to adjust any of these settings is with your browser through
582 the special Privoxy editor at http://config.privoxy.org/show-status (shortcut: 
583 http://p.p/show-status). This is an internal page, and does not require
584 Internet access. Select the appropriate "actions" file, and click "Edit". It is
585 best to put personal or local preferences in user.action since this is not
586 meant to be overwritten during upgrades, and will over-ride the settings in
587 other files. Here you can insert new "actions", and URLs for ad blocking or
588 other purposes, and make other adjustments to the configuration. Privoxy will
589 detect these changes automatically.
590
591 A quick and simple step by step example:
592
593   * Right click on the ad image to be blocked, then select "Copy Link Location"
594     from the pop-up menu.
595    
596   * Set your browser to http://config.privoxy.org/show-status
597    
598   * Find user.action in the top section, and click on "Edit":
599    
600     Figure 1. Actions Files in Use
601    
602     [ Screenshot of Actions Files in Use ]
603    
604   * You should have a section with only block listed under "Actions:". If not,
605     click a "Insert new section below" button, and in the new section that just
606     appeared, click the Edit button right under the word "Actions:". This will
607     bring up a list of all actions. Find block near the top, and click in the 
608     "Enabled" column, then "Submit" just below the list.
609    
610   * Now, in the block actions section, click the "Add" button, and paste the
611     URL the browser got from "Copy Link Location". Remove the http:// at the
612     beginning of the URL. Then, click "Submit" (or "OK" if in a pop-up window).
613    
614   * Now go back to the original page, and press SHIFT-Reload (or flush all
615     browser caches). The image should be gone now.
616    
617
618 This is a very crude and simple example. There might be good reasons to use a
619 wildcard pattern match to include potentially similar images from the same
620 site. For a more extensive explanation of "patterns", and the entire actions
621 concept, see the Actions section.
622
623 For advanced users who want to hand edit their config files, you might want to
624 now go to the Actions Files Tutorial. The ideas explained therein also apply to
625 the web-based editor.
626 -------------------------------------------------------------------------------
627
628 5. Starting Privoxy
629
630 Before launching Privoxy for the first time, you will want to configure your
631 browser(s) to use Privoxy as a HTTP and HTTPS proxy. The default is 127.0.0.1
632 (or localhost) for the proxy address, and port 8118 (earlier versions used port
633 8000). This is the one configuration step that must be done!
634
635 Please note that Privoxy can only proxy HTTP and HTTPS traffic. It will not
636 work with FTP or other protocols.
637
638 Figure 2. Proxy Configuration (Mozilla)
639
640 [ Screenshot of Mozilla Proxy Configuration ]
641
642 With Netscape (and Mozilla), this can be set under:
643
644  Edit
645    |_   
646          Preferences
647                 |_       
648                         Advanced
649                               |_     
650                                     Proxies
651                                          |_       
652                                                 HTTP Proxy
653
654 For Internet Explorer:
655
656  Tools
657      |_   
658          Internet Properties
659                             |_       
660                                       Connections
661                                                |_     
662                                                             LAN Settings
663
664 Then, check "Use Proxy" and fill in the appropriate info (Address: 127.0.0.1,
665 Port: 8118). Include HTTPS (SSL), if you want HTTPS proxy support too.
666
667 After doing this, flush your browser's disk and memory caches to force a
668 re-reading of all pages and to get rid of any ads that may be cached. You are
669 now ready to start enjoying the benefits of using Privoxy!
670
671 Privoxy is typically started by specifying the main configuration file to be
672 used on the command line. If no configuration file is specified on the command
673 line, Privoxy will look for a file named config in the current directory.
674 Except on Win32 where it will try config.txt.
675 -------------------------------------------------------------------------------
676
677 5.1. Red Hat and Conectiva
678
679 We use a script. Note that Red Hat does not start Privoxy upon booting per
680 default. It will use the file /etc/privoxy/config as its main configuration
681 file.
682
683  # /etc/rc.d/init.d/privoxy start                                              
684 -------------------------------------------------------------------------------
685
686 5.2. Debian
687
688 We use a script. Note that Debian starts Privoxy upon booting per default. It
689 will use the file /etc/privoxy/config as its main configuration file.
690
691  # /etc/init.d/privoxy start                                                   
692 -------------------------------------------------------------------------------
693
694 5.3. SuSE
695
696 We use a script. It will use the file /etc/privoxy/config as its main
697 configuration file. Note that SuSE starts Privoxy upon booting your PC.
698
699  # rcprivoxy start                                                             
700 -------------------------------------------------------------------------------
701
702 5.4. Windows
703
704 Click on the Privoxy Icon to start Privoxy. If no configuration file is
705 specified on the command line, Privoxy will look for a file named config.txt.
706 Note that Windows will automatically start Privoxy upon booting you PC.
707 -------------------------------------------------------------------------------
708
709 5.5. Solaris, NetBSD, FreeBSD, HP-UX and others
710
711 Example Unix startup command:
712
713  # /usr/sbin/privoxy /etc/privoxy/config                                       
714 -------------------------------------------------------------------------------
715
716 5.6. OS/2
717
718 During installation, Privoxy is configured to start automatically when the
719 system restarts. You can start it manually by double-clicking on the Privoxy
720 icon in the Privoxy folder.
721 -------------------------------------------------------------------------------
722
723 5.7. Mac OSX
724
725 During installation, Privoxy is configured to start automatically when the
726 system restarts. To run Privoxy by hand, double-click on the RunPrivoxy.command
727 icon in the /Library/Privoxy folder. Or, type this command in the Terminal:
728
729   /Library/Privoxy/RunPrivoxy.command                                          
730                                                                                
731
732 If you are not logged in as an administrator, you will be asked for the
733 administrator password when starting Privoxy by hand.
734 -------------------------------------------------------------------------------
735
736 5.8. AmigaOS
737
738 Start Privoxy (with RUN <>NIL:) in your startnet script (AmiTCP), in s:
739 user-startup (RoadShow), as startup program in your startup script (Genesis),
740 or as startup action (Miami and MiamiDx). Privoxy will automatically quit when
741 you quit your TCP/IP stack (just ignore the harmless warning your TCP/IP stack
742 may display that Privoxy is still running).
743 -------------------------------------------------------------------------------
744
745 5.9. Gentoo
746
747 A script is again used. It will use the file /etc/privoxy/config as its main
748 configuration file.
749
750  /etc/init.d/privoxy start                                                     
751                                                                                
752
753 Note that Privoxy is not automatically started at boot time by default. You can
754 change this with the rc-update command.
755
756  rc-update add privoxy default                                                 
757                                                                                
758 -------------------------------------------------------------------------------
759
760 5.10. Command Line Options
761
762 Privoxy may be invoked with the following command-line options:
763
764   * --version
765    
766     Print version info and exit. Unix only.
767    
768   * --help
769    
770     Print short usage info and exit. Unix only.
771    
772   * --no-daemon
773    
774     Don't become a daemon, i.e. don't fork and become process group leader, and
775     don't detach from controlling tty. Unix only.
776    
777   * --pidfile FILE
778    
779     On startup, write the process ID to FILE. Delete the FILE on exit. Failure
780     to create or delete the FILE is non-fatal. If no FILE option is given, no
781     PID file will be used. Unix only.
782    
783   * --user USER[.GROUP]
784    
785     After (optionally) writing the PID file, assume the user ID of USER, and if
786     included the GID of GROUP. Exit if the privileges are not sufficient to do
787     so. Unix only.
788    
789   * configfile
790    
791     If no configfile is included on the command line, Privoxy will look for a
792     file named "config" in the current directory (except on Win32 where it will
793     look for "config.txt" instead). Specify full path to avoid confusion. If no
794     config file is found, Privoxy will fail to start.
795    
796
797 -------------------------------------------------------------------------------
798 6. Privoxy Configuration
799
800 All Privoxy configuration is stored in text files. These files can be edited
801 with a text editor. Many important aspects of Privoxy can also be controlled
802 easily with a web browser.
803 -------------------------------------------------------------------------------
804
805 6.1. Controlling Privoxy with Your Web Browser
806
807 Privoxy's user interface can be reached through the special URL http://
808 config.privoxy.org/ (shortcut: http://p.p/), which is a built-in page and works
809 without Internet access. You will see the following section: 
810      Privoxy Menu                                                              
811         ??  View & change the current configuration                            
812         ??  View the source code version numbers                               
813         ??  View the request headers.                                          
814         ??  Look up which actions apply to a URL and why                       
815         ??  Toggle Privoxy on or off                                           
816
817 This should be self-explanatory. Note the first item leads to an editor for the
818 actions files, which is where the ad, banner, cookie, and URL blocking magic is
819 configured as well as other advanced features of Privoxy. This is an easy way
820 to adjust various aspects of Privoxy configuration. The actions file, and other
821 configuration files, are explained in detail below.
822
823 "Toggle Privoxy On or Off" is handy for sites that might have problems with
824 your current actions and filters. You can in fact use it as a test to see
825 whether it is Privoxy causing the problem or not. Privoxy continues to run as a
826 proxy in this case, but all manipulation is disabled, i.e. Privoxy acts like a
827 normal forwarding proxy. There is even a toggle Bookmarklet offered, so that
828 you can toggle Privoxy with one click from your browser.
829 -------------------------------------------------------------------------------
830
831 6.2. Configuration Files Overview
832
833 For Unix, *BSD and Linux, all configuration files are located in /etc/privoxy/
834 by default. For MS Windows, OS/2, and AmigaOS these are all in the same
835 directory as the Privoxy executable. The name and number of configuration files
836 has changed from previous versions, and is subject to change as development
837 progresses.
838
839 The installed defaults provide a reasonable starting point, though some
840 settings may be aggressive by some standards. For the time being, the principle
841 configuration files are:
842
843   * The main configuration file is named config on Linux, Unix, BSD, OS/2, and
844     AmigaOS and config.txt on Windows. This is a required file.
845    
846   * default.action (the main actions file) is used to define which "actions"
847     relating to banner-blocking, images, pop-ups, content modification, cookie
848     handling etc should be applied by default. It also defines many exceptions
849     (both positive and negative) from this default set of actions that enable 
850     Privoxy to selectively eliminate the junk, and only the junk, on as many
851     websites as possible.
852    
853     Multiple actions files may be defined in config. These are processed in the
854     order they are defined. Local customizations and locally preferred
855     exceptions to the default policies as defined in default.action (which you
856     will most probably want to define sooner or later) are probably best
857     applied in user.action, where you can preserve them across upgrades.
858     standard.action is for Privoxy's internal use.
859    
860     There is also a web based editor that can be accessed from http://
861     config.privoxy.org/show-status (Shortcut: http://p.p/show-status) for the
862     various actions files.
863    
864   * default.filter (the filter file) can be used to re-write the raw page
865     content, including viewable text as well as embedded HTML and JavaScript,
866     and whatever else lurks on any given web page. The filtering jobs are only
867     pre-defined here; whether to apply them or not is up to the actions files.
868    
869
870 All files use the "#" character to denote a comment (the rest of the line will
871 be ignored) and understand line continuation through placing a backslash ("\")
872 as the very last character in a line. If the # is preceded by a backslash, it
873 looses its special function. Placing a # in front of an otherwise valid
874 configuration line to prevent it from being interpreted is called "commenting
875 out" that line.
876
877 The actions files and default.filter can use Perl style regular expressions for
878 maximum flexibility.
879
880 After making any changes, there is no need to restart Privoxy in order for the
881 changes to take effect. Privoxy detects such changes automatically. Note,
882 however, that it may take one or two additional requests for the change to take
883 effect. When changing the listening address of Privoxy, these "wake up"
884 requests must obviously be sent to the old listening address.
885
886 While under development, the configuration content is subject to change. The
887 below documentation may not be accurate by the time you read this. Also, what
888 constitutes a "default" setting, may change, so please check all your
889 configuration files on important issues.
890 -------------------------------------------------------------------------------
891
892 7. The Main Configuration File
893
894 Again, the main configuration file is named config on Linux/Unix/BSD and OS/2,
895 and config.txt on Windows. Configuration lines consist of an initial keyword
896 followed by a list of values, all separated by whitespace (any number of spaces
897 or tabs). For example:
898
899   confdir /etc/privoxy
900
901 Assigns the value /etc/privoxy to the option confdir and thus indicates that
902 the configuration directory is named "/etc/privoxy/".
903
904 All options in the config file except for confdir and logdir are optional.
905 Watch out in the below description for what happens if you leave them unset.
906
907 The main config file controls all aspects of Privoxy's operation that are not
908 location dependent (i.e. they apply universally, no matter where you may be
909 surfing).
910 -------------------------------------------------------------------------------
911
912 7.1. Configuration and Log File Locations
913
914 Privoxy can (and normally does) use a number of other files for additional
915 configuration, help and logging. This section of the configuration file tells 
916 Privoxy where to find those other files.
917
918 The user running Privoxy, must have read permission for all configuration
919 files, and write permission to any files that would be modified, such as log
920 files and actions files.
921 -------------------------------------------------------------------------------
922
923 7.1.1. confdir
924
925 Specifies:
926     The directory where the other configuration files are located
927    
928 Type of value:
929     Path name
930    
931 Default value:
932     /etc/privoxy (Unix) or Privoxy installation dir (Windows)
933    
934 Effect if unset:
935     Mandatory
936    
937 Notes:
938     No trailing "/", please
939    
940     When development goes modular and multi-user, the blocker, filter, and
941     per-user config will be stored in subdirectories of "confdir". For now, the
942     configuration directory structure is flat, except for confdir/templates,
943     where the HTML templates for CGI output reside (e.g. Privoxy's 404 error
944     page).
945    
946
947 -------------------------------------------------------------------------------
948 7.1.2. logdir
949
950 Specifies:
951     The directory where all logging takes place (i.e. where logfile and jarfile
952     are located)
953    
954 Type of value:
955     Path name
956    
957 Default value:
958     /var/log/privoxy (Unix) or Privoxy installation dir (Windows)
959    
960 Effect if unset:
961     Mandatory
962    
963 Notes:
964     No trailing "/", please
965    
966
967 -------------------------------------------------------------------------------
968 7.1.3. actionsfile
969
970 Specifies:
971     The actions file(s) to use
972    
973 Type of value:
974     File name, relative to confdir, without the .action suffix
975    
976 Default values:
977       standard     # Internal purposes, no editing recommended
978       default      # Main actions file                        
979       user         # User customizations                      
980    
981    
982 Effect if unset:
983     No actions are taken at all. Simple neutral proxying.
984    
985 Notes:
986     Multiple actionsfile lines are permitted, and are in fact recommended!
987    
988     The default values include standard.action, which is used for internal
989     purposes and should be loaded, default.action, which is the "main" actions
990     file maintained by the developers, and user.action, where you can make your
991     personal additions.
992    
993     Actions files are where all the per site and per URL configuration is done
994     for ad blocking, cookie management, privacy considerations, etc. There is
995     no point in using Privoxy without at least one actions file.
996    
997
998 -------------------------------------------------------------------------------
999 7.1.4. filterfile
1000
1001 Specifies:
1002     The filter file to use
1003    
1004 Type of value:
1005     File name, relative to confdir
1006    
1007 Default value:
1008     default.filter (Unix) or default.filter.txt (Windows)
1009    
1010 Effect if unset:
1011     No textual content filtering takes place, i.e. all +filter{name} actions in
1012     the actions files are turned neutral.
1013    
1014 Notes:
1015     The filter file contains content modification rules that use regular
1016     expressions. These rules permit powerful changes on the content of Web
1017     pages, e.g., you could disable your favorite JavaScript annoyances,
1018     re-write the actual displayed text, or just have some fun replacing 
1019     "Microsoft" with "MicroSuck" wherever it appears on a Web page.
1020    
1021     The +filter{name} actions rely on the relevant filter (name) to be defined
1022     in the filter file!
1023    
1024     A pre-defined filter file called default.filter that contains a bunch of
1025     handy filters for common problems is included in the distribution. See the
1026     section on the filter action for a list.
1027    
1028
1029 -------------------------------------------------------------------------------
1030 7.1.5. logfile
1031
1032 Specifies:
1033     The log file to use
1034    
1035 Type of value:
1036     File name, relative to logdir
1037    
1038 Default value:
1039     logfile (Unix) or privoxy.log (Windows)
1040    
1041 Effect if unset:
1042     No log file is used, all log messages go to the console (STDERR).
1043    
1044 Notes:
1045     The windows version will additionally log to the console.
1046    
1047     The logfile is where all logging and error messages are written. The level
1048     of detail and number of messages are set with the debug option (see below).
1049     The logfile can be useful for tracking down a problem with Privoxy (e.g.,
1050     it's not blocking an ad you think it should block) but in most cases you
1051     probably will never look at it.
1052    
1053     Your logfile will grow indefinitely, and you will probably want to
1054     periodically remove it. On Unix systems, you can do this with a cron job
1055     (see "man cron"). For Red Hat, a logrotate script has been included.
1056    
1057     On SuSE Linux systems, you can place a line like "/var/log/privoxy.* +1024k
1058     644 nobody.nogroup" in /etc/logfiles, with the effect that cron.daily will
1059     automatically archive, gzip, and empty the log, when it exceeds 1M size.
1060    
1061     Any log files must be writable by whatever user Privoxy is being run as
1062     (default on UNIX, user id is "privoxy").
1063    
1064
1065 -------------------------------------------------------------------------------
1066 7.1.6. jarfile
1067
1068 Specifies:
1069     The file to store intercepted cookies in
1070    
1071 Type of value:
1072     File name, relative to logdir
1073    
1074 Default value:
1075     jarfile (Unix) or privoxy.jar (Windows)
1076    
1077 Effect if unset:
1078     Intercepted cookies are not stored at all.
1079    
1080 Notes:
1081     The jarfile may grow to ridiculous sizes over time.
1082    
1083
1084 -------------------------------------------------------------------------------
1085 7.1.7. trustfile
1086
1087 Specifies:
1088     The trust file to use
1089    
1090 Type of value:
1091     File name, relative to confdir
1092    
1093 Default value:
1094     Unset (commented out). When activated: trust (Unix) or trust.txt (Windows)
1095    
1096 Effect if unset:
1097     The whole trust mechanism is turned off.
1098    
1099 Notes:
1100     The trust mechanism is an experimental feature for building white-lists and
1101     should be used with care. It is NOT recommended for the casual user.
1102    
1103     If you specify a trust file, Privoxy will only allow access to sites that
1104     are named in the trustfile. You can also mark sites as trusted referrers
1105     (with +), with the effect that access to untrusted sites will be granted,
1106     if a link from a trusted referrer was used. The link target will then be
1107     added to the "trustfile". Possible applications include limiting Internet
1108     access for children.
1109    
1110     If you use + operator in the trust file, it may grow considerably over
1111     time.
1112    
1113
1114 -------------------------------------------------------------------------------
1115 7.2. Local Set-up Documentation
1116
1117 If you intend to operate Privoxy for more users than just yourself, it might be
1118 a good idea to let them know how to reach you, what you block and why you do
1119 that, your policies, etc.
1120 -------------------------------------------------------------------------------
1121
1122 7.2.1. user-manual
1123
1124 Specifies:
1125     Location of the Privoxy User Manual.
1126    
1127 Type of value:
1128     A fully qualified URI
1129    
1130 Default value:
1131     Unset
1132    
1133 Effect if unset:
1134     http://www.privoxy.org/version/user-manual/ will be used, where version is
1135     the Privoxy version.
1136    
1137 Notes:
1138     The User Manual URI is used for help links from some of the internal CGI
1139     pages. The manual itself is normally packaged with the binary
1140     distributions, so you probably want to set this to a locally installed
1141     copy. For multi-user setups, you could provide a copy on a local webserver
1142     for all your users and use the corresponding URL here.
1143    
1144     Examples:
1145    
1146     Unix, in local filesystem:
1147    
1148     user-manual  file:///usr/share/doc/privoxy-2.9.18/user-manual/     
1149    
1150     Any platform, on local webserver (called "local-webserver"):
1151    
1152     user-manual  http://local-webserver/privoxy-user-manual/           
1153    
1154     +-----------------------------------------------------------------+
1155     |                             Warning                             |
1156     +-----------------------------------------------------------------+
1157     |If set, this option should be the first option in the config     |
1158     |file, because it is used while the config file is being read.    |
1159     +-----------------------------------------------------------------+
1160    
1161
1162 -------------------------------------------------------------------------------
1163 7.2.2. trust-info-url
1164
1165 Specifies:
1166     A URL to be displayed in the error page that users will see if access to an
1167     untrusted page is denied.
1168    
1169 Type of value:
1170     URL
1171    
1172 Default value:
1173     Two example URL are provided
1174    
1175 Effect if unset:
1176     No links are displayed on the "untrusted" error page.
1177    
1178 Notes:
1179     The value of this option only matters if the experimental trust mechanism
1180     has been activated. (See trustfile above.)
1181    
1182     If you use the trust mechanism, it is a good idea to write up some on-line
1183     documentation about your trust policy and to specify the URL(s) here. Use
1184     multiple times for multiple URLs.
1185    
1186     The URL(s) should be added to the trustfile as well, so users don't end up
1187     locked out from the information on why they were locked out in the first
1188     place!
1189    
1190
1191 -------------------------------------------------------------------------------
1192 7.2.3. admin-address
1193
1194 Specifies:
1195     An email address to reach the proxy administrator.
1196    
1197 Type of value:
1198     Email address
1199    
1200 Default value:
1201     Unset
1202    
1203 Effect if unset:
1204     No email address is displayed on error pages and the CGI user interface.
1205    
1206 Notes:
1207     If both admin-address and proxy-info-url are unset, the whole "Local
1208     Privoxy Support" box on all generated pages will not be shown.
1209    
1210
1211 -------------------------------------------------------------------------------
1212 7.2.4. proxy-info-url
1213
1214 Specifies:
1215     A URL to documentation about the local Privoxy setup, configuration or
1216     policies.
1217    
1218 Type of value:
1219     URL
1220    
1221 Default value:
1222     Unset
1223    
1224 Effect if unset:
1225     No link to local documentation is displayed on error pages and the CGI user
1226     interface.
1227    
1228 Notes:
1229     If both admin-address and proxy-info-url are unset, the whole "Local
1230     Privoxy Support" box on all generated pages will not be shown.
1231    
1232     This URL shouldn't be blocked ;-)
1233    
1234
1235 -------------------------------------------------------------------------------
1236 7.3. Debugging
1237
1238 These options are mainly useful when tracing a problem. Note that you might
1239 also want to invoke Privoxy with the --no-daemon command line option when
1240 debugging.
1241 -------------------------------------------------------------------------------
1242
1243 7.3.1. debug
1244
1245 Specifies:
1246     Key values that determine what information gets logged to the logfile.
1247    
1248 Type of value:
1249     Integer values
1250    
1251 Default value:
1252     12289 (i.e.: URLs plus informational and warning messages)
1253    
1254 Effect if unset:
1255     Nothing gets logged.
1256    
1257 Notes:
1258     The available debug levels are:
1259    
1260       debug         1 # show each GET/POST/CONNECT request             
1261       debug         2 # show each connection status                    
1262       debug         4 # show I/O status                                
1263       debug         8 # show header parsing                            
1264       debug        16 # log all data into the logfile                  
1265       debug        32 # debug force feature                            
1266       debug        64 # debug regular expression filter                
1267       debug       128 # debug fast redirects                           
1268       debug       256 # debug GIF de-animation                         
1269       debug       512 # Common Log Format                              
1270       debug      1024 # debug kill pop-ups                             
1271       debug      2048 # CGI user interface                             
1272       debug      4096 # Startup banner and warnings.                   
1273       debug      8192 # Non-fatal errors                               
1274    
1275     To select multiple debug levels, you can either add them or use multiple
1276     debug lines.
1277    
1278     A debug level of 1 is informative because it will show you each request as
1279     it happens. 1, 4096 and 8192 are highly recommended so that you will notice
1280     when things go wrong. The other levels are probably only of interest if you
1281     are hunting down a specific problem. They can produce a hell of an output
1282     (especially 16).
1283    
1284     The reporting of fatal errors (i.e. ones which crash Privoxy) is always on
1285     and cannot be disabled.
1286    
1287     If you want to use CLF (Common Log Format), you should set "debug 512" ONLY
1288     and not enable anything else.
1289    
1290
1291 -------------------------------------------------------------------------------
1292 7.3.2. single-threaded
1293
1294 Specifies:
1295     Whether to run only one server thread
1296    
1297 Type of value:
1298     None
1299    
1300 Default value:
1301     Unset
1302    
1303 Effect if unset:
1304     Multi-threaded (or, where unavailable: forked) operation, i.e. the ability
1305     to serve multiple requests simultaneously.
1306    
1307 Notes:
1308     This option is only there for debug purposes and you should never need to
1309     use it. It will drastically reduce performance.
1310    
1311
1312 -------------------------------------------------------------------------------
1313 7.4. Access Control and Security
1314
1315 This section of the config file controls the security-relevant aspects of 
1316 Privoxy's configuration.
1317 -------------------------------------------------------------------------------
1318
1319 7.4.1. listen-address
1320
1321 Specifies:
1322     The IP address and TCP port on which Privoxy will listen for client
1323     requests.
1324    
1325 Type of value:
1326     [IP-Address]:Port
1327    
1328 Default value:
1329     127.0.0.1:8118
1330    
1331 Effect if unset:
1332     Bind to 127.0.0.1 (localhost), port 8118. This is suitable and recommended
1333     for home users who run Privoxy on the same machine as their browser.
1334    
1335 Notes:
1336     You will need to configure your browser(s) to this proxy address and port.
1337    
1338     If you already have another service running on port 8118, or if you want to
1339     serve requests from other machines (e.g. on your local network) as well,
1340     you will need to override the default.
1341    
1342     If you leave out the IP address, Privoxy will bind to all interfaces
1343     (addresses) on your machine and may become reachable from the Internet. In
1344     that case, consider using access control lists (ACL's, see below), and/or a
1345     firewall.
1346    
1347     If you open Privoxy to untrusted users, you will also want to turn off the 
1348     enable-edit-actions and enable-remote-toggle options!
1349    
1350 Example:
1351     Suppose you are running Privoxy on a machine which has the address
1352     192.168.0.1 on your local private network (192.168.0.0) and has another
1353     outside connection with a different address. You want it to serve requests
1354     from inside only:
1355    
1356       listen-address  192.168.0.1:8118                                 
1357    
1358
1359 -------------------------------------------------------------------------------
1360 7.4.2. toggle
1361
1362 Specifies:
1363     Initial state of "toggle" status
1364    
1365 Type of value:
1366     1 or 0
1367    
1368 Default value:
1369     1
1370    
1371 Effect if unset:
1372     Act as if toggled on
1373    
1374 Notes:
1375     If set to 0, Privoxy will start in "toggled off" mode, i.e. behave like a
1376     normal, content-neutral proxy where all ad blocking, filtering, etc are
1377     disabled. See enable-remote-toggle below. This is not really useful
1378     anymore, since toggling is much easier via the web interface than via
1379     editing the conf file.
1380    
1381     The windows version will only display the toggle icon in the system tray if
1382     this option is present.
1383    
1384
1385 -------------------------------------------------------------------------------
1386 7.4.3. enable-remote-toggle
1387
1388 Specifies:
1389     Whether or not the web-based toggle feature may be used
1390    
1391 Type of value:
1392     0 or 1
1393    
1394 Default value:
1395     1
1396    
1397 Effect if unset:
1398     The web-based toggle feature is disabled.
1399    
1400 Notes:
1401     When toggled off, Privoxy acts like a normal, content-neutral proxy, i.e.
1402     it acts as if none of the actions applied to any URL.
1403    
1404     For the time being, access to the toggle feature can not be controlled
1405     separately by "ACLs" or HTTP authentication, so that everybody who can
1406     access Privoxy (see "ACLs" and listen-address above) can toggle it for all
1407     users. So this option is not recommended for multi-user environments with
1408     untrusted users.
1409    
1410     Note that you must have compiled Privoxy with support for this feature,
1411     otherwise this option has no effect.
1412    
1413
1414 -------------------------------------------------------------------------------
1415 7.4.4. enable-edit-actions
1416
1417 Specifies:
1418     Whether or not the web-based actions file editor may be used
1419    
1420 Type of value:
1421     0 or 1
1422    
1423 Default value:
1424     1
1425    
1426 Effect if unset:
1427     The web-based actions file editor is disabled.
1428    
1429 Notes:
1430     For the time being, access to the editor can not be controlled separately
1431     by "ACLs" or HTTP authentication, so that everybody who can access Privoxy
1432     (see "ACLs" and listen-address above) can modify its configuration for all
1433     users. So this option is not recommended for multi-user environments with
1434     untrusted users.
1435    
1436     Note that you must have compiled Privoxy with support for this feature,
1437     otherwise this option has no effect.
1438    
1439
1440 -------------------------------------------------------------------------------
1441 7.4.5. ACLs: permit-access and deny-access
1442
1443 Specifies:
1444     Who can access what.
1445    
1446 Type of value:
1447     src_addr[/src_masklen] [dst_addr[/dst_masklen]]
1448    
1449     Where src_addr and dst_addr are IP addresses in dotted decimal notation or
1450     valid DNS names, and src_masklen and dst_masklen are subnet masks in CIDR
1451     notation, i.e. integer values from 2 to 30 representing the length (in
1452     bits) of the network address. The masks and the whole destination part are
1453     optional.
1454    
1455 Default value:
1456     Unset
1457    
1458 Effect if unset:
1459     Don't restrict access further than implied by listen-address
1460    
1461 Notes:
1462     Access controls are included at the request of ISPs and systems
1463     administrators, and are not usually needed by individual users. For a
1464     typical home user, it will normally suffice to ensure that Privoxy only
1465     listens on the localhost (127.0.0.1) or internal (home) network address by
1466     means of the listen-address option.
1467    
1468     Please see the warnings in the FAQ that this proxy is not intended to be a
1469     substitute for a firewall or to encourage anyone to defer addressing basic
1470     security weaknesses.
1471    
1472     Multiple ACL lines are OK. If any ACLs are specified, then the Privoxy
1473     talks only to IP addresses that match at least one permit-access line and
1474     don't match any subsequent deny-access line. In other words, the last match
1475     wins, with the default being deny-access.
1476    
1477     If Privoxy is using a forwarder (see forward below) for a particular
1478     destination URL, the dst_addr that is examined is the address of the
1479     forwarder and NOT the address of the ultimate target. This is necessary
1480     because it may be impossible for the local Privoxy to determine the IP
1481     address of the ultimate target (that's often what gateways are used for).
1482    
1483     You should prefer using IP addresses over DNS names, because the address
1484     lookups take time. All DNS names must resolve! You can not use domain
1485     patterns like "*.org" or partial domain names. If a DNS name resolves to
1486     multiple IP addresses, only the first one is used.
1487    
1488     Denying access to particular sites by ACL may have undesired side effects
1489     if the site in question is hosted on a machine which also hosts other
1490     sites.
1491    
1492 Examples:
1493     Explicitly define the default behavior if no ACL and listen-address are
1494     set: "localhost" is OK. The absence of a dst_addr implies that all
1495     destination addresses are OK:
1496    
1497       permit-access  localhost                                         
1498    
1499     Allow any host on the same class C subnet as www.privoxy.org access to
1500     nothing but www.example.com:
1501    
1502       permit-access  www.privoxy.org/24 www.example.com/32             
1503    
1504     Allow access from any host on the 26-bit subnet 192.168.45.64 to anywhere,
1505     with the exception that 192.168.45.73 may not access
1506     www.dirty-stuff.example.com:
1507    
1508       permit-access  192.168.45.64/26                                  
1509       deny-access    192.168.45.73    www.dirty-stuff.example.com      
1510    
1511
1512 -------------------------------------------------------------------------------
1513 7.4.6. buffer-limit
1514
1515 Specifies:
1516     Maximum size of the buffer for content filtering.
1517    
1518 Type of value:
1519     Size in Kbytes
1520    
1521 Default value:
1522     4096
1523    
1524 Effect if unset:
1525     Use a 4MB (4096 KB) limit.
1526    
1527 Notes:
1528     For content filtering, i.e. the +filter and +deanimate-gif actions, it is
1529     necessary that Privoxy buffers the entire document body. This can be
1530     potentially dangerous, since a server could just keep sending data
1531     indefinitely and wait for your RAM to exhaust -- with nasty consequences.
1532     Hence this option.
1533    
1534     When a document buffer size reaches the buffer-limit, it is flushed to the
1535     client unfiltered and no further attempt to filter the rest of the document
1536     is made. Remember that there may be multiple threads running, which might
1537     require up to buffer-limit Kbytes each, unless you have enabled 
1538     "single-threaded" above.
1539    
1540
1541 -------------------------------------------------------------------------------
1542 7.5. Forwarding
1543
1544 This feature allows routing of HTTP requests through a chain of multiple
1545 proxies. It can be used to better protect privacy and confidentiality when
1546 accessing specific domains by routing requests to those domains through an
1547 anonymous public proxy (see e.g. http://www.multiproxy.org/anon_list.htm) Or to
1548 use a caching proxy to speed up browsing. Or chaining to a parent proxy may be
1549 necessary because the machine that Privoxy runs on has no direct Internet
1550 access.
1551
1552 Also specified here are SOCKS proxies. Privoxy supports the SOCKS 4 and SOCKS
1553 4A protocols.
1554 -------------------------------------------------------------------------------
1555
1556 7.5.1. forward
1557
1558 Specifies:
1559     To which parent HTTP proxy specific requests should be routed.
1560    
1561 Type of value:
1562     target_pattern http_parent[:port]
1563    
1564     where target_pattern is a URL pattern that specifies to which requests
1565     (i.e. URLs) this forward rule shall apply. Use / to denote "all URLs".
1566     http_parent[:port] is the DNS name or IP address of the parent HTTP proxy
1567     through which the requests should be forwarded, optionally followed by its
1568     listening port (default: 8080). Use a single dot (.) to denote "no
1569     forwarding".
1570    
1571 Default value:
1572     Unset
1573    
1574 Effect if unset:
1575     Don't use parent HTTP proxies.
1576    
1577 Notes:
1578     If http_parent is ".", then requests are not forwarded to another HTTP
1579     proxy but are made directly to the web servers.
1580    
1581     Multiple lines are OK, they are checked in sequence, and the last match
1582     wins.
1583    
1584 Examples:
1585     Everything goes to an example anonymizing proxy, except SSL on port 443
1586     (which it doesn't handle):
1587    
1588       forward   /      anon-proxy.example.org:8080                     
1589       forward   :443   .                                               
1590    
1591     Everything goes to our example ISP's caching proxy, except for requests to
1592     that ISP's sites:
1593    
1594       forward   /                  caching-proxy.example-isp.net:8000  
1595       forward   .example-isp.net   .                                   
1596    
1597
1598 -------------------------------------------------------------------------------
1599 7.5.2. forward-socks4 and forward-socks4a
1600
1601 Specifies:
1602     Through which SOCKS proxy (and to which parent HTTP proxy) specific
1603     requests should be routed.
1604    
1605 Type of value:
1606     target_pattern socks_proxy[:port] http_parent[:port]
1607    
1608     where target_pattern is a URL pattern that specifies to which requests
1609     (i.e. URLs) this forward rule shall apply. Use / to denote "all URLs".
1610     http_parent and socks_proxy are IP addresses in dotted decimal notation or
1611     valid DNS names (http_parent may be "." to denote "no HTTP forwarding"),
1612     and the optional port parameters are TCP ports, i.e. integer values from 1
1613     to 64535
1614    
1615 Default value:
1616     Unset
1617    
1618 Effect if unset:
1619     Don't use SOCKS proxies.
1620    
1621 Notes:
1622     Multiple lines are OK, they are checked in sequence, and the last match
1623     wins.
1624    
1625     The difference between forward-socks4 and forward-socks4a is that in the
1626     SOCKS 4A protocol, the DNS resolution of the target hostname happens on the
1627     SOCKS server, while in SOCKS 4 it happens locally.
1628    
1629     If http_parent is ".", then requests are not forwarded to another HTTP
1630     proxy but are made (HTTP-wise) directly to the web servers, albeit through
1631     a SOCKS proxy.
1632    
1633 Examples:
1634     From the company example.com, direct connections are made to all "internal"
1635     domains, but everything outbound goes through their ISP's proxy by way of
1636     example.com's corporate SOCKS 4A gateway to the Internet.
1637    
1638       forward-socks4a   /              socks-gw.example.com:1080  www-cache.example-isp.net:8080 
1639       forward           .example.com   .                                                         
1640    
1641     A rule that uses a SOCKS 4 gateway for all destinations but no HTTP parent
1642     looks like this:
1643    
1644       forward-socks4   /               socks-gw.example.com:1080  .    
1645    
1646
1647 -------------------------------------------------------------------------------
1648 7.5.3. Advanced Forwarding Examples
1649
1650 If you have links to multiple ISPs that provide various special content only to
1651 their subscribers, you can configure multiple Privoxies which have connections
1652 to the respective ISPs to act as forwarders to each other, so that your users
1653 can see the internal content of all ISPs.
1654
1655 Assume that host-a has a PPP connection to isp-a.net. And host-b has a PPP
1656 connection to isp-b.net. Both run Privoxy. Their forwarding configuration can
1657 look like this:
1658
1659 host-a:
1660
1661   forward    /           .                                                     
1662   forward    .isp-b.net  host-b:8118                                           
1663
1664 host-b:
1665
1666   forward    /           .                                                     
1667   forward    .isp-a.net  host-a:8118                                           
1668
1669 Now, your users can set their browser's proxy to use either host-a or host-b
1670 and be able to browse the internal content of both isp-a and isp-b.
1671
1672 If you intend to chain Privoxy and squid locally, then chain as browser ->
1673 squid -> privoxy is the recommended way.
1674
1675 Assuming that Privoxy and squid run on the same box, your squid configuration
1676 could then look like this:
1677
1678   # Define Privoxy as parent proxy (without ICP)                               
1679   cache_peer 127.0.0.1 parent 8118 7 no-query                                  
1680                                                                                
1681   # Define ACL for protocol FTP                                                
1682   acl ftp proto FTP                                                            
1683                                                                                
1684   # Do not forward FTP requests to Privoxy                                     
1685   always_direct allow ftp                                                      
1686                                                                                
1687   # Forward all the rest to Privoxy                                            
1688   never_direct allow all                                                       
1689
1690 You would then need to change your browser's proxy settings to squid's address
1691 and port. Squid normally uses port 3128. If unsure consult http_port in
1692 squid.conf.
1693
1694 You could just as well decide to only forward requests for Windows executables
1695 through a virus-scanning parent proxy, say, on antivir.example.com, port 8010:
1696
1697   forward   /                          .                                       
1698   forward   /.*\.(exe|com|dll|zip)$    antivir.example.com:8010                
1699 -------------------------------------------------------------------------------
1700
1701 7.6. Windows GUI Options
1702
1703 Privoxy has a number of options specific to the Windows GUI interface:
1704
1705
1706 If "activity-animation" is set to 1, the Privoxy icon will animate when 
1707 "Privoxy" is active. To turn off, set to 0.
1708
1709   activity-animation 1
1710    
1711
1712
1713 If "log-messages" is set to 1, Privoxy will log messages to the console window:
1714
1715   log-messages 1
1716    
1717
1718
1719 If "log-buffer-size" is set to 1, the size of the log buffer, i.e. the amount
1720 of memory used for the log messages displayed in the console window, will be
1721 limited to "log-max-lines" (see below).
1722
1723 Warning: Setting this to 0 will result in the buffer to grow infinitely and eat
1724 up all your memory!
1725
1726   log-buffer-size 1
1727    
1728
1729
1730 log-max-lines is the maximum number of lines held in the log buffer. See above.
1731
1732   log-max-lines 200
1733    
1734
1735
1736 If "log-highlight-messages" is set to 1, Privoxy will highlight portions of the
1737 log messages with a bold-faced font:
1738
1739   log-highlight-messages 1
1740    
1741
1742
1743 The font used in the console window:
1744
1745   log-font-name Comic Sans MS
1746    
1747
1748
1749 Font size used in the console window:
1750
1751   log-font-size 8
1752    
1753
1754
1755 "show-on-task-bar" controls whether or not Privoxy will appear as a button on
1756 the Task bar when minimized:
1757
1758   show-on-task-bar 0
1759    
1760
1761
1762 If "close-button-minimizes" is set to 1, the Windows close button will minimize
1763 Privoxy instead of closing the program (close with the exit option on the File
1764 menu).
1765
1766   close-button-minimizes 1
1767    
1768
1769
1770 The "hide-console" option is specific to the MS-Win console version of Privoxy.
1771 If this option is used, Privoxy will disconnect from and hide the command
1772 console.
1773
1774   #hide-console
1775    
1776 -------------------------------------------------------------------------------
1777
1778 8. Actions Files
1779
1780 The actions files are used to define what actions Privoxy takes for which URLs,
1781 and thus determine how ad images, cookies and various other aspects of HTTP
1782 content and transactions are handled, and on which sites (or even parts
1783 thereof). There are three such files included with Privoxy (as of version
1784 2.9.15), with differing purposes:
1785
1786   * default.action - is the primary action file that sets the initial values
1787     for all actions. It is intended to provide a base level of functionality
1788     for Privoxy's array of features. So it is a set of broad rules that should
1789     work reasonably well for users everywhere. This is the file that the
1790     developers are keeping updated, and making available to users.
1791    
1792   * user.action - is intended to be for local site preferences and exceptions.
1793     As an example, if your ISP or your bank has specific requirements, and need
1794     special handling, this kind of thing should go here. This file will not be
1795     upgraded.
1796    
1797   * standard.action - is used by the web based editor, to set various
1798     pre-defined sets of rules for the default actions section in
1799     default.action. These have increasing levels of aggressiveness and have no
1800     influence on your browsing unless you select them explicitly in the editor.
1801     It is not recommend to edit this file.
1802    
1803
1804 The list of actions files to be used are defined in the main configuration
1805 file, and are processed in the order they are defined. The content of these can
1806 all be viewed and edited from http://config.privoxy.org/show-status.
1807
1808 An actions file typically has multiple sections. If you want to use "aliases"
1809 in an actions file, you have to place the (optional) alias section at the top
1810 of that file. Then comes the default set of rules which will apply universally
1811 to all sites and pages (be very careful with using such a universal set in
1812 user.action or any other actions file after default.action, because it will
1813 override the result from consulting any previous file). And then below that,
1814 exceptions to the defined universal policies. You can regard user.action as an
1815 appendix to default.action, with the advantage that is a separate file, which
1816 makes preserving your personal settings across Privoxy upgrades easier.
1817
1818 Actions can be used to block anything you want, including ads, banners, or just
1819 some obnoxious URL that you would rather not see. Cookies can be accepted or
1820 rejected, or accepted only during the current browser session (i.e. not written
1821 to disk), content can be modified, JavaScripts tamed, user-tracking fooled, and
1822 much more. See below for a complete list of actions.
1823 -------------------------------------------------------------------------------
1824
1825 8.1. Finding the Right Mix
1826
1827 Note that some actions, like cookie suppression or script disabling, may render
1828 some sites unusable that rely on these techniques to work properly. Finding the
1829 right mix of actions is not always easy and certainly a matter of personal
1830 taste. In general, it can be said that the more "aggressive" your default
1831 settings (in the top section of the actions file) are, the more exceptions for 
1832 "trusted" sites you will have to make later. If, for example, you want to kill
1833 popup windows per default, you'll have to make exceptions from that rule for
1834 sites that you regularly use and that require popups for actually useful
1835 content, like maybe your bank, favorite shop, or newspaper.
1836
1837 We have tried to provide you with reasonable rules to start from in the
1838 distribution actions files. But there is no general rule of thumb on these
1839 things. There just are too many variables, and sites are constantly changing.
1840 Sooner or later you will want to change the rules (and read this chapter again
1841 :).
1842 -------------------------------------------------------------------------------
1843
1844 8.2. How to Edit
1845
1846 The easiest way to edit the actions files is with a browser by using our
1847 browser-based editor, which can be reached from http://config.privoxy.org/
1848 show-status. The editor allows both fine-grained control over every single
1849 feature on a per-URL basis, and easy choosing from wholesale sets of defaults
1850 like "Cautious", "Medium" or "Advanced".
1851
1852 If you prefer plain text editing to GUIs, you can of course also directly edit
1853 the the actions files. Look at default.action which is richly commented.
1854 -------------------------------------------------------------------------------
1855
1856 8.3. How Actions are Applied to URLs
1857
1858 Actions files are divided into sections. There are special sections, like the "
1859 alias" sections which will be discussed later. For now let's concentrate on
1860 regular sections: They have a heading line (often split up to multiple lines
1861 for readability) which consist of a list of actions, separated by whitespace
1862 and enclosed in curly braces. Below that, there is a list of URL patterns, each
1863 on a separate line.
1864
1865 To determine which actions apply to a request, the URL of the request is
1866 compared to all patterns in each action file file. Every time it matches, the
1867 list of applicable actions for the URL is incrementally updated, using the
1868 heading of the section in which the pattern is located. If multiple matches for
1869 the same URL set the same action differently, the last match wins. If not, the
1870 effects are aggregated. E.g. a URL might match a regular section with a heading
1871 line of { +handle-as-image }, then later another one with just { +block },
1872 resulting in both actions to apply.
1873
1874 You can trace this process for any given URL by visiting http://
1875 config.privoxy.org/show-url-info.
1876
1877 More detail on this is provided in the Appendix, Anatomy of an Action.
1878 -------------------------------------------------------------------------------
1879
1880 8.4. Patterns
1881
1882 Generally, a pattern has the form <domain>/<path>, where both the <domain> and
1883 <path> are optional. (This is why the pattern / matches all URLs).
1884
1885 www.example.com/
1886     is a domain-only pattern and will match any request to www.example.com,
1887     regardless of which document on that server is requested.
1888    
1889 www.example.com
1890     means exactly the same. For domain-only patterns, the trailing / may be
1891     omitted.
1892    
1893 www.example.com/index.html
1894     matches only the single document /index.html on www.example.com.
1895    
1896 /index.html
1897     matches the document /index.html, regardless of the domain, i.e. on any web
1898     server.
1899    
1900 index.html
1901     matches nothing, since it would be interpreted as a domain name and there
1902     is no top-level domain called .html.
1903    
1904
1905 -------------------------------------------------------------------------------
1906 8.4.1. The Domain Pattern
1907
1908 The matching of the domain part offers some flexible options: if the domain
1909 starts or ends with a dot, it becomes unanchored at that end. For example:
1910
1911 .example.com
1912     matches any domain that ENDS in .example.com
1913    
1914 www.
1915     matches any domain that STARTS with www.
1916    
1917 .example.
1918     matches any domain that CONTAINS .example. (Correctly speaking: It matches
1919     any FQDN that contains example as a domain.)
1920    
1921
1922 Additionally, there are wild-cards that you can use in the domain names
1923 themselves. They work pretty similar to shell wild-cards: "*" stands for zero
1924 or more arbitrary characters, "?" stands for any single character, you can
1925 define character classes in square brackets and all of that can be freely
1926 mixed:
1927
1928 ad*.example.com
1929     matches "adserver.example.com", "ads.example.com", etc but not 
1930     "sfads.example.com"
1931    
1932 *ad*.example.com
1933     matches all of the above, and then some.
1934    
1935 .?pix.com
1936     matches www.ipix.com, pictures.epix.com, a.b.c.d.e.upix.com etc.
1937    
1938 www[1-9a-ez].example.c*
1939     matches www1.example.com, www4.example.cc, wwwd.example.cy,
1940     wwwz.example.com etc., but not wwww.example.com.
1941    
1942
1943 -------------------------------------------------------------------------------
1944 8.4.2. The Path Pattern
1945
1946 Privoxy uses Perl compatible regular expressions (through the PCRE library) for
1947 matching the path.
1948
1949 There is an Appendix with a brief quick-start into regular expressions, and
1950 full (very technical) documentation on PCRE regex syntax is available on-line
1951 at http://www.pcre.org/man.txt. You might also find the Perl man page on
1952 regular expressions (man perlre) useful, which is available on-line at http://
1953 www.perldoc.com/perl5.6/pod/perlre.html.
1954
1955 Note that the path pattern is automatically left-anchored at the "/", i.e. it
1956 matches as if it would start with a "^" (regular expression speak for the
1957 beginning of a line).
1958
1959 Please also note that matching in the path is CASE INSENSITIVE by default, but
1960 you can switch to case sensitive at any point in the pattern by using the "(?
1961 -i)" switch: www.example.com/(?-i)PaTtErN.* will match only documents whose
1962 path starts with PaTtErN in exactly this capitalization.
1963 -------------------------------------------------------------------------------
1964
1965 8.5. Actions
1966
1967 All actions are disabled by default, until they are explicitly enabled
1968 somewhere in an actions file. Actions are turned on if preceded with a "+", and
1969 turned off if preceded with a "-". So a +action means "do that action", e.g.
1970 +block means "please block URLs that match the following patterns", and -block
1971 means "don't block URLs that match the following patterns, even if +block
1972 previously applied." 
1973
1974 Again, actions are invoked by placing them on a line, enclosed in curly braces
1975 and separated by whitespace, like in {+some-action -some-other-action
1976 {some-parameter}}, followed by a list of URL patterns, one per line, to which
1977 they apply. Together, the actions line and the following pattern lines make up
1978 a section of the actions file.
1979
1980 There are three classes of actions:
1981
1982   * Boolean, i.e the action can only be "enabled" or "disabled". Syntax:
1983    
1984       +name        # enable action name                                
1985       -name        # disable action name                               
1986    
1987     Example: +block
1988    
1989   * Parameterized, where some value is required in order to enable this type of
1990     action. Syntax:
1991    
1992       +name{param}  # enable action and set parameter to param,             
1993                    # overwriting parameter from previous match if necessary 
1994       -name         # disable action. The parameter can be omitted          
1995    
1996     Note that if the URL matches multiple positive forms of a parameterized
1997     action, the last match wins, i.e. the params from earlier matches are
1998     simply ignored.
1999    
2000     Example: +hide-user-agent{ Mozilla 1.0 }
2001    
2002   * Multi-value. These look exactly like parameterized actions, but they behave
2003     differently: If the action applies multiple times to the same URL, but with
2004     different parameters, all the parameters from all matches are remembered.
2005     This is used for actions that can be executed for the same request
2006     repeatedly, like adding multiple headers, or filtering through multiple
2007     filters. Syntax:
2008    
2009       +name{param}   # enable action and add param to the list of parameters                 
2010       -name{param}   # remove the parameter param from the list of parameters                
2011                     # If it was the last one left, disable the action.                       
2012       -name          # disable this action completely and remove all parameters from the list
2013    
2014     Examples: +add-header{X-Fun-Header: Some text} and +filter{html-annoyances}
2015    
2016
2017 If nothing is specified in any actions file, no "actions" are taken. So in this
2018 case Privoxy would just be a normal, non-blocking, non-anonymizing proxy. You
2019 must specifically enable the privacy and blocking features you need (although
2020 the provided default actions files will give a good starting point).
2021
2022 Later defined actions always over-ride earlier ones. So exceptions to any rules
2023 you make, should come in the latter part of the file (or in a file that is
2024 processed later when using multiple actions files). For multi-valued actions,
2025 the actions are applied in the order they are specified. Actions files are
2026 processed in the order they are defined in config (the default installation has
2027 three actions files). It also quite possible for any given URL pattern to match
2028 more than one pattern and thus more than one set of actions!
2029
2030 The list of valid Privoxy actions are:
2031 -------------------------------------------------------------------------------
2032
2033 8.5.1. add-header
2034
2035 Typical use:
2036     Confuse log analysis, custom applications
2037    
2038 Effect:
2039     Sends a user defined HTTP header to the web server.
2040    
2041 Type:
2042     Multi-value.
2043    
2044 Parameter:
2045     Any string value is possible. Validity of the defined HTTP headers is not
2046     checked. It is recommended that you use the "X-" prefix for custom headers.
2047    
2048 Notes:
2049     This action may be specified multiple times, in order to define multiple
2050     headers. This is rarely needed for the typical user. If you don't know what
2051     "HTTP headers" are, you definitely don't need to worry about this one.
2052    
2053 Example usage:
2054     +add-header{X-User-Tracking: sucks}                                
2055    
2056
2057 -------------------------------------------------------------------------------
2058 8.5.2. block
2059
2060 Typical use:
2061     Block ads or other obnoxious content
2062    
2063 Effect:
2064     Requests for URLs to which this action applies are blocked, i.e. the
2065     requests are not forwarded to the remote server, but answered locally with
2066     a substitute page or image, as determined by the handle-as-image and 
2067     set-image-blocker actions.
2068    
2069 Type:
2070     Boolean.
2071    
2072 Parameter:
2073     N/A
2074    
2075 Notes:
2076     Privoxy sends a special "BLOCKED" page for requests to blocked pages. This
2077     page contains links to find out why the request was blocked, and a
2078     click-through to the blocked content (the latter only if compiled with the
2079     force feature enabled). The "BLOCKED" page adapts to the available screen
2080     space -- it displays full-blown if space allows, or miniaturized and
2081     text-only if loaded into a small frame or window. If you are using Privoxy
2082     right now, you can take a look at the "BLOCKED" page.
2083    
2084     A very important exception occurs if both block and handle-as-image, apply
2085     to the same request: it will then be replaced by an image. If 
2086     set-image-blocker (see below) also applies, the type of image will be
2087     determined by its parameter, if not, the standard checkerboard pattern is
2088     sent.
2089    
2090     It is important to understand this process, in order to understand how 
2091     Privoxy deals with ads and other unwanted content.
2092    
2093     The filter action can perform a very similar task, by "blocking" banner
2094     images and other content through rewriting the relevant URLs in the
2095     document's HTML source, so they don't get requested in the first place.
2096     Note that this is a totally different technique, and it's easy to confuse
2097     the two.
2098    
2099 Example usage (section):
2100     {+block}      # Block and replace with "blocked" page              
2101     .nasty-stuff.example.com                                           
2102                                                                        
2103     {+block +handle-as-image} # Block and replace with image           
2104     .ad.doubleclick.net                                                
2105     .ads.r.us                                                          
2106    
2107
2108 -------------------------------------------------------------------------------
2109 8.5.3. crunch-incoming-cookies
2110
2111 Typical use:
2112     Prevent the web server from setting any cookies on your system
2113    
2114 Effect:
2115     Deletes any "Set-Cookie:" HTTP headers from server replies.
2116    
2117 Type:
2118     Boolean.
2119    
2120 Parameter:
2121     N/A
2122    
2123 Notes:
2124     This action is only concerned with incoming cookies. For outgoing cookies,
2125     use crunch-outgoing-cookies. Use both to disable cookies completely.
2126    
2127     It makes no sense at all to use this action in conjunction with the 
2128     session-cookies-only action, since it would prevent the session cookies
2129     from being set.
2130    
2131 Example usage:
2132     +crunch-incoming-cookies                                           
2133    
2134
2135 -------------------------------------------------------------------------------
2136 8.5.4. crunch-outgoing-cookies
2137
2138 Typical use:
2139     Prevent the web server from reading any cookies from your system
2140    
2141 Effect:
2142     Deletes any "Cookie:" HTTP headers from client requests.
2143    
2144 Type:
2145     Boolean.
2146    
2147 Parameter:
2148     N/A
2149    
2150 Notes:
2151     This action is only concerned with outgoing cookies. For incoming cookies,
2152     use crunch-incoming-cookies. Use both to disable cookies completely.
2153    
2154     It makes no sense at all to use this action in conjunction with the 
2155     session-cookies-only action, since it would prevent the session cookies
2156     from being read.
2157    
2158 Example usage:
2159     +crunch-outgoing-cookies                                           
2160    
2161
2162 -------------------------------------------------------------------------------
2163 8.5.5. deanimate-gifs
2164
2165 Typical use:
2166     Stop those annoying, distracting animated GIF images.
2167    
2168 Effect:
2169     De-animate GIF animations, i.e. reduce them to their first or last image.
2170    
2171 Type:
2172     Parameterized.
2173    
2174 Parameter:
2175     "last" or "first"
2176    
2177 Notes:
2178     This will also shrink the images considerably (in bytes, not pixels!). If
2179     the option "first" is given, the first frame of the animation is used as
2180     the replacement. If "last" is given, the last frame of the animation is
2181     used instead, which probably makes more sense for most banner animations,
2182     but also has the risk of not showing the entire last frame (if it is only a
2183     delta to an earlier frame).
2184    
2185     You can safely use this action with patterns that will also match non-GIF
2186     objects, because no attempt will be made at anything that doesn't look like
2187     a GIF.
2188    
2189 Example usage:
2190     +deanimate-gifs{last}                                              
2191    
2192
2193 -------------------------------------------------------------------------------
2194 8.5.6. downgrade-http-version
2195
2196 Typical use:
2197     Work around (very rare) problems with HTTP/1.1
2198    
2199 Effect:
2200     Downgrades HTTP/1.1 client requests and server replies to HTTP/1.0.
2201    
2202 Type:
2203     Boolean.
2204    
2205 Parameter:
2206     N/A
2207    
2208 Notes:
2209     This is a left-over from the time when Privoxy didn't support important
2210     HTTP/1.1 features well. It is left here for the unlikely case that you
2211     experience HTTP/1.1 related problems with some server out there. Not all
2212     (optional) HTTP/1.1 features are supported yet, so there is a chance you
2213     might need this action.
2214    
2215 Example usage (section):
2216     {+downgrade-http-version}                                          
2217     problem-host.example.com                                           
2218    
2219
2220 -------------------------------------------------------------------------------
2221 8.5.7. fast-redirects
2222
2223 Typical use:
2224     Fool some click-tracking scripts and speed up indirect links
2225    
2226 Effect:
2227     Cut off all but the last valid URL from requests.
2228    
2229 Type:
2230     Boolean.
2231    
2232 Parameter:
2233     N/A
2234    
2235 Notes:
2236     Many sites, like yahoo.com, don't just link to other sites. Instead, they
2237     will link to some script on their own servers, giving the destination as a
2238     parameter, which will then redirect you to the final target. URLs resulting
2239     from this scheme typically look like: http://some.place/click-tracker.cgi?
2240     target=http://some.where.else.
2241    
2242     Sometimes, there are even multiple consecutive redirects encoded in the
2243     URL. These redirections via scripts make your web browsing more traceable,
2244     since the server from which you follow such a link can see where you go to.
2245     Apart from that, valuable bandwidth and time is wasted, while your browser
2246     ask the server for one redirect after the other. Plus, it feeds the
2247     advertisers.
2248    
2249     This feature is currently not very smart and is scheduled for improvement.
2250     It is likely to break some sites. You should expect to need possibly many
2251     exceptions to this action, if it is enabled by default in default.action.
2252     Some sites just don't work without it.
2253    
2254 Example usage:
2255     {+fast-redirects}                                                  
2256    
2257
2258 -------------------------------------------------------------------------------
2259 8.5.8. filter
2260
2261 Typical use:
2262     Get rid of HTML and JavaScript annoyances, banner advertisements (by size),
2263     do fun text replacements, etc.
2264    
2265 Effect:
2266     Text documents, including HTML and JavaScript, to which this action
2267     applies, are filtered on-the-fly through the specified regular expression
2268     based substitutions.
2269    
2270 Type:
2271     Parameterized.
2272    
2273 Parameter:
2274     The name of a filter, as defined in the filter file (typically
2275     default.filter, set by the filterfile option in the config file). Filtering
2276     can be completely disabled without the use of parameters.
2277    
2278 Notes:
2279     For your convenience, there are a number of pre-defined filters available
2280     in the distribution filter file that you can use. See the examples below
2281     for a list.
2282    
2283     This is potentially a very powerful feature! But "rolling your own" filters
2284     requires a knowledge of regular expressions and HTML.
2285    
2286     Filtering requires buffering the page content, which may appear to slow
2287     down page rendering since nothing is displayed until all content has passed
2288     the filters. (It does not really take longer, but seems that way since the
2289     page is not incrementally displayed.) This effect will be more noticeable
2290     on slower connections.
2291    
2292     The amount of data that can be filtered is limited to the buffer-limit
2293     option in the main config file. The default is 4096 KB (4 Megs). Once this
2294     limit is exceeded, the buffered data, and all pending data, is passed
2295     through unfiltered. Inappropriate MIME types are not filtered.
2296    
2297     At this time, Privoxy cannot (yet!) uncompress compressed documents. If you
2298     want filtering to work on all documents, even those that would normally be
2299     sent compressed, use the prevent-compression action in conjunction with
2300     filter.
2301    
2302     Filtering can achieve some of the same effects as the block action, i.e. it
2303     can be used to block ads and banners. But the mechanism works quite
2304     differently. One effective use, is to block ad banners based on their size
2305     (see below), since many of these seem to be somewhat standardized.
2306    
2307     Feedback with suggestions for new or improved filters is particularly
2308     welcome!
2309    
2310 Example usage (with filters from the distribution default.filter file):
2311     +filter{html-annoyances}     # Get rid of particularly annoying HTML abuse.
2312    
2313     +filter{js-annoyances}       # Get rid of particularly annoying JavaScript abuse
2314    
2315     +filter{banners-by-size}     # Kill banners based on their size for this page (very efficient!)
2316    
2317     +filter{banners-by-link}     # Kill banners based on the link they are contained in (experimental)
2318    
2319     +filter{img-reorder}         # Reorder attributes in <img> tags to make the banners-by-* filters more effective
2320    
2321     +filter{content-cookies}     # Kill cookies that come sneaking in the HTML or JS content
2322    
2323     +filter{popups}              # Kill all popups in JS and HTML      
2324    
2325     +filter{webbugs}             # Squish WebBugs (1x1 invisible GIFs used for user tracking)
2326    
2327     +filter{fun}                 # Text replacements for subversive browsing fun!
2328    
2329     +filter{frameset-borders}    # Give frames a border and make them resizeable
2330    
2331     +filter{refresh-tags}        # Kill automatic refresh tags (for dial-on-demand setups)
2332    
2333     +filter{nimda}               # Remove Nimda (virus) code.          
2334    
2335     +filter{shockwave-flash}     # Kill embedded Shockwave Flash objects
2336    
2337     +filter{crude-parental}      # Kill all web pages that contain the words "sex" or "warez"
2338    
2339     +filter{js-events}           # Kill all JS event bindings (Radically destructive! Only for extra nasty sites) 
2340    
2341
2342 -------------------------------------------------------------------------------
2343 8.5.9. handle-as-image
2344
2345 Typical use:
2346     Mark URLs as belonging to images (so they'll be replaced by images if they
2347     get blocked)
2348    
2349 Effect:
2350     This action alone doesn't do anything noticeable. It just marks URLs as
2351     images. If the block action also applies, the presence or absence of this
2352     mark decides whether an HTML "blocked" page, or a replacement image (as
2353     determined by the set-image-blocker action) will be sent to the client as a
2354     substitute for the blocked content.
2355    
2356 Type:
2357     Boolean.
2358    
2359 Parameter:
2360     N/A
2361    
2362 Notes:
2363     The below generic example section is actually part of default.action. It
2364     marks all URLs with well-known image file name extensions as images and
2365     should be left intact.
2366    
2367     Users will probably only want to use the handle-as-image action in
2368     conjunction with block, to block sources of banners, whose URLs don't
2369     reflect the file type, like in the second example section.
2370    
2371     Note that you cannot treat HTML pages as images in most cases. For
2372     instance, (in-line) ad frames require an HTML page to be sent, or they
2373     won't display properly. Forcing handle-as-image in this situation will not
2374     replace the ad frame with an image, but lead to error messages.
2375    
2376 Example usage (sections):
2377     # Generic image extensions:                                        
2378     #                                                                  
2379     {+handle-as-image}                                                 
2380     /.*\.(gif|jpg|jpeg|png|bmp|ico)$                                   
2381                                                                        
2382     # These don't look like images, but they're banners and should be  
2383     # blocked as images:                                               
2384     #                                                                  
2385     {+block +handle-as-image}                                          
2386     some.nasty-banner-server.com/junk.cgi?output=trash                 
2387                                                                        
2388     # Banner source! Who cares if they also have non-image content?    
2389     ad.doubleclick.net                                                 
2390    
2391
2392 -------------------------------------------------------------------------------
2393 8.5.10. hide-forwarded-for-headers
2394
2395 Typical use:
2396     Improve privacy by hiding the true source of the request
2397    
2398 Effect:
2399     Deletes any existing "X-Forwarded-for:" HTTP header from client requests,
2400     and prevents adding a new one.
2401    
2402 Type:
2403     Boolean.
2404    
2405 Parameter:
2406     N/A
2407    
2408 Notes:
2409     It is fairly safe to leave this on.
2410    
2411     This action is scheduled for improvement: It should be able to generate
2412     forged "X-Forwarded-for:" headers using random IP addresses from a
2413     specified network, to make successive requests from the same client look
2414     like requests from a pool of different users sharing the same proxy.
2415    
2416 Example usage:
2417     +hide-forwarded-for-headers                                        
2418    
2419
2420 -------------------------------------------------------------------------------
2421 8.5.11. hide-from-header
2422
2423 Typical use:
2424     Keep your (old and ill) browser from telling web servers your email address
2425    
2426 Effect:
2427     Deletes any existing "From:" HTTP header, or replaces it with the specified
2428     string.
2429    
2430 Type:
2431     Parameterized.
2432    
2433 Parameter:
2434     Keyword: "block", or any user defined value.
2435    
2436 Notes:
2437     The keyword "block" will completely remove the header (not to be confused
2438     with the block action).
2439    
2440     Alternately, you can specify any value you prefer to be sent to the web
2441     server. If you do, it is a matter of fairness not to use any address that
2442     is actually used by a real person.
2443    
2444     This action is rarely needed, as modern web browsers don't send "From:"
2445     headers anymore.
2446    
2447 Example usage:
2448     +hide-from-header{block}                                           
2449     or
2450     +hide-from-header{spam-me-senseless@sittingduck.example.com}       
2451    
2452
2453 -------------------------------------------------------------------------------
2454 8.5.12. hide-referrer
2455
2456 Typical use:
2457     Conceal which link you followed to get to a particular site
2458    
2459 Effect:
2460     Deletes the "Referer:" (sic) HTTP header from the client request, or
2461     replaces it with a forged one.
2462    
2463 Type:
2464     Parameterized.
2465    
2466 Parameter:
2467       + "block" to delete the header completely.
2468        
2469       + "forge" to pretend to be coming from the homepage of the server we are
2470         talking to.
2471        
2472       + Any other string to set a user defined referrer.
2473        
2474    
2475 Notes:
2476     "forge" is the preferred option here, since some servers will not send
2477     images back otherwise, in an attempt to prevent their valuable content from
2478     being embedded elsewhere (and hence, without being surrounded by their
2479     banners).
2480    
2481     hide-referer is an alternate spelling of hide-referrer and the two can be
2482     can be freely substituted with each other. ("referrer" is the correct
2483     English spelling, however the HTTP specification has a bug - it requires it
2484     to be spelled as "referer".)
2485    
2486 Example usage:
2487     +hide-referrer{forge}                                              
2488     or
2489     +hide-referrer{http://www.yahoo.com/}                              
2490    
2491
2492 -------------------------------------------------------------------------------
2493 8.5.13. hide-user-agent
2494
2495 Typical use:
2496     Conceal your type of browser and client operating system
2497    
2498 Effect:
2499     Replaces the value of the "User-Agent:" HTTP header in client requests with
2500     the specified value.
2501    
2502 Type:
2503     Parameterized.
2504    
2505 Parameter:
2506     Any user-defined string.
2507    
2508 Notes:
2509     +-----------------------------------------------------------------+
2510     |                             Warning                             |
2511     +-----------------------------------------------------------------+
2512     |This breaks many web sites that depend on looking at this header |
2513     |in order to customize their content for different browsers       |
2514     |(which, by the way, is NOT a smart way to do that!).             |
2515     +-----------------------------------------------------------------+
2516    
2517     Using this action in multi-user setups or wherever different types of
2518     browsers will access the same Privoxy is not recommended. In single-user,
2519     single-browser setups, you might use it to delete your OS version
2520     information from the headers, because it is an invitation to exploit known
2521     bugs for your OS. It is also occasionally useful to forge this in order to
2522     access sites that won't let you in otherwise (though there may be a good
2523     reason in some cases). Example of this: some MSN sites will not let Mozilla
2524     enter, yet forging to a Netscape 6.1 user-agent works just fine. (Must be
2525     just a silly MS goof, I'm sure :-).
2526    
2527     This action is scheduled for improvement.
2528    
2529 Example usage:
2530     +hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}         
2531    
2532
2533 -------------------------------------------------------------------------------
2534 8.5.14. kill-popups
2535
2536 Typical use:
2537     Eliminate those annoying pop-up windows
2538    
2539 Effect:
2540     While loading the document, replace JavaScript code that opens pop-up
2541     windows with (syntactically neutral) dummy code on the fly.
2542    
2543 Type:
2544     Boolean.
2545    
2546 Parameter:
2547     N/A
2548    
2549 Notes:
2550     This action is easily confused with the built-in, hardwired filter action,
2551     but there are important differences: For kill-popups, the document need not
2552     be buffered, so it can be incrementally rendered while downloading. But
2553     kill-popups doesn't catch as many pop-ups as filter{popups} does.
2554    
2555     Think of it as a fast and efficient replacement for a filter that you can
2556     use if you don't want any filtering at all. Note that it doesn't make sense
2557     to combine it with any filter action, since as soon as one filter applies,
2558     the whole document needs to be buffered anyway, which destroys the
2559     advantage of the kill-popups action over its filter equivalent.
2560    
2561     Killing all pop-ups is a dangerous business. Many shops and banks rely on
2562     pop-ups to display forms, shopping carts etc, and killing only the unwanted
2563     pop-ups would require artificial intelligence in Privoxy. If the only kind
2564     of pop-ups that you want to kill are exit consoles (those really nasty
2565     windows that appear when you close an other one), you might want to use 
2566     filter{js-annoyances} instead.
2567    
2568 Example usage:
2569     +kill-popups                                                       
2570    
2571
2572 -------------------------------------------------------------------------------
2573 8.5.15. limit-connect
2574
2575 Typical use:
2576     Prevent abuse of Privoxy as a TCP proxy relay
2577    
2578 Effect:
2579     Specifies to which ports HTTP CONNECT requests are allowable.
2580    
2581 Type:
2582     Parameterized.
2583    
2584 Parameter:
2585     A comma-separated list of ports or port ranges (the latter using dashes,
2586     with the minimum defaulting to 0 and the maximum to 65K).
2587    
2588 Notes:
2589     By default, i.e. if no limit-connect action applies, Privoxy only allows
2590     HTTP CONNECT requests to port 443 (the standard, secure HTTPS port). Use
2591     limit-connect if more fine-grained control is desired for some or all
2592     destinations.
2593    
2594     The CONNECT methods exists in HTTP to allow access to secure websites (
2595     "https://" URLs) through proxies. It works very simply: the proxy connects
2596     to the server on the specified port, and then short-circuits its
2597     connections to the client and to the remote server. This can be a big
2598     security hole, since CONNECT-enabled proxies can be abused as TCP relays
2599     very easily.
2600    
2601     If you don't know what any of this means, there probably is no reason to
2602     change this one, since the default is already very restrictive.
2603    
2604 Example usages:
2605     +limit-connect{443}                   # This is the default and need not be specified.        
2606     +limit-connect{80,443}                # Ports 80 and 443 are OK.                              
2607     +limit-connect{-3, 7, 20-100, 500-}   # Ports less than 3, 7, 20 to 100 and above 500 are OK. 
2608     +limit-connect{-}                     # All ports are OK (gaping security hole!)              
2609    
2610
2611 -------------------------------------------------------------------------------
2612 8.5.16. prevent-compression
2613
2614 Typical use:
2615     Ensure that servers send the content uncompressed, so it can be passed
2616     through filters
2617    
2618 Effect:
2619     Adds a header to the request that asks for uncompressed transfer.
2620    
2621 Type:
2622     Boolean.
2623    
2624 Parameter:
2625     N/A
2626    
2627 Notes:
2628     More and more websites send their content compressed by default, which is
2629     generally a good idea and saves bandwidth. But for the filter, 
2630     deanimate-gifs and kill-popups actions to work, Privoxy needs access to the
2631     uncompressed data. Unfortunately, Privoxy can't yet(!) uncompress, filter,
2632     and re-compress the content on the fly. So if you want to ensure that all
2633     websites, including those that normally compress, can be filtered, you need
2634     to use this action.
2635    
2636     This will slow down transfers from those websites, though. If you use any
2637     of the above-mentioned actions, you will typically want to use
2638     prevent-compression in conjunction with them.
2639    
2640     Note that some (rare) ill-configured sites don't handle requests for
2641     uncompressed documents correctly (they send an empty document body). If you
2642     use prevent-compression per default, you'll have to add exceptions for
2643     those sites. See the example for how to do that.
2644    
2645 Example usage (sections):
2646     # Set default:                                                     
2647     #                                                                  
2648     {+prevent-compression}                                             
2649     / # Match all sites                                                
2650                                                                        
2651     # Make exceptions for ill sites:                                   
2652     #                                                                  
2653     {-prevent-compression}                                             
2654     www.debianhelp.org                                                 
2655     www.pclinuxonline.com                                              
2656    
2657
2658 -------------------------------------------------------------------------------
2659 8.5.17. send-vanilla-wafer
2660
2661 Typical use:
2662     Feed log analysis scripts with useless data.
2663    
2664 Effect:
2665     Sends a cookie with each request stating that you do not accept any
2666     copyright on cookies sent to you, and asking the site operator not to track
2667     you.
2668    
2669 Type:
2670     Boolean.
2671    
2672 Parameter:
2673     N/A
2674    
2675 Notes:
2676     The vanilla wafer is a (relatively) unique header and could conceivably be
2677     used to track you.
2678    
2679     This action is rarely used and not enabled in the default configuration.
2680    
2681 Example usage:
2682     +send-vanilla-wafer                                                
2683    
2684
2685 -------------------------------------------------------------------------------
2686 8.5.18. send-wafer
2687
2688 Typical use:
2689     Send custom cookies or feed log analysis scripts with even more useless
2690     data.
2691    
2692 Effect:
2693     Sends a custom, user-defined cookie with each request.
2694    
2695 Type:
2696     Multi-value.
2697    
2698 Parameter:
2699     A string of the form "name=value".
2700    
2701 Notes:
2702     Being multi-valued, multiple instances of this action can apply to the same
2703     request, resulting in multiple cookies being sent.
2704    
2705     This action is rarely used and not enabled in the default configuration.
2706    
2707 Example usage (section):
2708     {+send-wafer{UsingPrivoxy=true}}                                   
2709     my-internal-testing-server.void                                    
2710    
2711
2712 -------------------------------------------------------------------------------
2713 8.5.19. session-cookies-only
2714
2715 Typical use:
2716     Allow only temporary "session" cookies (for the current browser session
2717     only).
2718    
2719 Effect:
2720     Deletes the "expires" field from "Set-Cookie:" server headers. Most
2721     browsers will not store such cookies permanently and forget them in between
2722     sessions.
2723    
2724 Type:
2725     Boolean.
2726    
2727 Parameter:
2728     N/A
2729    
2730 Notes:
2731     This is less strict than crunch-incoming-cookies / crunch-outgoing-cookies
2732     and allows you to browse websites that insist or rely on setting cookies,
2733     without compromising your privacy too badly.
2734    
2735     Most browsers will not permanently store cookies that have been processed
2736     by session-cookies-only and will forget about them between sessions. This
2737     makes profiling cookies useless, but won't break sites which require
2738     cookies so that you can log in for transactions. This is generally turned
2739     on for all sites, and is the recommended setting.
2740    
2741     It makes no sense at all to use session-cookies-only together with 
2742     crunch-incoming-cookies or crunch-outgoing-cookies. If you do, cookies will
2743     be plainly killed.
2744    
2745     Note that it is up to the browser how it handles such cookies without an 
2746     "expires" field. If you use an exotic browser, you might want to try it out
2747     to be sure.
2748    
2749 Example usage:
2750     +session-cookies-only                                              
2751    
2752
2753 -------------------------------------------------------------------------------
2754 8.5.20. set-image-blocker
2755
2756 Typical use:
2757     Choose the replacement for blocked images
2758    
2759 Effect:
2760     This action alone doesn't do anything noticeable. If both block and 
2761     handle-as-image also apply, i.e. if the request is to be blocked as an
2762     image, then the parameter of this action decides what will be sent as a
2763     replacement.
2764    
2765 Type:
2766     Parameterized.
2767    
2768 Parameter:
2769       + "pattern" to send a built-in checkerboard pattern image. The image is
2770         visually decent, scales very well, and makes it obvious where banners
2771         were busted.
2772        
2773       + "blank" to send a built-in transparent image. This makes banners
2774         disappear completely, but makes it hard to detect where Privoxy has
2775         blocked images on a given page and complicates troubleshooting if 
2776         Privoxy has blocked innocent images, like navigation icons.
2777        
2778       + "target-url" to send a redirect to target-url. You can redirect to any
2779         image anywhere, even in your local filesystem (via "file:///" URL).
2780        
2781         A good application of redirects is to use special Privoxy-built-in
2782         URLs, which send the built-in images, as target-url. This has the same
2783         visual effect as specifying "blank" or "pattern" in the first place,
2784         but enables your browser to cache the replacement image, instead of
2785         requesting it over and over again.
2786        
2787    
2788 Notes:
2789     The URLs for the built-in images are "http://config.privoxy.org/
2790     send-banner?type=type", where type is either "blank" or "pattern".
2791    
2792     There is a third (advanced) type, called "auto". It is NOT to be used in
2793     set-image-blocker, but meant for use from filters. Auto will select the
2794     type of image that would have applied to the referring page, had it been an
2795     image.
2796    
2797 Example usage:
2798     Built-in pattern:
2799    
2800     +set-image-blocker{pattern}                                        
2801    
2802     Redirect to the BSD devil:
2803    
2804     +set-image-blocker{http://www.freebsd.org/gifs/dae_up3.gif}        
2805    
2806     Redirect to the built-in pattern for better caching:
2807    
2808     +set-image-blocker{http://config.privoxy.org/send-banner?type=pattern}
2809    
2810
2811 -------------------------------------------------------------------------------
2812 8.5.21. Summary
2813
2814 Note that many of these actions have the potential to cause a page to
2815 misbehave, possibly even not to display at all. There are many ways a site
2816 designer may choose to design his site, and what HTTP header content, and other
2817 criteria, he may depend on. There is no way to have hard and fast rules for all
2818 sites. See the Appendix for a brief example on troubleshooting actions.
2819 -------------------------------------------------------------------------------
2820
2821 8.6. Aliases
2822
2823 Custom "actions", known to Privoxy as "aliases", can be defined by combining
2824 other actions. These can in turn be invoked just like the built-in actions.
2825 Currently, an alias name can contain any character except space, tab, "=", "{"
2826 and "}", but we strongly recommend that you only use "a" to "z", "0" to "9", 
2827 "+", and "-". Alias names are not case sensitive, and are not required to start
2828 with a "+" or "-" sign, since they are merely textually expanded.
2829
2830 Aliases can be used throughout the actions file, but they must be defined in a
2831 special section at the top of the file! And there can only be one such section
2832 per actions file. Each actions file may have its own alias section, and the
2833 aliases defined in it are only visible within that file.
2834
2835 There are two main reasons to use aliases: One is to save typing for frequently
2836 used combinations of actions, the other one is a gain in flexibility: If you
2837 decide once how you want to handle shops by defining an alias called "shop",
2838 you can later change your policy on shops in one place, and your changes will
2839 take effect everywhere in the actions file where the "shop" alias is used.
2840 Calling aliases by their purpose also makes your actions files more readable.
2841
2842 Currently, there is one big drawback to using aliases, though: Privoxy's
2843 built-in web-based action file editor honors aliases when reading the actions
2844 files, but it expands them before writing. So the effects of your aliases are
2845 of course preserved, but the aliases themselves are lost when you edit sections
2846 that use aliases with it. This is likely to change in future versions of 
2847 Privoxy.
2848
2849 Now let's define some aliases...
2850
2851  # Useful custom aliases we can use later.                                                   
2852  #                                                                                           
2853  # Note the (required!) section header line and that this section                            
2854  # must be at the top of the actions file!                                                   
2855  #                                                                                           
2856  {{alias}}                                                                                   
2857                                                                                              
2858  # These aliases just save typing later:                                                     
2859  # (Note that some already use other aliases!)                                               
2860  #                                                                                           
2861  +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies                     
2862  -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies                     
2863  block-as-image      = +block +handle-as-image                                               
2864  mercy-for-cookies   = -crunch-all-cookies -session-cookies-only                             
2865                                                                                              
2866  # These aliases define combinations of actions                                              
2867  # that are useful for certain types of sites:                                               
2868  #                                                                                           
2869  fragile     = -block -crunch-all-cookies -filter -fast-redirects -hide-referer -kill-popups 
2870  shop        = -crunch-all-cookies -filter{popups} -kill-popups                              
2871                                                                                              
2872  # Short names for other aliases, for really lazy people ;-)                                 
2873  #                                                                                           
2874  c0 = +crunch-all-cookies                                                                    
2875  c1 = -crunch-all-cookies                                                                    
2876
2877 ...and put them to use. These sections would appear in the lower part of an
2878 actions file and define exceptions to the default actions (as specified further
2879 up for the "/" pattern):
2880
2881  # These sites are either very complex or very keen on                         
2882  # user data and require minimal interference to work:                         
2883  #                                                                             
2884  {fragile}                                                                     
2885  .office.microsoft.com                                                         
2886  .windowsupdate.microsoft.com                                                  
2887  .nytimes.com                                                                  
2888                                                                                
2889  # Shopping sites:                                                             
2890  # Allow cookies (for setting and retrieving your customer data)               
2891  #                                                                             
2892  {shop}                                                                        
2893  .quietpc.com                                                                  
2894  .worldpay.com   # for quietpc.com                                             
2895  .scan.co.uk                                                                   
2896                                                                                
2897  # These shops require pop-ups:                                                
2898  #                                                                             
2899  {shop -kill-popups -filter{popups}}                                           
2900   .dabs.com                                                                    
2901   .overclockers.co.uk                                                          
2902
2903 Aliases like "shop" and "fragile" are often used for "problem" sites that
2904 require some actions to be disabled in order to function properly.
2905 -------------------------------------------------------------------------------
2906
2907 8.7. Actions Files Tutorial
2908
2909 The above chapters have shown which actions files there are and how they are
2910 organized, how actions are specified and applied to URLs, how patterns work,
2911 and how to define and use aliases. Now, let's look at an example default.action
2912 and user.action file and see how all these pieces come together:
2913 -------------------------------------------------------------------------------
2914
2915 8.7.1. default.action
2916
2917 Every config file should start with a short comment stating its purpose:
2918
2919 # Sample default.action file <developers@privoxy.org>                          
2920
2921 Then, since this is the default.action file, the first section is a special
2922 section for internal use that you needn't change or worry about:
2923
2924 ##########################################################################     
2925 # Settings -- Don't change! For internal Privoxy use ONLY.                     
2926 ##########################################################################     
2927                                                                                
2928 {{settings}}                                                                   
2929 for-privoxy-version=3.0                                                        
2930
2931 After that comes the (optional) alias section. We'll use the example section
2932 from the above chapter on aliases, that also explains why and how aliases are
2933 used:
2934
2935 ##########################################################################                  
2936 # Aliases                                                                                   
2937 ##########################################################################                  
2938 {{alias}}                                                                                   
2939                                                                                             
2940 # These aliases just save typing later:                                                     
2941 # (Note that some already use other aliases!)                                               
2942 #                                                                                           
2943 +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies                     
2944 -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies                     
2945 block-as-image      = +block +handle-as-image                                               
2946 mercy-for-cookies   = -crunch-all-cookies -session-cookies-only                             
2947                                                                                             
2948 # These aliases define combinations of actions                                              
2949 # that are useful for certain types of sites:                                               
2950 #                                                                                           
2951 fragile     = -block -crunch-all-cookies -filter -fast-redirects -hide-referer -kill-popups 
2952 shop        = mercy-for-cookies -filter{popups} -kill-popups                                
2953
2954 Now come the regular sections, i.e. sets of actions, accompanied by URL
2955 patterns to which they apply. Remember all actions are disabled when matching
2956 starts, so we have to explicitly enable the ones we want.
2957
2958 The first regular section is probably the most important. It has only one
2959 pattern, "/", but this pattern matches all URLs. Therefore, the set of actions
2960 used in this "default" section will be applied to all requests as a start. It
2961 can be partly or wholly overridden by later matches further down this file, or
2962 in user.action, but it will still be largely responsible for your overall
2963 browsing experience.
2964
2965 Again, at the start of matching, all actions are disabled, so there is no real
2966 need to disable any actions here, but we will do that nonetheless, to have a
2967 complete listing for your reference. (Remember: a "+" preceding the action name
2968 enables the action, a "-" disables!). Also note how this long line has been
2969 made more readable by splitting it into multiple lines with line continuation.
2970
2971 ##########################################################################     
2972 # "Defaults" section:                                                          
2973 ##########################################################################     
2974  { \                                                                           
2975  -add-header \                                                                 
2976  -block \                                                                      
2977  -crunch-incoming-cookies \                                                    
2978  -crunch-outgoing-cookies \                                                    
2979  +deanimate-gifs \                                                             
2980  -downgrade-http-version \                                                     
2981  +fast-redirects \                                                             
2982  +filter{html-annoyances} \                                                    
2983  +filter{js-annoyances} \                                                      
2984  -filter{content-cookies} \                                                    
2985  +filter{popups} \                                                             
2986  +filter{webbugs} \                                                            
2987  -filter{refresh-tags} \                                                       
2988  -filter{fun} \                                                                
2989  +filter{nimda} \                                                              
2990  +filter{banners-by-size} \                                                    
2991  -filter{banners-by-link} \                                                    
2992  -filter{img-reorder} \                                                        
2993  -filter{shockwave-flash} \                                                    
2994  -filter{crude-parental} \                                                     
2995  -filter{js-events} \                                                          
2996  -handle-as-image \                                                            
2997  +hide-forwarded-for-headers \                                                 
2998  +hide-from-header{block} \                                                    
2999  +hide-referrer{forge} \                                                       
3000  -hide-user-agent \                                                            
3001  -kill-popups \                                                                
3002  -limit-connect \                                                              
3003  +prevent-compression \                                                        
3004  -send-vanilla-wafer \                                                         
3005  -send-wafer \                                                                 
3006  +session-cookies-only \                                                       
3007  +set-image-blocker{pattern} \                                                 
3008  }                                                                             
3009  / # forward slash will match *all* potential URL patterns.                    
3010
3011 The default behavior is now set. Note that some actions, like not hiding the
3012 user agent, are part of a "general policy" that applies universally and won't
3013 get any exceptions defined later. Other choices, like not blocking (which is
3014 understandably the default!) need exceptions, i.e. we need to specify
3015 explicitly what we want to block in later sections. We will also want to make
3016 exceptions from our general pop-up-killing, and use our defined aliases for
3017 that.
3018
3019 The first of our specialized sections is concerned with "fragile" sites, i.e.
3020 sites that require minimum interference, because they are either very complex
3021 or very keen on tracking you (and have mechanisms in place that make them
3022 unusable for people who avoid being tracked). We will simply use our
3023 pre-defined fragile alias instead of stating the list of actions explicitly:
3024
3025 ##########################################################################     
3026 # Exceptions for sites that'll break under the default action set:             
3027 ##########################################################################     
3028                                                                                
3029 # "Fragile" Use a minimum set of actions for these sites (see alias above):    
3030 #                                                                              
3031 { fragile }                                                                    
3032 .office.microsoft.com           # surprise, surprise!                          
3033 .windowsupdate.microsoft.com                                                   
3034
3035 Shopping sites are not as fragile, but they typically require cookies to log
3036 in, and pop-up windows for shopping carts or item details. Again, we'll use a
3037 pre-defined alias:
3038
3039 # Shopping sites:                                                              
3040 #                                                                              
3041 { shop }                                                                       
3042 .quietpc.com                                                                   
3043 .worldpay.com   # for quietpc.com                                              
3044 .jungle.com                                                                    
3045 .scan.co.uk                                                                    
3046
3047 Then, there are sites which rely on pop-up windows (yuck!) to work. Since we
3048 made pop-up-killing our default above, we need to make exceptions now. Mozilla
3049 users, who can turn on smart handling of unwanted pop-ups in their browsers,
3050 can safely choose -filter{popups} (and -kill-popups) above and hence don't need
3051 this section. Anyway, disabling an already disabled action doesn't hurt, so
3052 we'll define our exceptions regardless of what was chosen in the defaults
3053 section:
3054
3055 # These sites require pop-ups too :(                                           
3056 #                                                                              
3057 { -kill-popups -filter{popups} }                                               
3058 .dabs.com                                                                      
3059 .overclockers.co.uk                                                            
3060 .deutsche-bank-24.de                                                           
3061
3062 The fast-redirects action, which we enabled per default above, breaks some
3063 sites. So disable it for popular sites where we know it misbehaves:
3064
3065 { -fast-redirects }                                                            
3066 login.yahoo.com                                                                
3067 edit.*.yahoo.com                                                               
3068 .google.com                                                                    
3069 .altavista.com/.*(like|url|link):http                                          
3070 .altavista.com/trans.*urltext=http                                             
3071 .nytimes.com                                                                   
3072
3073 It is important that Privoxy knows which URLs belong to images, so that if they
3074 are to be blocked, a substitute image can be sent, rather than an HTML page.
3075 Contacting the remote site to find out is not an option, since it would destroy
3076 the loading time advantage of banner blocking, and it would feed the
3077 advertisers (in terms of money and information). We can mark any URL as an
3078 image with the handle-as-image action, and marking all URLs that end in a known
3079 image file extension is a good start:
3080
3081 ##########################################################################     
3082 # Images:                                                                      
3083 ##########################################################################     
3084                                                                                
3085 # Define which file types will be treated as images, in case they get          
3086 # blocked further down this file:                                              
3087 #                                                                              
3088 { +handle-as-image }                                                           
3089 /.*\.(gif|jpe?g|png|bmp|ico)$                                                  
3090
3091 And then there are known banner sources. They often use scripts to generate the
3092 banners, so it won't be visible from the URL that the request is for an image.
3093 Hence we block them and mark them as images in one go, with the help of our
3094 block-as-image alias defined above. (We could of course just as well use +block
3095 +handle-as-image here.) Remember that the type of the replacement image is
3096 chosen by the set-image-blocker action. Since all URLs have matched the default
3097 section with its +set-image-blocker{pattern} action before, it still applies
3098 and needn't be repeated:
3099
3100 # Known ad generators:                                                         
3101 #                                                                              
3102 { block-as-image }                                                             
3103 ar.atwola.com                                                                  
3104 .ad.doubleclick.net                                                            
3105 .ad.*.doubleclick.net                                                          
3106 .a.yimg.com/(?:(?!/i/).)*$                                                     
3107 .a[0-9].yimg.com/(?:(?!/i/).)*$                                                
3108 bs*.gsanet.com                                                                 
3109 bs*.einets.com                                                                 
3110 .qkimg.net                                                                     
3111
3112 One of the most important jobs of Privoxy is to block banners. A huge bunch of
3113 them are already "blocked" by the filter{banners-by-size} action, which we
3114 enabled above, and which deletes the references to banner images from the pages
3115 while they are loaded, so the browser doesn't request them anymore, and hence
3116 they don't need to be blocked here. But this naturally doesn't catch all
3117 banners, and some people choose not to use filters, so we need a comprehensive
3118 list of patterns for banner URLs here, and apply the block action to them.
3119
3120 First comes a bunch of generic patterns, which do most of the work, by matching
3121 typical domain and path name components of banners. Then comes a list of
3122 individual patterns for specific sites, which is omitted here to keep the
3123 example short:
3124
3125 ##########################################################################     
3126 # Block these fine banners:                                                    
3127 ##########################################################################     
3128 { +block }                                                                     
3129                                                                                
3130 # Generic patterns:                                                            
3131 #                                                                              
3132 ad*.                                                                           
3133 .*ads.                                                                         
3134 banner?.                                                                       
3135 count*.                                                                        
3136 /.*count(er)?\.(pl|cgi|exe|dll|asp|php[34]?)                                   
3137 /(?:.*/)?(publicite|werbung|rekla(ma|me|am)|annonse|maino(kset|nta|s)?)/       
3138                                                                                
3139 # Site-specific patterns (abbreviated):                                        
3140 #                                                                              
3141 .hitbox.com                                                                    
3142
3143 You wouldn't believe how many advertisers actually call their banner servers
3144 ads.company.com, or call the directory in which the banners are stored simply 
3145 "banners". So the above generic patterns are surprisingly effective.
3146
3147 But being very generic, they necessarily also catch URLs that we don't want to
3148 block. The pattern .*ads. e.g. catches "nasty-ads.nasty-corp.com" as intended,
3149 but also "downloads.sourcefroge.net" or "adsl.some-provider.net." So here come
3150 some well-known exceptions to the +block section above.
3151
3152 Note that these are exceptions to exceptions from the default! Consider the URL
3153 "downloads.sourcefroge.net": Initially, all actions are deactivated, so it
3154 wouldn't get blocked. Then comes the defaults section, which matches the URL,
3155 but just deactivates the block action once again. Then it matches .*ads., an
3156 exception to the general non-blocking policy, and suddenly +block applies. And
3157 now, it'll match .*loads., where -block applies, so (unless it matches again
3158 further down) it ends up with no block action applying.
3159
3160 ##########################################################################     
3161 # Save some innocent victims of the above generic block patterns:              
3162 ##########################################################################     
3163                                                                                
3164 # By domain:                                                                   
3165 #                                                                              
3166 { -block }                                                                     
3167 adv[io]*.  # (for advogato.org and advice.*)                                   
3168 adsl.      # (has nothing to do with ads)                                      
3169 ad[ud]*.   # (adult.* and add.*)                                               
3170 .edu       # (universities don't host banners (yet!))                          
3171 .*loads.   # (downloads, uploads etc)                                          
3172                                                                                
3173 # By path:                                                                     
3174 #                                                                              
3175 /.*loads/                                                                      
3176                                                                                
3177 # Site-specific:                                                               
3178 #                                                                              
3179 www.globalintersec.com/adv # (adv = advanced)                                  
3180 www.ugu.com/sui/ugu/adv                                                        
3181
3182 Filtering source code can have nasty side effects, so make an exception for our
3183 friends at sourceforge.net, and all paths with "cvs" in them. Note that -filter
3184 disables all filters in one fell swoop!
3185
3186 # Don't filter code!                                                           
3187 #                                                                              
3188 { -filter }                                                                    
3189 /.*cvs                                                                         
3190 .sourceforge.net                                                               
3191
3192 The actual default.action is of course more comprehensive, but we hope this
3193 example made clear how it works.
3194 -------------------------------------------------------------------------------
3195
3196 8.7.2. user.action
3197
3198 So far we are painting with a broad brush by setting general policies, which
3199 would be a reasonable starting point for many people. Now, you might want to be
3200 more specific and have customized rules that are more suitable to your personal
3201 habits and preferences. These would be for narrowly defined situations like
3202 your ISP or your bank, and should be placed in user.action, which is parsed
3203 after all other actions files and hence has the last word, over-riding any
3204 previously defined actions. user.action is also a safe place for your personal
3205 settings, since default.action is actively maintained by the Privoxy developers
3206 and you'll probably want to install updated versions from time to time.
3207
3208 So let's look at a few examples of things that one might typically do in
3209 user.action:
3210
3211 # My user.action file. <fred@foobar.com>                                       
3212
3213 As aliases are local to the actions file that they are defined in, you can't
3214 use the ones from default.action, unless you repeat them here:
3215
3216 # (Re-)define aliases for this file:                                                        
3217 #                                                                                           
3218 {{alias}}                                                                                   
3219 -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies                     
3220 mercy-for-cookies   = -crunch-all-cookies -session-cookies-only                             
3221 fragile     = -block -crunch-all-cookies -filter -fast-redirects -hide-referer -kill-popups 
3222 shop        = mercy-for-cookies -filter{popups} -kill-popups                                
3223 allow-ads   = -block -filter{banners-by-size} # (see below)                                 
3224
3225 Say you have accounts on some sites that you visit regularly, and you don't
3226 want to have to log in manually each time. So you'd like to allow persistent
3227 cookies for these sites. The mercy-for-cookies alias defined above does exactly
3228 that, i.e. it disables crunching of cookies in any direction, and processing of
3229 cookies to make them temporary.
3230
3231 { mercy-for-cookies }                                                          
3232 sunsolve.sun.com                                                               
3233 slashdot.org                                                                   
3234 .yahoo.com                                                                     
3235 .msdn.microsoft.com                                                            
3236 .redhat.com                                                                    
3237
3238 Your bank needs popups and is allergic to some filter, but you don't know
3239 which, so you disable them all:
3240
3241 { -filter -kill-popups }                                                       
3242 .your-home-banking-site.com                                                    
3243
3244 While browsing the web with Privoxy you noticed some ads that sneaked through,
3245 but you were too lazy to report them through our fine and easy feedback system,
3246 so you have added them here:
3247
3248 { +block }                                                                     
3249 www.a-popular-site.com/some/unobvious/path                                     
3250 another.popular.site.net/more/junk/here/                                       
3251
3252 Note that, assuming the banners in the above example have regular image
3253 extensions (most do), +handle-as-image need not be specified, since all URLs
3254 ending in these extensions will already have been tagged as images in the
3255 relevant section of default.action by now.
3256
3257 Then you noticed that the default configuration breaks Forbes Magazine, but you
3258 were too lazy to find out which action is the culprit, and you were again too
3259 lazy to give feedback, so you just used the fragile alias on the site, and --
3260 whoa! -- it worked:
3261
3262 { fragile }                                                                    
3263 .forbes.com                                                                    
3264
3265 You like the "fun" text replacements in default.filter, but it is disabled in
3266 the distributed actions file. (My colleagues on the team just don't have a
3267 sense of humour, that's why! ;-). So you'd like to turn it on in your private,
3268 update-safe config, once and for all:
3269
3270 { +filter{fun} }                                                               
3271 / # For ALL sites!                                                             
3272
3273 Note that the above is not really a good idea: There are exceptions to the
3274 filters in default.action for things that really shouldn't be filtered, like
3275 code on CVS->Web interfaces. Since user.action has the last word, these
3276 exceptions won't be valid for the "fun" filtering specified here.
3277
3278 Finally, you might think about how your favourite free websites are funded, and
3279 find that they rely on displaying banner advertisements to survive. So you
3280 might want to specifically allow banners for those sites that you feel provide
3281 value to you:
3282
3283 { allow-ads }                                                                  
3284 .sourceforge.net                                                               
3285 .slashdot.org                                                                  
3286 .osdn.net                                                                      
3287
3288 Note that allow-ads has been aliased to -block -filter{banners-by-size} above.
3289 -------------------------------------------------------------------------------
3290
3291 9. The Filter File
3292
3293 All text substitutions that can be invoked through the filter action must first
3294 be defined in the filter file, which is typically called default.filter and
3295 which can be selected through the filterfile config option.
3296
3297 Typical reasons for doing such substitutions are to eliminate common annoyances
3298 in HTML and JavaScript, such as pop-up windows, exit consoles, crippled windows
3299 without navigation tools, the infamous <BLINK> tag etc, to suppress images with
3300 certain width and height attributes (standard banner sizes or web-bugs), or
3301 just to have fun. The possibilities are endless.
3302
3303 Filtering works on any text-based document type, including plain text, HTML,
3304 JavaScript, CSS etc. (all text/* MIME types). Substitutions are made at the
3305 source level, so if you want to "roll your own" filters, you should be familiar
3306 with HTML syntax.
3307
3308 Just like the actions files, the filter file is organized in sections, which
3309 are called filters here. Each filter consists of a heading line, that starts
3310 with the keyword FILTER:, followed by the filter's name, and a short (one line)
3311 description of what it does. Below that line come the jobs, i.e. lines that
3312 define the actual text substitutions. By convention, the name of a filter
3313 should describe what the filter eliminates. The comment is used in the 
3314 web-based user interface.
3315
3316 Once a filter called name has been defined in the filter file, it can be
3317 invoked by using an action of the form +filter{name} in any actions file.
3318
3319 A filter header line for a filter called "foo" could look like this:
3320
3321 FILTER: foo Replace all "foo" with "bar"                                       
3322
3323 Below that line, and up to the next header line, come the jobs that define what
3324 text replacements the filter executes. They are specified in a syntax that
3325 imitates Perl's s/// operator. If you are familiar with Perl, you will find
3326 this to be quite intuitive, and may want to look at the PCRS man page for the
3327 subtle differences to Perl behaviour. Most notably, the non-standard option
3328 letter U is supported, which turns the default to ungreedy matching.
3329
3330 If you are new to regular expressions, you might want to take a look at the 
3331 Appendix on regular expressions, and see the Perl manual for the s///
3332 operator's syntax and Perl-style regular expressions in general. The below
3333 examples might also help to get you started.
3334 -------------------------------------------------------------------------------
3335
3336 9.1. Filter File Tutorial
3337
3338 Now, let's complete our "foo" filter. We have already defined the heading, but
3339 the jobs are still missing. Since all it does is to replace "foo" with "bar",
3340 there is only one (trivial) job needed:
3341
3342 s/foo/bar/                                                                     
3343
3344 But wait! Didn't the comment say that all occurrences of "foo" should be
3345 replaced? Our current job will only take care of the first "foo" on each page.
3346 For global substitution, we'll need to add the g option:
3347
3348 s/foo/bar/g                                                                    
3349
3350 Our complete filter now looks like this:
3351
3352 FILTER: foo Replace all "foo" with "bar"                                       
3353 s/foo/bar/g                                                                    
3354
3355 Let's look at some real filters for more interesting examples. Here you see a
3356 filter that protects against some common annoyances that arise from JavaScript
3357 abuse. Let's look at its jobs one after the other:
3358
3359 FILTER: js-annoyances Get rid of particularly annoying JavaScript abuse                         
3360                                                                                                 
3361 # Get rid of JavaScript referrer tracking. Test page: http://www.randomoddness.com/untitled.htm 
3362 #                                                                                               
3363 s|(<script.*)document\.referrer(.*</script>)|$1"Not Your Business!"$2|Usg                       
3364
3365 Following the header line and a comment, you see the job. Note that it uses |
3366 as the delimiter instead of /, because the pattern contains a forward slash,
3367 which would otherwise have to be escaped by a backslash (\).
3368
3369 Now, let's examine the pattern: it starts with the text <script.* enclosed in
3370 parentheses. Since the dot matches any character, and * means: "Match an
3371 arbitrary number of the element left of myself", this matches "<script",
3372 followed by any text, i.e. it matches the whole page, from the start of the
3373 first <script> tag.
3374
3375 That's more than we want, but the pattern continues: document\.referrer matches
3376 only the exact string "document.referrer". The dot needed to be escaped, i.e.
3377 preceded by a backslash, to take away its special meaning as a joker, and make
3378 it just a regular dot. So far, the meaning is: Match from the start of the
3379 first <script> tag in a the page, up to, and including, the text 
3380 "document.referrer", if both are present in the page (and appear in that
3381 order).
3382
3383 But there's still more pattern to go. The next element, again enclosed in
3384 parentheses, is .*</script>. You already know what .* means, so the whole
3385 pattern translates to: Match from the start of the first <script> tag in a page
3386 to the end of the last <script> tag, provided that the text "document.referrer"
3387 appears somewhere in between.
3388
3389 This is still not the whole story, since we have ignored the options and the
3390 parentheses: The portions of the page matched by sub-patterns that are enclosed
3391 in parentheses, will be remembered and be available through the variables $1,
3392 $2, ... in the substitute. The U option switches to ungreedy matching, which
3393 means that the first .* in the pattern will only "eat up" all text in between "
3394 <script" and the first occurrence of "document.referrer", and that the second .
3395 * will only span the text up to the first "</script>" tag. Furthermore, the s
3396 option says that the match may span multiple lines in the page, and the g
3397 option again means that the substitution is global.
3398
3399 So, to summarize, the pattern means: Match all scripts that contain the text 
3400 "document.referrer". Remember the parts of the script from (and including) the
3401 start tag up to (and excluding) the string "document.referrer" as $1, and the
3402 part following that string, up to and including the closing tag, as $2.
3403
3404 Now the pattern is deciphered, but wasn't this about substituting things? So
3405 lets look at the substitute: $1"Not Your Business!"$2 is easy to read: The text
3406 remembered as $1, followed by "Not Your Business!" (including the quotation
3407 marks!), followed by the text remembered as $2. This produces an exact copy of
3408 the original string, with the middle part (the "document.referrer") replaced by
3409 "Not Your Business!".
3410
3411 The whole job now reads: Replace "document.referrer" by "Not Your Business!"
3412 wherever it appears inside a <script> tag. Note that this job won't break
3413 JavaScript syntax, since both the original and the replacement are
3414 syntactically valid string objects. The script just won't have access to the
3415 referrer information anymore.
3416
3417 We'll show you two other jobs from the JavaScript taming department, but this
3418 time only point out the constructs of special interest:
3419
3420 # The status bar is for displaying link targets, not pointless blahblah        
3421 #                                                                              
3422 s/window\.status\s*=\s*(['"]).*?\1/dUmMy=1/ig                                  
3423
3424 \s stands for whitespace characters (space, tab, newline, carriage return, form
3425 feed), so that \s* means: "zero or more whitespace". The ? in .*? makes this
3426 matching of arbitrary text ungreedy. (Note that the U option is not set). The
3427 ['"] construct means: "a single or a double quote". Finally, \1 is a
3428 backreference to the first parenthesis just like $1 above, with the difference
3429 that in the pattern, a backslash indicates a backreference, whereas in the
3430 substitute, it's the dollar.
3431
3432 So what does this job do? It replaces assignments of single- or double-quoted
3433 strings to the "window.status" object with a dummy assignment (using a variable
3434 name that is hopefully odd enough not to conflict with real variables in
3435 scripts). Thus, it catches many cases where e.g. pointless descriptions are
3436 displayed in the status bar instead of the link target when you move your mouse
3437 over links.
3438
3439 # Kill OnUnload popups. Yummy. Test: http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html 
3440 #                                                                                    
3441 s/(<body [^>]*)onunload(.*>)/$1never$2/iU                                            
3442
3443 Including the OnUnload event binding in the HTML DOM was a CRIME. When I close
3444 a browser window, I want it to close and die. Basta. This job replaces the 
3445 "onunload" attribute in "<body>" tags with the dummy word never. Note that the
3446 i option makes the pattern matching case-insensitive. Also note that ungreedy
3447 matching alone doesn't always guarantee a minimal match: In the first
3448 parenthesis, we had to use [^>]* instead of .* to prevent the match from
3449 exceeding the <body> tag if it doesn't contain "OnUnload", but the page's
3450 content does.
3451
3452 The last example is from the fun department:
3453
3454 FILTER: fun Fun text replacements                                              
3455                                                                                
3456 # Spice the daily news:                                                        
3457 #                                                                              
3458 s/microsoft(?!\.com)/MicroSuck/ig                                              
3459
3460 Note the (?!\.com) part (a so-called negative lookahead) in the job's pattern,
3461 which means: Don't match, if the string ".com" appears directly following 
3462 "microsoft" in the page. This prevents links to microsoft.com from being
3463 trashed, while still replacing the word everywhere else.
3464
3465 # Buzzword Bingo (example for extended regex syntax)                           
3466 #                                                                              
3467 s* industry[ -]leading \                                                       
3468 |  cutting[ -]edge \                                                           
3469 |  customer[ -]focused \                                                       
3470 |  market[ -]driven \                                                          
3471 |  award[ -]winning # Comments are OK, too! \                                  
3472 |  high[ -]performance \                                                       
3473 |  solutions[ -]based \                                                        
3474 |  unmatched \                                                                 
3475 |  unparalleled \                                                              
3476 |  unrivalled \                                                                
3477 *<font color="red"><b>BINGO!</b></font> \                                      
3478 *igx                                                                           
3479
3480 The x option in this job turns on extended syntax, and allows for e.g. the
3481 liberal use of (non-interpreted!) whitespace for nicer formatting.
3482
3483 You get the idea?
3484 -------------------------------------------------------------------------------
3485
3486 10. Templates
3487
3488 All Privoxy built-in pages, i.e. error pages such as the "404 - No Such Domain"
3489 error page, the "BLOCKED" page and all pages of its web-based user interface,
3490 are generated from templates. (Privoxy must be running for the above links to
3491 work as intended.)
3492
3493 These templates are stored in a subdirectory of the configuration directory
3494 called templates. On Unixish platforms, this is typically /etc/privoxy/
3495 templates/.
3496
3497 The templates are basically normal HTML files, but with place-holders (called
3498 symbols or exports), which Privoxy fills at run time. You can edit the
3499 templates with a normal text editor, should you want to customize them. (Not
3500 recommended for the casual user). Note that just like in configuration files,
3501 lines starting with # are ignored when the templates are filled in.
3502
3503 The place-holders are of the form @name@, and you will find a list of available
3504 symbols, which vary from template to template, in the comments at the start of
3505 each file. Note that these comments are not always accurate, and that it's
3506 probably best to look at the existing HTML code to find out which symbols are
3507 supported and what they are filled in with.
3508
3509 A special application of this substitution mechanism is to make whole blocks of
3510 HTML code disappear when a specific symbol is set. We use this for many
3511 purposes, one of them being to include the beta warning in all our user
3512 interface (CGI) pages when Privoxy in in an alpha or beta development stage:
3513
3514 <!-- @if-unstable-start -->                                                    
3515                                                                                
3516   ... beta warning HTML code goes here ...                                     
3517                                                                                
3518 <!-- if-unstable-end@ -->                                                      
3519
3520 If the "unstable" symbol is set, everything in between and including
3521 @if-unstable-start and if-unstable-end@ will disappear, leaving nothing but an
3522 empty comment:
3523
3524 <!--  -->                                                                      
3525
3526 There's also an if-then-else construct and an #include mechanism, but you'll
3527 sure find out if you are inclined to edit the templates ;-)
3528
3529 All templates refer to a style located at http://config.privoxy.org/
3530 send-stylesheet. This is, of course, locally served by Privoxy and the source
3531 for it can be found and edited in the cgi-style.css template.
3532 -------------------------------------------------------------------------------
3533
3534 11. Contacting the Developers, Bug Reporting and Feature Requests
3535
3536 We value your feedback. In fact, we rely on it to improve Privoxy and its
3537 configuration. However, please note the following hints, so we can provide you
3538 with the best support:
3539 -------------------------------------------------------------------------------
3540
3541 11.1. Get Support
3542
3543 For casual users, our support forum at SourceForge is probably best suited: 
3544 http://sourceforge.net/tracker/?group_id=11118&atid=211118
3545
3546 All users are of course welcome to discuss their issues on the users mailing
3547 list, where the developers also hang around.
3548 -------------------------------------------------------------------------------
3549
3550 11.2. Report Bugs
3551
3552 Please report all bugs only through our bug tracker: http://sourceforge.net/
3553 tracker/?group_id=11118&atid=111118.
3554
3555 Before doing so, please make sure that the bug has not already been submitted
3556 and observe the additional hints at the top of the submit form.
3557
3558 Please try to verify that it is a Privoxy bug, and not a browser or site bug
3559 first. If unsure, try toggling off Privoxy, and see if the problem persists.
3560 The appendix of the user manual also has helpful information on action
3561 debugging. If you are using your own custom configuration, please try the stock
3562 configs to see if the problem is configuration related.
3563
3564 If not using the latest version, chances are that the bug has been found and
3565 fixed in the meantime. We would appreciate if you could take the time to 
3566 upgrade to the latest version (or even the latest CVS snapshot) and verify your
3567 bug, but this is not required for reporting.
3568 -------------------------------------------------------------------------------
3569
3570 11.3. Request New Features
3571
3572 You are welcome to submit ideas on new features or other proposals for
3573 improvement through our feature request tracker at http://sourceforge.net/
3574 tracker/?atid=361118&group_id=11118.
3575 -------------------------------------------------------------------------------
3576
3577 11.4. Report Ads or Other Actions-Related Problems
3578
3579 Please send feedback on ads that slipped through, innocent images that were
3580 blocked, and any other problems relating to the default.action file through our
3581 actions feedback mechanism located at http://www.privoxy.org/actions/. On this
3582 page, you will also find a bookmark which will take you back there from any
3583 troubled site and even pre-fill the form!
3584
3585 New, improved default.action files will occasionally be made available based on
3586 your feedback. These will be announced on the ijbswa-announce list and
3587 available from our the files section of our project page.
3588 -------------------------------------------------------------------------------
3589
3590 11.5. Other
3591
3592 For any other issues, feel free to use the mailing lists. Technically
3593 interested users and people who wish to contribute to the project are also
3594 welcome on the developers list! You can find an overview of all Privoxy-related
3595 mailing lists, including list archives, at: http://sourceforge.net/mail/?
3596 group_id=11118.
3597 -------------------------------------------------------------------------------
3598
3599 12. Privoxy Copyright, License and History
3600
3601 Copyright © 2001, 2002 by Privoxy Developers <developers@privoxy.org>
3602
3603 Some source code is based on code Copyright © 1997 by Anonymous Coders and
3604 Junkbusters, Inc. and licensed under the GNU General Public License.
3605 -------------------------------------------------------------------------------
3606
3607 12.1. License
3608
3609 Privoxy is free software; you can redistribute it and/or modify it under the
3610 terms of the GNU General Public License, version 2, as published by the Free
3611 Software Foundation.
3612
3613 This program is distributed in the hope that it will be useful, but WITHOUT ANY
3614 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
3615 PARTICULAR PURPOSE. See the GNU General Public License for more details, which
3616 is available from the Free Software Foundation, Inc, 59 Temple Place - Suite
3617 330, Boston, MA 02111-1307, USA.
3618
3619 You should have received a copy of the GNU General Public License along with
3620 this program; if not, write to the
3621
3622  Free Software
3623  Foundation, Inc. 59 Temple Place - Suite 330
3624  Boston, MA 02111-1307
3625  USA 
3626 -------------------------------------------------------------------------------
3627
3628 12.2. History
3629
3630 In the beginning, there was the Internet Junkbuster, by Anonymous Coders and 
3631 Junkbusters Corporation. It saved many users a lot of pain in the early days of
3632 web advertising and user tracking.
3633
3634 But the web, its protocols and standards, and with it, the techniques for
3635 forcing users to consume ads, give up autonomy over their browsing, and for
3636 spying on them, kept evolving. Unfortunately, the Internet Junkbuster did not.
3637 Version 2.0.2, published in 1998, was (and is) the last official release
3638 available from Junkbusters Corporation. Fortunately, it had been released under
3639 the GNU GPL, which allowed further development by others.
3640
3641 So Stefan Waldherr started maintaining an improved version of the software, to
3642 which eventually a number of people contributed patches. It could already
3643 replace banners with a transparent image, and had a first version of pop-up
3644 killing, but it was still very closely based on the original, with all its
3645 limitations, such as the lack of HTTP/1.1 support, flexible per-site
3646 configuration, or content modification. The last release from this effort was
3647 version 2.0.2-10, published in 2000.
3648
3649 Then, some developers picked up the thread, and started turning the software
3650 inside out, upside down, and then reassembled it, adding many new features
3651 along the way.
3652
3653 The result of this is Privoxy, whose first stable release, 3.0, is due late
3654 summer or early fall 2002.
3655 -------------------------------------------------------------------------------
3656
3657 12.3. Authors
3658
3659 Current Project Developers:
3660
3661  Jon Foster
3662  Andreas Oesterhelt
3663  Stefan Waldherr
3664  
3665  Thomas Steudten
3666  Rodney Stromlund
3667
3668 Current Project Contributors:
3669
3670  Rodrigo Barbosa (RPM specfiles)
3671  Moritz Barsnick
3672  Hal Burgiss (docs)
3673  Alexander Lazic
3674  Gábor Lipták
3675  Guy
3676  Haroon Rafique
3677  Roland Rosenfeld
3678  Georg Sauthoff
3679  David Schmidt (OS/2, Mac OSX ports)
3680  Joerg Strohmayer
3681  Sarantis Paskalis
3682
3683 Based in part on code originally developed by:
3684
3685  Junkbusters Corp.
3686  Anonymous Coders
3687
3688 Thanks to the many people who have tested Privoxy, reported bugs, or made
3689 suggestions. These include (in alphabetical order):
3690
3691  Ken Arromdee
3692  Devin Bayer
3693  Reiner Buehl
3694  Andrew J. Caines
3695  Clifford Caoile
3696  Michael T. Davis
3697  Peter E
3698  Aaron Hamid
3699  Magnus Holmgren
3700  Paul Lieverse
3701  Roberto Ragusa
3702  Maynard Riley
3703  Bart Schelstraete
3704  Darren Wiebe
3705  jwz
3706 -------------------------------------------------------------------------------
3707
3708 13. See Also
3709
3710 Other references and sites of interest to Privoxy users:
3711
3712 http://www.privoxy.org/, the Privoxy Home page.
3713
3714 http://www.privoxy.org/faq/, the Privoxy FAQ.
3715
3716 http://sourceforge.net/projects/ijbswa/, the Project Page for Privoxy on       
3717 SourceForge.                                                                   
3718
3719 http://config.privoxy.org/, the web-based user interface. Privoxy must be      
3720 running for this to work. Shortcut: http://p.p/                                
3721
3722 http://www.privoxy.org/actions/, to submit "misses" to the developers.
3723
3724 http://www.junkbusters.com/ht/en/cookies.html, an explanation how cookies are  
3725 used to track web users.                                                       
3726
3727 http://www.junkbusters.com/ijb.html, the original Internet Junkbuster.
3728
3729 http://www.waldherr.org/junkbuster/, Stefan Waldherr's version of Junkbuster,  
3730 from which Privoxy was derived.                                                
3731
3732 http://privacy.net/analyze/, a useful site to check what information about you 
3733 is leaked while you browse the web.                                            
3734
3735 http://www.squid-cache.org/, a very popular caching proxy, which is often used 
3736 together with Privoxy.                                                         
3737
3738 http://www.privoxy.org/developer-manual/, the Privoxy developer manual.
3739
3740 -------------------------------------------------------------------------------
3741 14. Appendix
3742
3743 14.1. Regular Expressions
3744
3745 Privoxy uses Perl-style "regular expressions" in its actions files and filter
3746 file, through the PCRE and PCRS libraries.
3747
3748 If you are reading this, you probably don't understand what "regular
3749 expressions" are, or what they can do. So this will be a very brief
3750 introduction only. A full explanation would require a book ;-)
3751
3752 Regular expressions provide a language to describe patterns that can be run
3753 against strings of characters (letter, numbers, etc), to see if they match the
3754 string or not. The patterns are themselves (sometimes complex) strings of
3755 literal characters, combined with wild-cards, and other special characters,
3756 called meta-characters. The "meta-characters" have special meanings and are
3757 used to build complex patterns to be matched against. Perl Compatible Regular
3758 Expressions are an especially convenient "dialect" of the regular expression
3759 language.
3760
3761 To make a simple analogy, we do something similar when we use wild-card
3762 characters when listing files with the dir command in DOS. *.* matches all
3763 filenames. The "special" character here is the asterisk which matches any and
3764 all characters. We can be more specific and use ? to match just individual
3765 characters. So "dir file?.text" would match "file1.txt", "file2.txt", etc. We
3766 are pattern matching, using a similar technique to "regular expressions"!
3767
3768 Regular expressions do essentially the same thing, but are much, much more
3769 powerful. There are many more "special characters" and ways of building complex
3770 patterns however. Let's look at a few of the common ones, and then some
3771 examples:
3772
3773 . - Matches any single character, e.g. "a", "A", "4", ":", or "@".
3774
3775 ? - The preceding character or expression is matched ZERO or ONE times. Either/
3776 or.                                                                            
3777
3778 + - The preceding character or expression is matched ONE or MORE times.
3779
3780 * - The preceding character or expression is matched ZERO or MORE times.
3781
3782 \ - The "escape" character denotes that the following character should be taken
3783 literally. This is used where one of the special characters (e.g. ".") needs to
3784 be taken literally and not as a special meta-character. Example: "example\.com"
3785 , makes sure the period is recognized only as a period (and not expanded to its
3786 meta-character meaning of any single character).                               
3787
3788 [] - Characters enclosed in brackets will be matched if any of the enclosed    
3789 characters are encountered. For instance, "[0-9]" matches any numeric digit    
3790 (zero through nine). As an example, we can combine this with "+" to match any  
3791 digit one of more times: "[0-9]+".                                             
3792
3793 () - parentheses are used to group a sub-expression, or multiple               
3794 sub-expressions.                                                               
3795
3796 | - The "bar" character works like an "or" conditional statement. A match is   
3797 successful if the sub-expression on either side of "|" matches. As an example: 
3798 "/(this|that) example/" uses grouping and the bar character and would match    
3799 either "this example" or "that example", and nothing else.                     
3800
3801 These are just some of the ones you are likely to use when matching URLs with 
3802 Privoxy, and is a long way from a definitive list. This is enough to get us
3803 started with a few simple examples which may be more illuminating:
3804
3805 /.*/banners/.* - A simple example that uses the common combination of "." and "
3806 *" to denote any character, zero or more times. In other words, any string at
3807 all. So we start with a literal forward slash, then our regular expression
3808 pattern (".*") another literal forward slash, the string "banners", another
3809 forward slash, and lastly another ".*". We are building a directory path here.
3810 This will match any file with the path that has a directory named "banners" in
3811 it. The ".*" matches any characters, and this could conceivably be more forward
3812 slashes, so it might expand into a much longer looking path. For example, this
3813 could match: "/eye/hate/spammers/banners/annoy_me_please.gif", or just "/
3814 banners/annoying.html", or almost an infinite number of other possible
3815 combinations, just so it has "banners" in the path somewhere.
3816
3817 A now something a little more complex:
3818
3819 /.*/adv((er)?ts?|ertis(ing|ements?))?/ - We have several literal forward
3820 slashes again ("/"), so we are building another expression that is a file path
3821 statement. We have another ".*", so we are matching against any conceivable
3822 sub-path, just so it matches our expression. The only true literal that must
3823 match our pattern is adv, together with the forward slashes. What comes after
3824 the "adv" string is the interesting part.
3825
3826 Remember the "?" means the preceding expression (either a literal character or
3827 anything grouped with "(...)" in this case) can exist or not, since this means
3828 either zero or one match. So "((er)?ts?|ertis(ing|ements?))" is optional, as
3829 are the individual sub-expressions: "(er)", "(ing|ements?)", and the "s". The "
3830 |" means "or". We have two of those. For instance, "(ing|ements?)", can expand
3831 to match either "ing" OR "ements?". What is being done here, is an attempt at
3832 matching as many variations of "advertisement", and similar, as possible. So
3833 this would expand to match just "adv", or "advert", or "adverts", or 
3834 "advertising", or "advertisement", or "advertisements". You get the idea. But
3835 it would not match "advertizements" (with a "z"). We could fix that by changing
3836 our regular expression to: "/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/", which
3837 would then match either spelling.
3838
3839 /.*/advert[0-9]+\.(gif|jpe?g) - Again another path statement with forward
3840 slashes. Anything in the square brackets "[]" can be matched. This is using 
3841 "0-9" as a shorthand expression to mean any digit one through nine. It is the
3842 same as saying "0123456789". So any digit matches. The "+" means one or more of
3843 the preceding expression must be included. The preceding expression here is
3844 what is in the square brackets -- in this case, any digit one through nine.
3845 Then, at the end, we have a grouping: "(gif|jpe?g)". This includes a "|", so
3846 this needs to match the expression on either side of that bar character also. A
3847 simple "gif" on one side, and the other side will in turn match either "jpeg"
3848 or "jpg", since the "?" means the letter "e" is optional and can be matched
3849 once or not at all. So we are building an expression here to match image GIF or
3850 JPEG type image file. It must include the literal string "advert", then one or
3851 more digits, and a "." (which is now a literal, and not a special character,
3852 since it is escaped with "\"), and lastly either "gif", or "jpeg", or "jpg".
3853 Some possible matches would include: "//advert1.jpg", "/nasty/ads/
3854 advert1234.gif", "/banners/from/hell/advert99.jpg". It would not match 
3855 "advert1.gif" (no leading slash), or "/adverts232.jpg" (the expression does not
3856 include an "s"), or "/advert1.jsp" ("jsp" is not in the expression anywhere).
3857
3858 We are barely scratching the surface of regular expressions here so that you
3859 can understand the default Privoxy configuration files, and maybe use this
3860 knowledge to customize your own installation. There is much, much more that can
3861 be done with regular expressions. Now that you know enough to get started, you
3862 can learn more on your own :/
3863
3864 More reading on Perl Compatible Regular expressions: http://www.perldoc.com/
3865 perl5.6/pod/perlre.html
3866
3867 For information on regular expression based substitutions and their
3868 applications in filters, please see the filter file tutorial in this manual.
3869 -------------------------------------------------------------------------------
3870
3871 14.2. Privoxy's Internal Pages
3872
3873 Since Privoxy proxies each requested web page, it is easy for Privoxy to trap
3874 certain special URLs. In this way, we can talk directly to Privoxy, and see how
3875 it is configured, see how our rules are being applied, change these rules and
3876 other configuration options, and even turn Privoxy's filtering off, all with a
3877 web browser. 
3878
3879 The URLs listed below are the special ones that allow direct access to Privoxy.
3880 Of course, Privoxy must be running to access these. If not, you will get a
3881 friendly error message. Internet access is not necessary either.
3882
3883   * Privoxy main page:
3884    
3885        
3886         http://config.privoxy.org/
3887        
3888    
3889     There is a shortcut: http://p.p/ (But it doesn't provide a fall-back to a
3890     real page, in case the request is not sent through Privoxy)
3891    
3892   * Show information about the current configuration, including viewing and
3893     editing of actions files:
3894    
3895        
3896         http://config.privoxy.org/show-status
3897        
3898    
3899   * Show the source code version numbers:
3900    
3901        
3902         http://config.privoxy.org/show-version
3903        
3904    
3905   * Show the browser's request headers:
3906    
3907        
3908         http://config.privoxy.org/show-request
3909        
3910    
3911   * Show which actions apply to a URL and why:
3912    
3913        
3914         http://config.privoxy.org/show-url-info
3915        
3916    
3917   * Toggle Privoxy on or off. In this case, "Privoxy" continues to run, but
3918     only as a pass-through proxy, with no actions taking place:
3919    
3920        
3921         http://config.privoxy.org/toggle
3922        
3923    
3924     Short cuts. Turn off, then on:
3925    
3926        
3927         http://config.privoxy.org/toggle?set=disable
3928        
3929    
3930        
3931         http://config.privoxy.org/toggle?set=enable
3932        
3933    
3934
3935 These may be bookmarked for quick reference. See next. 
3936 -------------------------------------------------------------------------------
3937
3938 14.2.1. Bookmarklets
3939
3940 Below are some "bookmarklets" to allow you to easily access a "mini" version of
3941 some of Privoxy's special pages. They are designed for MS Internet Explorer,
3942 but should work equally well in Netscape, Mozilla, and other browsers which
3943 support JavaScript. They are designed to run directly from your bookmarks - not
3944 by clicking the links below (although that should work for testing).
3945
3946 To save them, right-click the link and choose "Add to Favorites" (IE) or "Add
3947 Bookmark" (Netscape). You will get a warning that the bookmark "may not be
3948 safe" - just click OK. Then you can run the Bookmarklet directly from your
3949 favorites/bookmarks. For even faster access, you can put them on the "Links"
3950 bar (IE) or the "Personal Toolbar" (Netscape), and run them with a single
3951 click.
3952
3953   * Privoxy - Enable
3954    
3955   * Privoxy - Disable
3956    
3957   * Privoxy - Toggle Privoxy (Toggles between enabled and disabled)
3958    
3959   * Privoxy- View Status
3960    
3961   * Privoxy - Submit Actions File Feedback
3962    
3963   * Privoxy - Why?
3964    
3965
3966 Credit: The site which gave us the general idea for these bookmarklets is 
3967 www.bookmarklets.com. They have more information about bookmarklets.
3968 -------------------------------------------------------------------------------
3969
3970 14.3. Chain of Events
3971
3972 Let's take a quick look at the basic sequence of events when a web page is
3973 requested by your browser and Privoxy is on duty:
3974
3975   * First, your web browser requests a web page. The browser knows to send the
3976     request to Privoxy, which will in turn, relay the request to the remote web
3977     server after passing the following tests:
3978    
3979   * Privoxy traps any request for its own internal CGI pages (e.g http://p.p/)
3980     and sends the CGI page back to the browser.
3981    
3982   * Next, Privoxy checks to see if the URL matches any "+block" patterns. If
3983     so, the URL is then blocked, and the remote web server will not be
3984     contacted. "+handle-as-image" is then checked and if it does not match, an
3985     HTML "BLOCKED" page is sent back. Otherwise, if it does match, an image is
3986     returned. The type of image depends on the setting of "+set-image-blocker"
3987     (blank, checkerboard pattern, or an HTTP redirect to an image elsewhere).
3988    
3989   * Untrusted URLs are blocked. If URLs are being added to the trust file, then
3990     that is done.
3991    
3992   * If the URL pattern matches the "+fast-redirects" action, it is then
3993     processed. Unwanted parts of the requested URL are stripped.
3994    
3995   * Now the rest of the client browser's request headers are processed. If any
3996     of these match any of the relevant actions (e.g. "+hide-user-agent", etc.),
3997     headers are suppressed or forged as determined by these actions and their
3998     parameters.
3999    
4000   * Now the web server starts sending its response back (i.e. typically a web
4001     page and related data).
4002    
4003   * First, the server headers are read and processed to determine, among other
4004     things, the MIME type (document type) and encoding. The headers are then
4005     filtered as deterimined by the "+crunch-incoming-cookies", 
4006     "+session-cookies-only", and "+downgrade-http-version" actions.
4007    
4008   * If the "+kill-popups" action applies, and it is an HTML or JavaScript
4009     document, the popup-code in the response is filtered on-the-fly as it is
4010     received.
4011    
4012   * If a "+filter" or "+deanimate-gifs" action applies (and the document type
4013     fits the action), the rest of the page is read into memory (up to a
4014     configurable limit). Then the filter rules (from default.filter) are
4015     processed against the buffered content. Filters are applied in the order
4016     they are specified in the default.filter file. Animated GIFs, if present,
4017     are reduced to either the first or last frame, depending on the action
4018     setting.The entire page, which is now filtered, is then sent by Privoxy
4019     back to your browser.
4020    
4021     If neither "+filter" or "+deanimate-gifs" matches, then Privoxy passes the
4022     raw data through to the client browser as it becomes available.
4023    
4024   * As the browser receives the now (probably filtered) page content, it reads
4025     and then requests any URLs that may be embedded within the page source,
4026     e.g. ad images, stylesheets, JavaScript, other HTML documents (e.g.
4027     frames), sounds, etc. For each of these objects, the browser issues a new
4028     request. And each such request is in turn processed as above. Note that a
4029     complex web page may have many such embedded URLs.
4030    
4031
4032 -------------------------------------------------------------------------------
4033 14.4. Anatomy of an Action
4034
4035 The way Privoxy applies actions and filters to any given URL can be complex,
4036 and not always so easy to understand what is happening. And sometimes we need
4037 to be able to see just what Privoxy is doing. Especially, if something Privoxy
4038 is doing is causing us a problem inadvertently. It can be a little daunting to
4039 look at the actions and filters files themselves, since they tend to be filled
4040 with regular expressions whose consequences are not always so obvious.
4041
4042 One quick test to see if Privoxy is causing a problem or not, is to disable it
4043 temporarily. This should be the first troubleshooting step. See the
4044 Bookmarklets section on a quick and easy way to do this (be sure to flush
4045 caches afterward!). Looking at the logs is a good idea too.
4046
4047 Privoxy also provides the http://config.privoxy.org/show-url-info page that can
4048 show us very specifically how actions are being applied to any given URL. This
4049 is a big help for troubleshooting.
4050
4051 First, enter one URL (or partial URL) at the prompt, and then Privoxy will tell
4052 us how the current configuration will handle it. This will not help with
4053 filtering effects (i.e. the "+filter" action) from the default.filter file
4054 since this is handled very differently and not so easy to trap! It also will
4055 not tell you about any other URLs that may be embedded within the URL you are
4056 testing. For instance, images such as ads are expressed as URLs within the raw
4057 page source of HTML pages. So you will only get info for the actual URL that is
4058 pasted into the prompt area -- not any sub-URLs. If you want to know about
4059 embedded URLs like ads, you will have to dig those out of the HTML source. Use
4060 your browser's "View Page Source" option for this. Or right click on the ad,
4061 and grab the URL.
4062
4063 Let's try an example, google.com, and look at it one section at a time:
4064
4065  Matches for http://google.com:                                                
4066                                                                                
4067  In file: default.action [ View ] [ Edit ]                                     
4068                                                                                
4069 {-add-header                                                                   
4070  -block                                                                        
4071  -crunch-outgoing-cookies                                                      
4072  -crunch-incoming-cookies                                                      
4073  +deanimate-gifs{last}                                                         
4074  -downgrade-http-version                                                       
4075  +fast-redirects                                                               
4076  -filter{popups}                                                               
4077  -filter{fun}                                                                  
4078  -filter{shockwave-flash}                                                      
4079  -filter{crude-parental}                                                       
4080  +filter{html-annoyances}                                                      
4081  +filter{js-annoyances}                                                        
4082  +filter{content-cookies}                                                      
4083  +filter{webbugs}                                                              
4084  +filter{refresh-tags}                                                         
4085  +filter{nimda}                                                                
4086  +filter{banners-by-size}                                                      
4087  +hide-forwarded-for-headers                                                   
4088  +hide-from-header{block}                                                      
4089  +hide-referer{forge}                                                          
4090  -hide-user-agent                                                              
4091  -handle-as-image                                                              
4092  -kill-popups                                                                  
4093  -limit-connect                                                                
4094  +prevent-compression                                                          
4095  -send-vanilla-wafer                                                           
4096  -send-wafer                                                                   
4097  +session-cookies-only                                                         
4098  +set-image-blocker{pattern} }                                                 
4099 /                                                                              
4100                                                                                
4101  { -session-cookies-only }                                                     
4102  .google.com                                                                   
4103                                                                                
4104  { -fast-redirects }                                                           
4105  .google.com                                                                   
4106                                                                                
4107 In file: user.action [ View ] [ Edit ]                                         
4108 (no matches in this file)                                                      
4109
4110 This tells us how we have defined our "actions", and which ones match for our
4111 example, "google.com". The first listing is any matches for the standard.action
4112 file. No hits at all here on "standard". Then next is "default", or our
4113 default.action file. The large, multi-line listing, is how the actions are set
4114 to match for all URLs, i.e. our default settings. If you look at your "actions"
4115 file, this would be the section just below the "aliases" section near the top.
4116 This will apply to all URLs as signified by the single forward slash at the end
4117 of the listing -- "/".
4118
4119 But we can define additional actions that would be exceptions to these general
4120 rules, and then list specific URLs (or patterns) that these exceptions would
4121 apply to. Last match wins. Just below this then are two explicit matches for 
4122 ".google.com". The first is negating our previous cookie setting, which was for
4123 "+session-cookies-only" (i.e. not persistent). So we will allow persistent
4124 cookies for google. The second turns off any "+fast-redirects" action, allowing
4125 this to take place unmolested. Note that there is a leading dot here -- 
4126 ".google.com". This will match any hosts and sub-domains, in the google.com
4127 domain also, such as "www.google.com". So, apparently, we have these two
4128 actions defined somewhere in the lower part of our default.action file, and 
4129 "google.com" is referenced somewhere in these latter sections.
4130
4131 Then, for our user.action file, we again have no hits.
4132
4133 And finally we pull it all together in the bottom section and summarize how 
4134 Privoxy is applying all its "actions" to "google.com": 
4135
4136  Final results:                                                                
4137                                                                                
4138  -add-header                                                                   
4139  -block                                                                        
4140  -crunch-outgoing-cookies                                                      
4141  -crunch-incoming-cookies                                                      
4142  +deanimate-gifs{last}                                                         
4143  -downgrade-http-version                                                       
4144  -fast-redirects                                                               
4145  -filter{popups}                                                               
4146  -filter{fun}                                                                  
4147  -filter{shockwave-flash}                                                      
4148  -filter{crude-parental}                                                       
4149  +filter{html-annoyances}                                                      
4150  +filter{js-annoyances}                                                        
4151  +filter{content-cookies}                                                      
4152  +filter{webbugs}                                                              
4153  +filter{refresh-tags}                                                         
4154  +filter{nimda}                                                                
4155  +filter{banners-by-size}                                                      
4156  +hide-forwarded-for-headers                                                   
4157  +hide-from-header{block}                                                      
4158  +hide-referer{forge}                                                          
4159  -hide-user-agent                                                              
4160  -handle-as-image                                                              
4161  -kill-popups                                                                  
4162  -limit-connect                                                                
4163  +prevent-compression                                                          
4164  -send-vanilla-wafer                                                           
4165  -send-wafer                                                                   
4166  -session-cookies-only                                                         
4167  +set-image-blocker{pattern}                                                   
4168
4169 Notice the only difference here to the previous listing, is to "fast-redirects"
4170 and "session-cookies-only".
4171
4172 Now another example, "ad.doubleclick.net":
4173
4174  { +block +handle-as-image }                                                   
4175   .ad.doubleclick.net                                                          
4176                                                                                
4177  { +block +handle-as-image }                                                   
4178   ad*.                                                                         
4179                                                                                
4180  { +block +handle-as-image }                                                   
4181   .doubleclick.net                                                             
4182
4183 We'll just show the interesting part here, the explicit matches. It is matched
4184 three different times. Each as an "+block +handle-as-image", which is the
4185 expanded form of one of our aliases that had been defined as: "+imageblock". (
4186 "Aliases" are defined in the first section of the actions file and typically
4187 used to combine more than one action.)
4188
4189 Any one of these would have done the trick and blocked this as an unwanted
4190 image. This is unnecessarily redundant since the last case effectively would
4191 also cover the first. No point in taking chances with these guys though ;-)
4192 Note that if you want an ad or obnoxious URL to be invisible, it should be
4193 defined as "ad.doubleclick.net" is done here -- as both a "+block" and an 
4194 "+handle-as-image". The custom alias "+imageblock" just simplifies the process
4195 and make it more readable.
4196
4197 One last example. Let's try "http://www.rhapsodyk.net/adsl/HOWTO/". This one is
4198 giving us problems. We are getting a blank page. Hmmm ...
4199
4200  Matches for http://www.rhapsodyk.net/adsl/HOWTO/:                             
4201                                                                                
4202  In file: default.action [ View ] [ Edit ]                                     
4203                                                                                
4204  {-add-header                                                                  
4205   -block                                                                       
4206   -crunch-incoming-cookies                                                     
4207   -crunch-outgoing-cookies                                                     
4208   +deanimate-gifs                                                              
4209   -downgrade-http-version                                                      
4210   +fast-redirects                                                              
4211   +filter{html-annoyances}                                                     
4212   +filter{js-annoyances}                                                       
4213   +filter{kill-popups}                                                         
4214   +filter{webbugs}                                                             
4215   +filter{nimda}                                                               
4216   +filter{banners-by-size}                                                     
4217   +filter{hal}                                                                 
4218   +filter{fun}                                                                 
4219   +hide-forwarded-for-headers                                                  
4220   +hide-from-header{block}                                                     
4221   +hide-referer{forge}                                                         
4222   -hide-user-agent                                                             
4223   -handle-as-image                                                             
4224   +kill-popups                                                                 
4225   +prevent-compression                                                         
4226   -send-vanilla-wafer                                                          
4227   -send-wafer                                                                  
4228   +session-cookies-only                                                        
4229   +set-image-blocker{blank} }                                                  
4230    /                                                                           
4231                                                                                
4232  { +block +handle-as-image }                                                   
4233   /ads                                                                         
4234
4235 Ooops, the "/adsl/" is matching "/ads"! But we did not want this at all! Now we
4236 see why we get the blank page. We could now add a new action below this that
4237 explicitly does not block ("{-block}") paths with "adsl". There are various
4238 ways to handle such exceptions. Example:
4239
4240  { -block }                                                                    
4241   /adsl                                                                        
4242
4243 Now the page displays ;-) Be sure to flush your browser's caches when making
4244 such changes. Or, try using Shift+Reload.
4245
4246 But now what about a situation where we get no explicit matches like we did
4247 with:
4248
4249  { +block +handle-as-image }                                                   
4250  /ads                                                                          
4251
4252 That actually was very telling and pointed us quickly to where the problem was.
4253 If you don't get this kind of match, then it means one of the default rules in
4254 the first section is causing the problem. This would require some guesswork,
4255 and maybe a little trial and error to isolate the offending rule. One likely
4256 cause would be one of the "{+filter}" actions. These tend to be harder to
4257 troubleshoot. Try adding the URL for the site to one of aliases that turn off 
4258 "+filter":
4259
4260  {shop}                                                                        
4261  .quietpc.com                                                                  
4262  .worldpay.com   # for quietpc.com                                             
4263  .jungle.com                                                                   
4264  .scan.co.uk                                                                   
4265  .forbes.com                                                                   
4266
4267 "{shop}" is an "alias" that expands to "{ -filter -session-cookies-only }". Or
4268 you could do your own exception to negate filtering: 
4269
4270  {-filter}                                                                     
4271  .forbes.com                                                                   
4272
4273 This would turn off all filtering for that site. This would probably be most
4274 appropriately put in user.action, for local site exceptions.
4275
4276 Images that are inexplicably being blocked, may well be hitting the "+filter
4277 {banners-by-size}" rule, which assumes that images of certain sizes are ad
4278 banners (works well most of the time since these tend to be standardized).
4279
4280 "{fragile}" is an alias that disables most actions. This can be used as a last
4281 resort for problem sites. Remember to flush caches! If this still does not
4282 work, you will have to go through the remaining actions one by one to find
4283 which one(s) is causing the problem.