generated
[privoxy.git] / doc / text / user-manual.txt
1 Privoxy User Manual
2
3
4 By: Privoxy Developers
5
6 $Id: user-manual.sgml,v 1.69 2002/04/06 05:07:29 hal9 Exp $
7
8
9 The user manual gives users information on how to install, configure and use 
10 Privoxy.
11
12 Privoxy is a web proxy with advanced filtering capabilities for protecting
13 privacy, filtering web page content, managing cookies, controlling access, and
14 removing ads, banners, pop-ups and other obnoxious Internet junk. Privoxy has a
15 very flexible configuration and can be customized to suit individual needs and
16 tastes. Privoxy has application for both stand-alone systems and multi-user
17 networks.
18
19 Privoxy is based on the code of the Internet Junkbuster (tm). Junkbuster was
20 originally written by JunkBusters Corporation, and was released as free
21 open-source software under the GNU GPL. Stefan Waldherr made many improvements,
22 and started the SourceForge project to continue development.
23
24 Privoxy continues the Junkbuster tradition, but adds many refinements,
25 enhancements and new features.
26
27 You can find the latest version of the user manual at http://www.privoxy.org/
28 user-manual/. Please see the Contact section on how to contact the developers.
29
30 -------------------------------------------------------------------------------
31 Table of Contents
32  
33 1. Introduction
34     1.1. New Features
35    
36    
37 3. Installation
38     3.1. Source
39         3.1.1. Red Hat
40         3.1.2. SuSE
41         3.1.3. OS/2
42         3.1.4. Windows
43         3.1.5. Other
44        
45        
46    
47    
48 4. Quickstart to Using Privoxy
49     4.1. Command Line Options
50    
51    
52 5. Privoxy Configuration
53     5.1. Controlling Privoxy with Your Web Browser
54     5.2. Configuration Files Overview
55     5.3. The Main Configuration File
56         5.3.1. Defining Other Configuration Files
57         5.3.2. Other Configuration Options
58         5.3.3. Access Control List (ACL)
59         5.3.4. Forwarding
60         5.3.5. Windows GUI Options
61        
62        
63     5.4. The Actions File
64         5.4.1. URL Domain and Path Syntax
65         5.4.2. Actions
66         5.4.3. Aliases
67        
68        
69     5.5. The Filter File
70     5.6. Templates
71    
72    
73 6. Contacting the Developers, Bug Reporting and Feature Requests
74 7. Copyright and History
75     7.1. Copyright
76     7.2. History
77    
78    
79 8. See Also
80 9. Appendix
81     9.1. Regular Expressions
82         21 
83         22 
84         23 
85         24 
86         25 
87         26 
88         27 
89         28 
90         29 
91        
92        
93     9.2. Privoxy's Internal Pages
94         9.2.1. Bookmarklets
95        
96        
97     9.3. Anatomy of an Action
98    
99    
100
101
102 -------------------------------------------------------------------------------
103 1. Introduction
104
105 This documentation is included with the current BETA version of Privoxy,
106 v.2.9.13, and is mostly complete at this point. The most up to date reference
107 for the time being is still the comments in the source files and in the
108 individual configuration files. Development of version 3.0 is currently nearing
109 completion, and includes many significant changes and enhancements over earlier
110 versions. The target release date for stable v3.0 is "soon" ;-).
111
112 Since this is a BETA version, not all new features are well tested. This
113 documentation may be slightly out of sync as a result (especially with CVS
114 sources). And there may be bugs, though hopefully not many!
115 -------------------------------------------------------------------------------
116
117 1.1. New Features
118
119 In addition to Internet Junkbuster's traditional feature of ad and banner
120 blocking and cookie management, Privoxy provides new features, some of them
121 currently under development:
122
123   * Integrated browser based configuration and control utility (http://p.p).
124     Browser-based tracing of rule and filter effects.
125    
126   * Blocking of annoying pop-up browser windows.
127    
128   * HTTP/1.1 compliant (most, but not all 1.1 features are supported).
129    
130   * Support for Perl Compatible Regular Expressions in the configuration files,
131     and generally a more sophisticated and flexible configuration syntax over
132     previous versions.
133    
134   * GIF de-animation.
135    
136   * Web page content filtering (removes banners based on size, invisible 
137     "web-bugs", JavaScript, pop-ups, status bar abuse, etc.)
138    
139   * Bypass many click-tracking scripts (avoids script redirection).
140    
141   * Multi-threaded (POSIX and native threads).
142    
143   * Auto-detection and re-reading of config file changes.
144    
145   * User-customizable HTML templates (e.g. 404 error page).
146    
147   * Improved cookie management features (e.g. session based cookies).
148    
149   * Improved signal handling, and a true daemon mode (Unix).
150    
151   * Builds from source on most UNIX-like systems. Packages available for: Linux
152     (RedHat, SuSE, or Debian), Windows, Sun Solaris, Mac OSX, OS/2, HP-UX 11
153     and AmigaOS.
154    
155   * In addition, the configuration is much more powerful and versatile
156     over-all.
157    
158
159 -------------------------------------------------------------------------------
160 3. Installation
161
162 Privoxy is available as raw source code (tarball or via CVS), or pre-compiled
163 binaries for various platforms. See the Privoxy Project Page for the most up to
164 date release information. Privoxy is also available via CVS. This is the
165 recommended approach at this time. But please be aware that CVS is constantly
166 changing, and it may break in mysterious ways.
167
168 At present, Privoxy is known to run on Win32, Mac OSX, OS/2, AmigaOS, Linux
169 (RedHat, Suse, Debian), FreeBSD, and many flavors of Unix. There are source and
170 binary releases for these available for download at http://sourceforge.net/
171 project/showfiles.php?group_id=11118.
172 -------------------------------------------------------------------------------
173
174 3.1. Source
175
176 There are several ways to install Privoxy.
177
178 To build Privoxy from source, autoconf and GNU make (gmake) are required.
179 Source is available as gzipped tar archives. For this, first unpack the source:
180
181  tar xzvf privoxy-2.9.13-beta-src* [.tgz or .tar.gz]                           
182  cd privoxy-2.9.13-beta                                                        
183                                                                                
184
185 For retrieving the current CVS sources, you'll need the CVS package installed
186 first. Note CVS source is development quality, and may not be stable, or well
187 tested. To download CVS source:
188
189   cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login          
190   cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co current 
191   cd current                                                                         
192                                                                                      
193
194 This will create a directory named current/, which will contain the source
195 tree.
196
197 Then, in either case, to build from unpacked tarball or CVS source:
198
199  autoheader                                                                    
200  autoconf                                                                      
201  ./configure      (--help to see options)                                      
202  make             (the make from gnu, gmake for *BSD)                          
203  su                                                                            
204  make -n install  (to see where all the files will go)                         
205  make install     (to really install)                                          
206                                                                                
207
208 Redhat and SuSE src and binary RPMs can be built with "make redhat-dist" or "
209 make suse-dist" from unpacked sources. You will need to run "autoconf;
210 autoheader; ./configure" beforehand. *BSD will require gmake (from http://
211 www.gnu.org).
212
213 For Redhat and SuSE Linux RPM packages, see below.
214 -------------------------------------------------------------------------------
215
216 3.1.1. Red Hat
217
218 To build Redhat RPM packages from source, install source as above. Then:
219
220  autoheader                                                                    
221  autoconf                                                                      
222  ./configure                                                                   
223  make redhat-dist                                                              
224                                                                                
225
226 This will create both binary and src RPMs in the usual places. Example:
227
228    /usr/src/redhat/RPMS/i686/privoxy-2.9.13-1.i686.rpm
229
230    /usr/src/redhat/SRPMS/privoxy-2.9.13-1.src.rpm
231
232 To install, of course:
233
234  rpm -Uvv /usr/src/redhat/RPMS/i686/privoxy-2.9.13-1.i686.rpm                  
235                                                                                
236
237 This will place the Privoxy configuration files in /etc/privoxy/, and log files
238 in /var/log/privoxy/. Run ckconfig privoxy on to have Privoxy start
239 automatically during init. 
240 -------------------------------------------------------------------------------
241
242 3.1.2. SuSE
243
244 To build SuSE RPM packages, install source as above. Then:
245
246  autoheader                                                                    
247  autoconf                                                                      
248  ./configure                                                                   
249  make suse-dist                                                                
250                                                                                
251
252 This will create both binary and src RPMs in the usual places. Example:
253
254    /usr/src/packages/RPMS/i686/privoxy-2.9.13-1.i686.rpm
255
256    /usr/src/packages/SRPMS/privoxy-2.9.13-1.src.rpm
257
258 To install, of course:
259
260  rpm -Uvv /usr/src/packages/RPMS/i686/privoxy-2.9.13-1.i686.rpm                
261                                                                                
262
263 This will place the Privoxy configuration files in /etc/privoxy/, and log files
264 in /var/log/privoxy/.
265 -------------------------------------------------------------------------------
266
267 3.1.3. OS/2
268
269 Privoxy is packaged in a WarpIN self- installing archive. The self-installing
270 program will be named depending on the release version, something like:
271 privoxyos2_setup_2.9.13.exe. In order to install it, simply run this executable
272 or double-click on its icon and follow the WarpIN installation panels. A shadow
273 of the Privoxy executable will be placed in your startup folder so it will
274 start automatically whenever OS/2 starts.
275
276 The directory you choose to install Privoxy into will contain all of the
277 configuration files.
278
279 If you would like to build binary images on OS/2 yourself, you will need a few
280 Unix-like tools: autoconf, autoheader and sh. These tools will be used to
281 create the required config.h file, which is not part of the source distribution
282 because it differs based on platform. You will also need a compiler. The
283 distribution has been created using IBM VisualAge compilers, but you can use
284 any compiler you like. GCC/EMX has the disadvantage of needing to be
285 single-threaded due to a limitation of EMX's implementation of the select()
286 socket call.
287
288 In addition to needing the source code distribution as outlined earlier, you
289 will want to extract the os2seutp directory from CVS:
290  cvs -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa login           
291  cvs -z3 -d:pserver:anonymous@cvs.ijbswa.sourceforge.net:/cvsroot/ijbswa co os2setup 
292                                                                                      
293 This will create a directory named os2setup/, which will contain the
294 Makefile.vac makefile and os2build.cmd which is used to completely create the
295 binary distribution. The sequence of events for building the executable for
296 yourself goes something like this:
297  cd current                                                                    
298  autoheader                                                                    
299  autoconf                                                                      
300  sh configure                                                                  
301  cd ..\os2setup                                                                
302  nmake -f Makefile.vac                                                         
303                                                                                
304 You will see this sequence laid out in os2build.cmd.
305 -------------------------------------------------------------------------------
306
307 3.1.4. Windows
308
309 Click-click. (I need help on this. Not a clue here. Also for configuration
310 section below. HB.)
311 -------------------------------------------------------------------------------
312
313 3.1.5. Other
314
315 Some quick notes on other Operating Systems.
316
317 For FreeBSD (and other *BSDs?), the build will require gmake instead of the
318 included make. gmake is available from http://www.gnu.org. The rest should be
319 the same as above for Linux/Unix.
320 -------------------------------------------------------------------------------
321
322 4. Quickstart to Using Privoxy
323
324 Before launching Privoxy for the first time, you will want to configure your
325 browser(s) to use Privoxy as a HTTP and HTTPS proxy. The default is localhost
326 for the proxy address, and port 8118 (earlier versions used port 800). This is
327 the one required configuration that must be done!
328
329 With Netscape (and Mozilla), this can be set under Edit -> Preferences ->
330 Advanced -> Proxies -> HTTP Proxy. For Internet Explorer: Tools -> Internet
331 Properties -> Connections -> LAN Setting. Then, check "Use Proxy" and fill in
332 the appropriate info (Address: localhost, Port: 8118). Include if HTTPS proxy
333 support too.
334
335 After doing this, flush your browser's disk and memory caches to force a
336 re-reading of all pages and get rid of any ads that may be cached. You are now
337 ready to start enjoying the benefits of using Privoxy.
338
339 Privoxy is typically started by specifying the main configuration file to be
340 used on the command line. Example Unix startup command:
341
342                                                                                
343  # /usr/sbin/privoxy /etc/privoxy/config                                       
344                                                                                
345                                                                                
346
347 An init script is provided for SuSE and Redhat.
348
349 For for SuSE: /etc/rc.d/privoxy start
350
351 For RedHat: /etc/rc.d/init.d/privoxy start
352
353 If no configuration file is specified on the command line, Privoxy will look
354 for a file named config in the current directory. Except on Win32 where it will
355 try config.txt. If no file is specified on the command line and no default
356 configuration file can be found, Privoxy will fail to start.
357
358 The included default configuration files should give a reasonable starting
359 point, though may be somewhat aggressive in blocking junk. Most of the per site
360 configuration is done in the "actions" files. These are where various cookie
361 actions are defined, ad and banner blocking, and other aspects of Privoxy
362 configuration. There are several such files included, with varying levels of
363 aggressiveness.
364
365 You will probably want to keep an eye out for sites that require persistent
366 cookies, and add these to default.action as needed. By default, most of these
367 will be accepted only during the current browser session, until you add them to
368 the configuration. If you want the browser to handle this instead, you will
369 need to edit default.action and disable this feature. If you use more than one
370 browser, it would make more sense to let Privoxy handle this. In which case,
371 the browser(s) should be set to accept all cookies.
372
373 Privoxy is HTTP/1.1 compliant, but not all 1.1 features are as yet implemented.
374 If browsers that support HTTP/1.1 (like Mozilla or recent versions of I.E.)
375 experience problems, you might try to force HTTP/1.0 compatibility. For
376 Mozilla, look under Edit -> Preferences -> Debug -> Networking. Or set the 
377 "+downgrade" config option in default.action.
378
379 After running Privoxy for a while, you can start to fine tune the configuration
380 to suit your personal, or site, preferences and requirements. There are many,
381 many aspects that can be customized. "Actions" (as specified in default.action)
382 can be adjusted by pointing your browser to http://p.p/, and then follow the
383 link to "edit the actions list". (This is an internal page and does not require
384 Internet access.)
385
386 In fact, various aspects of Privoxy configuration can be viewed from this page,
387 including current configuration parameters, source code version numbers, the
388 browser's request headers, and "actions" that apply to a given URL. In addition
389 to the default.action file editor mentioned above, Privoxy can also be turned 
390 "on" and "off" from this page.
391
392 If you encounter problems, please verify it is a Privoxy bug, by disabling 
393 Privoxy, and then trying the same page. Also, try another browser if possible
394 to eliminate browser or site problems. Before reporting it as a bug, see if
395 there is not a configuration option that is enabled that is causing the page
396 not to load. You can then add an exception for that page or site. For instance,
397 try adding it to the {fragile} section of default.action. This will turn off
398 most actions for this site. For more on troubleshooting problem sites, see the 
399 Appendix. If a bug, please report it to the developers (see below).
400 -------------------------------------------------------------------------------
401
402 4.1. Command Line Options
403
404 Privoxy may be invoked with the following command-line options:
405
406   * --version
407    
408     Print version info and exit, Unix only.
409    
410   * --help
411    
412     Print a short usage info and exit, Unix only.
413    
414   * --no-daemon
415    
416     Don't become a daemon, i.e. don't fork and become process group leader,
417     don't detach from controlling tty. Unix only.
418    
419   * --pidfile FILE
420    
421     On startup, write the process ID to FILE. Delete the FILE on exit. Failiure
422     to create or delete the FILE is non-fatal. If no FILE option is given, no
423     PID file will be used. Unix only.
424    
425   * --user USER[.GROUP]
426    
427     After (optionally) writing the PID file, assume the user ID of USER, and if
428     included the GID of GROUP. Exit if the privileges are not sufficient to do
429     so. Unix only.
430    
431   * configfile
432    
433     If no configfile is included on the command line, Privoxy will look for a
434     file named "config" in the current directory (except on Win32 where it will
435     look for "config.txt" instead). Specify full path to avoid confusion.
436    
437
438 -------------------------------------------------------------------------------
439 5. Privoxy Configuration
440
441 All Privoxy configuration is stored in text files. These files can be edited
442 with a text editor. Many important aspects of Privoxy can also be controlled
443 easily with a web browser.
444 -------------------------------------------------------------------------------
445
446 5.1. Controlling Privoxy with Your Web Browser
447
448 Privoxy can be reached by the special URL http://p.p/ (or alternately http://
449 config.privoxy.org/), which is an internal page. You will see the following
450 section: 
451
452 Please choose from the following options:                                      
453                                                                                
454     * Show information about the current configuration                         
455     * Show the source code version numbers                                     
456     * Show the client's request headers.                                       
457     * Show which actions apply to a URL and why                                
458     * Toggle Privoxy on or off                                                 
459     * Edit the actions list                                                    
460                                                                                
461                                                                                
462
463 This should be self-explanatory. Note the last item is an editor for the 
464 "actions list", which is where much of the ad, banner, cookie, and URL blocking
465 magic is configured as well as other advanced features of Privoxy. This is an
466 easy way to adjust various aspects of Privoxy configuration. The actions file,
467 and other configuration files, are explained in detail below. Privoxy will
468 automatically detect any changes to these files.
469
470 "Toggle Privoxy On or Off" is handy for sites that might have problems with
471 your current actions and filters, or just to test if a site misbehaves, whether
472 it is Privoxy causing the problem or not. Privoxy continues to run as a proxy
473 in this case, but all filtering is disabled. 
474 -------------------------------------------------------------------------------
475
476 5.2. Configuration Files Overview
477
478 For Unix, *BSD and Linux, all configuration files are located in /etc/privoxy/
479 by default. For MS Windows, OS/2, and AmigaOS these are all in the same
480 directory as the Privoxy executable. The name and number of configuration files
481 has changed from previous versions, and is subject to change as development
482 progresses.
483
484 The installed defaults provide a reasonable starting point, though possibly
485 aggressive by some standards. For the time being, there are only three default
486 configuration files (this may change in time):
487
488   * The main configuration file is named config on Linux, Unix, BSD, OS/2, and
489     AmigaOS and config.txt on Windows.
490    
491   * The default.action file is used to define various "actions" relating to
492     images, banners, pop-ups, access restrictions, banners and cookies. There
493     is a CGI based editor for this file that can be accessed via http://p.p.
494     (Other actions files are included as well with differing levels of
495     filtering and blocking, e.g. basic.action.)
496    
497   * The default.filter file can be used to re-write the raw page content,
498     including viewable text as well as embedded HTML and JavaScript, and
499     whatever else lurks on any given web page.
500    
501
502 default.action and default.filter can use Perl style regular expressions for
503 maximum flexibility. All files use the "#" character to denote a comment. Such
504 lines are not processed by Privoxy. After making any changes, there is no need
505 to restart Privoxy in order for the changes to take effect. Privoxy should
506 detect such changes automatically.
507
508 While under development, the configuration content is subject to change. The
509 below documentation may not be accurate by the time you read this. Also, what
510 constitutes a "default" setting, may change, so please check all your
511 configuration files on important issues.
512 -------------------------------------------------------------------------------
513
514 5.3. The Main Configuration File
515
516 Again, the main configuration file is named config on Linux/Unix/BSD and OS/2,
517 and config.txt on Windows. Configuration lines consist of an initial keyword
518 followed by a list of values, all separated by whitespace (any number of spaces
519 or tabs). For example:
520
521   blockfile blocklist.ini
522    
523
524 Indicates that the blockfile is named "blocklist.ini". (A default installation
525 does not use this.)
526
527 A "#" indicates a comment. Any part of a line following a "#" is ignored,
528 except if the "#" is preceded by a "\".
529
530 Thus, by placing a "#" at the start of an existing configuration line, you can
531 make it a comment and it will be treated as if it weren't there. This is called
532 "commenting out" an option and can be useful to turn off features: If you
533 comment out the "logfile" line, Privoxy will not log to a file at all. Watch
534 for the "default:" section in each explanation to see what happens if the
535 option is left unset (or commented out).
536
537 Long lines can be continued on the next line by using a "\" as the very last
538 character.
539
540 There are various aspects of Privoxy behavior that can be tuned.
541 -------------------------------------------------------------------------------
542
543 5.3.1. Defining Other Configuration Files
544
545 Privoxy can use a number of other files to tell it what ads to block, what
546 cookies to accept, and perform other functions. This section of the
547 configuration file tells Privoxy where to find all those other files.
548
549 On Windows and AmigaOS, Privoxy looks for these files in the same directory as
550 the executable. On Unix and OS/2, Privoxy looks for these files in the current
551 working directory. In either case, an absolute path name can be used to avoid
552 problems.
553
554 When development goes modular and multi-user, the blocker, filter, and per-user
555 config will be stored in subdirectories of "confdir". For now, only confdir/
556 templates is used for storing HTML templates for CGI results.
557
558 The location of the configuration files:
559
560   confdir /etc/privoxy       # No trailing /, please.
561    
562
563 The directory where all logging (i.e. logfile and jarfile) takes place. No
564 trailing "/", please:
565
566   logdir /var/log/privoxy
567    
568
569 Note that all file specifications below are relative to the above two
570 directories!
571
572 The "default.action" file contains patterns to specify the actions to apply to
573 requests for each site. Default: Cookies to and from all destinations are kept
574 only during the current browser session (i.e. they are not saved to disk).
575 Pop-ups are disabled for all sites. All sites are filtered through selected
576 sections of "default.filter". No sites are blocked. Privoxy displays a
577 checkboard type pattern for filtered ads and other images. The syntax of this
578 file is explained in detail below. Other "actions" files are included, and you
579 are free to use any of them. They have varying degrees of aggressiveness.
580
581   actionsfile default.action
582    
583
584 The "default.filter" file contains content modification rules that use "regular
585 expressions". These rules permit powerful changes on the content of Web pages,
586 e.g., you could disable your favorite JavaScript annoyances, re-write the
587 actual displayed text, or just have some fun replacing "Microsoft" with 
588 "MicroSuck" wherever it appears on a Web page. Default: whatever the developers
589 are playing with :-/
590
591 Filtering requires buffering the page content, which may appear to slow down
592 page rendering since nothing is displayed until all content has passed the
593 filters. (It does not really take longer, but seems that way since the page is
594 not incrementally displayed.) This effect will be more noticeable on slower
595 connections. 
596
597   filterfile default.filter
598    
599
600 The logfile is where all logging and error messages are written. The logfile
601 can be useful for tracking down a problem with Privoxy (e.g., it's not blocking
602 an ad you think it should block) but in most cases you probably will never look
603 at it.
604
605 Your logfile will grow indefinitely, and you will probably want to periodically
606 remove it. On Unix systems, you can do this with a cron job (see "man cron").
607 For Redhat, a logrotate script has been included.
608
609 On SuSE Linux systems, you can place a line like "/var/log/privoxy.* +1024k 644
610 nobody.nogroup" in /etc/logfiles, with the effect that cron.daily will
611 automatically archive, gzip, and empty the log, when it exceeds 1M size.
612
613 Default: Log to the a file named logfile. Comment out to disable logging.
614
615   logfile logfile
616    
617
618 The "jarfile" defines where Privoxy stores the cookies it intercepts. Note that
619 if you use a "jarfile", it may grow quite large. Default: Don't store
620 intercepted cookies.
621
622   #jarfile jarfile
623    
624
625 If you specify a "trustfile", Privoxy will only allow access to sites that are
626 named in the trustfile. You can also mark sites as trusted referrers, with the
627 effect that access to untrusted sites will be granted, if a link from a trusted
628 referrer was used. The link target will then be added to the "trustfile". This
629 is a very restrictive feature that typical users most probably want to leave
630 disabled. Default: Disabled, don't use the trust mechanism.
631
632   #trustfile trust
633    
634
635 If you use the trust mechanism, it is a good idea to write up some on-line
636 documentation about your blocking policy and to specify the URL(s) here. They
637 will appear on the page that your users receive when they try to access
638 untrusted content. Use multiple times for multiple URLs. Default: Don't display
639 links on the "untrusted" info page.
640
641   trust-info-url http://www.example.com/why_we_block.html
642   trust-info-url http://www.example.com/what_we_allow.html
643    
644 -------------------------------------------------------------------------------
645
646 5.3.2. Other Configuration Options
647
648 This part of the configuration file contains options that control how Privoxy
649 operates.
650
651 "Admin-address" should be set to the email address of the proxy administrator.
652 It is used in many of the proxy-generated pages. Default: fill@me.in.please.
653
654   #admin-address fill@me.in.please
655    
656
657 "Proxy-info-url" can be set to a URL that contains more info about this Privoxy
658 installation, it's configuration and policies. It is used in many of the
659 proxy-generated pages and its use is highly recommended in multi-user
660 installations, since your users will want to know why certain content is
661 blocked or modified. Default: Don't show a link to on-line documentation.
662
663   proxy-info-url http://www.example.com/proxy.html
664    
665
666 "Listen-address" specifies the address and port where Privoxy will listen for
667 connections from your Web browser. The default is to listen on the localhost
668 port 8118, and this is suitable for most users. (In your web browser, under
669 proxy configuration, list the proxy server as "localhost" and the port as 
670 "8118").
671
672 If you already have another service running on port 8118, or if you want to
673 serve requests from other machines (e.g. on your local network) as well, you
674 will need to override the default. The syntax is "listen-address [<ip-address
675 >]:<port>". If you leave out the IP address, Privoxy will bind to all
676 interfaces (addresses) on your machine and may become reachable from the
677 Internet. In that case, consider using access control lists (acl's) (see 
678 "aclfile" above), or a firewall.
679
680 For example, suppose you are running Privoxy on a machine which has the address
681 192.168.0.1 on your local private network (192.168.0.0) and has another outside
682 connection with a different address. You want it to serve requests from inside
683 only:
684
685   listen-address 192.168.0.1:8118
686    
687
688 If you want it to listen on all addresses (including the outside connection):
689
690   listen-address :8118
691    
692
693 If you do this, consider using ACLs (see "aclfile" above). Note: you will need
694 to point your browser(s) to the address and port that you have configured here.
695 Default: localhost:8118 (127.0.0.1:8118).
696
697 The debug option sets the level of debugging information to log in the logfile
698 (and to the console in the Windows version). A debug level of 1 is informative
699 because it will show you each request as it happens. Higher levels of debug are
700 probably only of interest to developers.
701
702   debug         1 # GPC   = show each GET/POST/CONNECT request
703   debug         2 # CONN  = show each connection status
704   debug         4 # IO    = show I/O status
705   debug         8 # HDR   = show header parsing
706   debug        16 # LOG   = log all data into the logfile
707   debug        32 # FRC   = debug force feature
708   debug        64 # REF   = debug regular expression filter 
709   debug       128 #       = debug fast redirects
710   debug       256 #       = debug GIF de-animation
711   debug       512 # CLF   = Common Log Format
712   debug      1024 #       = debug kill pop-ups
713   debug      4096 # INFO  = Startup banner and warnings.
714   debug      8192 # ERROR = Non-fatal errors
715     
716
717 It is highly recommended that you enable ERROR reporting (debug 8192), at least
718 until v3.0 is released.
719
720 The reporting of FATAL errors (i.e. ones which crash Privoxy) is always on and
721 cannot be disabled.
722
723 If you want to use CLF (Common Log Format), you should set "debug 512" ONLY, do
724 not enable anything else.
725
726 Multiple "debug" directives, are OK - they're logical-OR'd together.
727
728   debug 15 # same as setting the first 4 listed above
729    
730
731 Default:
732
733   debug 1 # URLs
734   debug 4096 # Info
735   debug 8192 # Errors - *we highly recommended enabling this*
736    
737
738 Privoxy normally uses "multi-threading", a software technique that permits it
739 to handle many different requests simultaneously. In some cases you may wish to
740 disable this -- particularly if you're trying to debug a problem. The 
741 "single-threaded" option forces Privoxy to handle requests sequentially.
742 Default: Multi-threaded mode.
743
744   #single-threaded
745    
746
747 "toggle" allows you to temporarily disable all Privoxy's filtering. Just set 
748 "toggle 0".
749
750 The Windows version of Privoxy puts an icon in the system tray, which also
751 allows you to change this option. If you right-click on that icon (or select
752 the "Options" menu), one choice is "Enable". Clicking on enable toggles Privoxy
753 on and off. This is useful if you want to temporarily disable Privoxy, e.g., to
754 access a site that requires cookies which you would otherwise have blocked.
755 This can also be toggled via a web browser at the Privoxy internal address of 
756 http://p.p on any platform.
757
758 "toggle 1" means Privoxy runs normally, "toggle 0" means that Privoxy becomes a
759 non-anonymizing non-blocking proxy. Default: 1 (on).
760
761   toggle 1
762    
763
764 For content filtering, i.e. the "+filter" and "+deanimate-gif" actions, it is
765 necessary that Privoxy buffers the entire document body. This can be
766 potentially dangerous, since a server could just keep sending data indefinitely
767 and wait for your RAM to exhaust. With nasty consequences.
768
769 The buffer-limit option lets you set the maximum size in Kbytes that each
770 buffer may use. When the documents buffer exceeds this size, it is flushed to
771 the client unfiltered and no further attempt to filter the rest of it is made.
772 Remember that there may multiple threads running, which might require
773 increasing the "buffer-limit" Kbytes each, unless you have enabled 
774 "single-threaded" above.
775
776   buffer-limit 4069
777    
778
779 To enable the web-based default.action file editor set enable-edit-actions to
780 1, or 0 to disable. Note that you must have compiled Privoxy with support for
781 this feature, otherwise this option has no effect. This internal page can be
782 reached at http://p.p.
783
784 Security note: If this is enabled, anyone who can use the proxy can edit the
785 actions file, and their changes will affect all users. For shared proxies, you
786 probably want to disable this. Default: enabled.
787
788   enable-edit-actions 1
789    
790
791 Allow Privoxy to be toggled on and off remotely, using your web browser. Set 
792 "enable-remote-toggle"to 1 to enable, and 0 to disable. Note that you must have
793 compiled Privoxy with support for this feature, otherwise this option has no
794 effect.
795
796 Security note: If this is enabled, anyone who can use the proxy can toggle it
797 on or off (see http://p.p), and their changes will affect all users. For shared
798 proxies, you probably want to disable this. Default: enabled.
799
800   enable-remote-toggle 1
801    
802 -------------------------------------------------------------------------------
803
804 5.3.3. Access Control List (ACL)
805
806 Access controls are included at the request of some ISPs and systems
807 administrators, and are not usually needed by individual users. Please note the
808 warnings in the FAQ that this proxy is not intended to be a substitute for a
809 firewall or to encourage anyone to defer addressing basic security weaknesses.
810
811 If no access settings are specified, the proxy talks to anyone that connects.
812 If any access settings file are specified, then the proxy talks only to IP
813 addresses permitted somewhere in this file and not denied later in this file.
814
815 Summary -- if using an ACL:
816
817 Client must have permission to receive service.
818
819 LAST match in ACL wins.
820
821 Default behavior is to deny service.
822
823 The syntax for an entry in the Access Control List is:
824
825   ACTION    SRC_ADDR[/SRC_MASKLEN]    [ DST_ADDR[/DST_MASKLEN] ]
826    
827
828 Where the individual fields are:
829
830  ACTION      = "permit-access" or "deny-access"
831
832  SRC_ADDR    = client hostname or dotted IP address
833  SRC_MASKLEN = number of bits in the subnet mask for the source
834
835  DST_ADDR    = server or forwarder hostname or dotted IP address
836  DST_MASKLEN = number of bits in the subnet mask for the target
837    
838
839 The field separator (FS) is whitespace (space or tab).
840
841 IMPORTANT NOTE: If Privoxy is using a forwarder (see below) or a gateway for a
842 particular destination URL, the DST_ADDR that is examined is the address of the
843 forwarder or the gateway and NOT the address of the ultimate target. This is
844 necessary because it may be impossible for the local Privoxy to determine the
845 address of the ultimate target (that's often what gateways are used for).
846
847 Here are a few examples to show how the ACL features work:
848
849 "localhost" is OK -- no DST_ADDR implies that ALL destination addresses are OK:
850
851   permit-access localhost
852    
853
854 A silly example to illustrate permitting any host on the class-C subnet with 
855 Privoxy to go anywhere:
856
857   permit-access www.privoxy.com/24
858    
859
860 Except deny one particular IP address from using it at all:
861
862   deny-access ident.privoxy.com
863    
864
865 You can also specify an explicit network address and subnet mask. Explicit
866 addresses do not have to be resolved to be used.
867
868   permit-access 207.153.200.0/24
869    
870
871 A subnet mask of 0 matches anything, so the next line permits everyone.
872
873   permit-access 0.0.0.0/0
874    
875
876 Note, you cannot say:
877
878   permit-access .org
879    
880
881 to allow all *.org domains. Every IP address listed must resolve fully.
882
883 An ISP may want to provide a Privoxy that is accessible by "the world" and yet
884 restrict use of some of their private content to hosts on its internal network
885 (i.e. its own subscribers). Say, for instance the ISP owns the Class-B IP
886 address block 123.124.0.0 (a 16 bit netmask). This is how they could do it:
887
888  permit-access 0.0.0.0/0 0.0.0.0/0   # other clients can go anywhere 
889                                        # with the following exceptions:
890  
891  deny-access   0.0.0.0/0   123.124.0.0/16 # block all external requests for
892                                           # sites on the ISP's network
893
894  permit 0.0.0.0/0 www.my_isp.com        # except for the ISP's main 
895                                           # web site
896
897  permit 123.124.0.0/16 0.0.0.0/0          # the ISP's clients can go 
898                                           # anywhere
899    
900
901 Note that if some hostnames are listed with multiple IP addresses, the primary
902 value returned by DNS (via gethostbyname()) is used. Default: Anyone can access
903 the proxy.
904 -------------------------------------------------------------------------------
905
906 5.3.4. Forwarding
907
908 This feature allows chaining of HTTP requests via multiple proxies. It can be
909 used to better protect privacy and confidentiality when accessing specific
910 domains by routing requests to those domains to a special purpose filtering
911 proxy such as lpwa.com. Or to use a caching proxy to speed up browsing.
912
913 It can also be used in an environment with multiple networks to route requests
914 via multiple gateways allowing transparent access to multiple networks without
915 having to modify browser configurations.
916
917 Also specified here are SOCKS proxies. Privoxy SOCKS 4 and SOCKS 4A. The
918 difference is that SOCKS 4A will resolve the target hostname using DNS on the
919 SOCKS server, not our local DNS client.
920
921 The syntax of each line is:
922
923  forward target_domain[:port] http_proxy_host[:port]
924  forward-socks4 target_domain[:port] socks_proxy_host[:port] http_proxy_host[:
925 port]
926  forward-socks4a target_domain[:port] socks_proxy_host[:port] http_proxy_host[:
927 port]
928    
929
930 If http_proxy_host is ".", then requests are not forwarded to a HTTP proxy but
931 are made directly to the web servers.
932
933 Lines are checked in sequence, and the last match wins.
934
935 There is an implicit line equivalent to the following, which specifies that
936 anything not finding a match on the list is to go out without forwarding or
937 gateway protocol, like so:
938
939   forward .* . # implicit
940    
941
942 In the following common configuration, everything goes to Lucent's LPWA, except
943 SSL on port 443 (which it doesn't handle):
944
945  forward .* lpwa.com:8000
946  forward :443 .
947    
948
949 Some users have reported difficulties related to LPWA's use of "." as the last
950 element of the domain, and have said that this can be fixed with this:
951
952   forward lpwa. lpwa.com:8000
953    
954
955 (NOTE: the syntax for specifying target_domain has changed since the previous
956 paragraph was written -- it will not work now. More information is welcome.)
957
958 In this fictitious example, everything goes via an ISP's caching proxy, except
959 requests to that ISP:
960
961  forward .* caching.myisp.net:8000
962  forward myisp.net .
963    
964
965 For the @home network, we're told the forwarding configuration is this:
966
967   forward .* proxy:8080
968    
969
970 Also, we're told they insist on getting cookies and JavaScript, so you should
971 allow cookies from home.com. We consider JavaScript a potential security risk.
972 Java need not be enabled.
973
974 In this example direct connections are made to all "internal" domains, but
975 everything else goes through Lucent's LPWA by way of the company's SOCKS
976 gateway to the Internet.
977
978  forward-socks4 .* lpwa.com:8000 firewall.my_company.com:1080
979  forward my_company.com .
980    
981
982 This is how you could set up a site that always uses SOCKS but no forwarders:
983
984   forward-socks4a .* . firewall.my_company.com:1080
985    
986
987 An advanced example for network administrators:
988
989 If you have links to multiple ISPs that provide various special content to
990 their subscribers, you can configure forwarding to pass requests to the
991 specific host that's connected to that ISP so that everybody can see all of the
992 content on all of the ISPs.
993
994 This is a bit tricky, but here's an example:
995
996 host-a has a PPP connection to isp-a.com. And host-b has a PPP connection to
997 isp-b.com. host-a can run a Privoxy proxy with forwarding like this:
998
999  forward .* .
1000  forward isp-b.com host-b:8118
1001    
1002
1003 host-b can run a Privoxy proxy with forwarding like this:
1004
1005  forward .* .
1006  forward isp-a.com host-a:8118
1007    
1008
1009 Now, anyone on the Internet (including users on host-a and host-b) can set
1010 their browser's proxy to either host-a or host-b and be able to browse the
1011 content on isp-a or isp-b.
1012
1013 Here's another practical example, for University of Kent at Canterbury students
1014 with a network connection in their room, who need to use the University's Squid
1015 web cache.
1016
1017  forward *. ssbcache.ukc.ac.uk:3128  # Use the proxy, except for:
1018  forward .ukc.ac.uk .  # Anything on the same domain as us
1019  forward * .  # Host with no domain specified
1020  forward 129.12.*.* .  # A dotted IP on our /16 network.
1021  forward 127.*.*.* .  # Loopback address
1022  forward localhost.localdomain .  # Loopback address
1023  forward www.ukc.mirror.ac.uk .  # Specific host
1024    
1025
1026 If you intend to chain Privoxy and squid locally, then chain as browser ->
1027 squid -> privoxy is the recommended way.
1028
1029 Your squid configuration could then look like this (assuming that the IP
1030 address of the box is 192.168.0.1 ):
1031
1032   # Define Privoxy as parent cache 
1033   
1034   cache_peer 192.168.0.1 parent 8118 0 no-query
1035
1036   # don't listen to the whole world
1037   http_port 192.168.0.1:3128
1038
1039   # define the local lan
1040   acl mylocallan src 192.168.0.1-192.168.0.5/255.255.255.255
1041
1042   # grant access for http to local lan
1043   http_access allow mylocallan
1044   
1045   # Define ACL for protocol FTP 
1046   acl FTP proto FTP 
1047
1048   # Do not forward ACL FTP to privoxy
1049   always_direct allow FTP 
1050
1051   # Do not forward ACL CONNECT (https) to privoxy
1052   always_direct allow CONNECT 
1053
1054   # Forward the rest to privoxy
1055   never_direct allow all 
1056    
1057 -------------------------------------------------------------------------------
1058
1059 5.3.5. Windows GUI Options
1060
1061 Privoxy has a number of options specific to the Windows GUI interface:
1062
1063 If "activity-animation" is set to 1, the Privoxy icon will animate when 
1064 "Privoxy" is active. To turn off, set to 0.
1065
1066   activity-animation 1
1067    
1068
1069 If "log-messages" is set to 1, Privoxy will log messages to the console window:
1070
1071   log-messages 1
1072    
1073
1074 If "log-buffer-size" is set to 1, the size of the log buffer, i.e. the amount
1075 of memory used for the log messages displayed in the console window, will be
1076 limited to "log-max-lines" (see below).
1077
1078 Warning: Setting this to 0 will result in the buffer to grow infinitely and eat
1079 up all your memory!
1080
1081   log-buffer-size 1
1082    
1083
1084 log-max-lines is the maximum number of lines held in the log buffer. See above.
1085
1086   log-max-lines 200
1087    
1088
1089 If "log-highlight-messages" is set to 1, Privoxy will highlight portions of the
1090 log messages with a bold-faced font:
1091
1092   log-highlight-messages 1
1093    
1094
1095 The font used in the console window:
1096
1097   log-font-name Comic Sans MS
1098    
1099
1100 Font size used in the console window:
1101
1102   log-font-size 8
1103    
1104
1105 "show-on-task-bar" controls whether or not Privoxy will appear as a button on
1106 the Task bar when minimized:
1107
1108   show-on-task-bar 0
1109    
1110
1111 If "close-button-minimizes" is set to 1, the Windows close button will minimize
1112 Privoxy instead of closing the program (close with the exit option on the File
1113 menu).
1114
1115   close-button-minimizes 1
1116    
1117
1118 The "hide-console" option is specific to the MS-Win console version of Privoxy.
1119 If this option is used, Privoxy will disconnect from and hide the command
1120 console.
1121
1122   #hide-console
1123    
1124 -------------------------------------------------------------------------------
1125
1126 5.4. The Actions File
1127
1128 The "default.action" file (formerly actionsfile or ijb.action) is used to
1129 define what actions Privoxy takes, and thus determines how ad images, cookies
1130 and various other aspects of HTTP content and transactions are handled. These
1131 can be accepted or rejected for all sites, or just those sites you choose. See
1132 below for a complete list of actions.
1133
1134 Anything you want can blocked, including ads, banners, or just some obnoxious
1135 URL that you would rather not see. Cookies can be accepted or rejected, or
1136 accepted only during the current browser session (i.e. not written to disk).
1137 Changes to default.action should be immediately visible to Privoxy without the
1138 need to restart.
1139
1140 Note that some sites may misbehave, or possibly not work at all with some
1141 actions. This may require some tinkering with the rules to get the most mileage
1142 of Privoxy's features, and still be able to see and enjoy just what you want
1143 to. There is no general rule of thumb on these things. There just are too many
1144 variables, and sites are always changing. 
1145
1146 The easiest way to edit the "actions" file is with a browser by loading http://
1147 p.p/, and then select "Edit Actions List". A text editor can also be used.
1148
1149 To determine which actions apply to a request, the URL of the request is
1150 compared to all patterns in this file. Every time it matches, the list of
1151 applicable actions for the URL is incrementally updated. You can trace this
1152 process by visiting http://p.p/show-url-info.
1153
1154 There are four types of lines in this file: comments (begin with a "#"
1155 character), actions, aliases and patterns, all of which are explained below, as
1156 well as the configuration file syntax that Privoxy understands. 
1157 -------------------------------------------------------------------------------
1158
1159 5.4.1. URL Domain and Path Syntax
1160
1161 Generally, a pattern has the form <domain>/<path>, where both the <domain> and
1162 <path> part are optional. If you only specify a domain part, the "/" can be
1163 left out:
1164
1165 www.example.com - is a domain only pattern and will match any request to 
1166 "www.example.com".
1167
1168 www.example.com/ - means exactly the same.
1169
1170 www.example.com/index.html - matches only the single document "/index.html" on 
1171 "www.example.com".
1172
1173 /index.html - matches the document "/index.html", regardless of the domain. So
1174 would match any page named "index.html" on any site.
1175
1176 index.html - matches nothing, since it would be interpreted as a domain name
1177 and there is no top-level domain called ".html".
1178
1179 The matching of the domain part offers some flexible options: if the domain
1180 starts or ends with a dot, it becomes unanchored at that end. For example:
1181
1182 .example.com - matches any domain or sub-domain that ENDS in ".example.com".
1183
1184 www. - matches any domain that STARTS with "www".
1185
1186 Additionally, there are wild-cards that you can use in the domain names
1187 themselves. They work pretty similar to shell wild-cards: "*" stands for zero
1188 or more arbitrary characters, "?" stands for any single character. And you can
1189 define character classes in square brackets and they can be freely mixed:
1190
1191 ad*.example.com - matches "adserver.example.com", "ads.example.com", etc but
1192 not "sfads.example.com".
1193
1194 *ad*.example.com - matches all of the above, and then some.
1195
1196 .?pix.com - matches "www.ipix.com", "pictures.epix.com", "a.b.c.d.e.upix.com",
1197 etc.
1198
1199 www[1-9a-ez].example.com - matches "www1.example.com", "www4.example.com", 
1200 "wwwd.example.com", "wwwz.example.com", etc., but not "wwww.example.com".
1201
1202 If Privoxy was compiled with "pcre" support (the default), Perl compatible
1203 regular expressions can be used. These are more flexible and powerful than
1204 other types of "regular expressions". See the pcre/docs/ directory or "man
1205 perlre" (also available on http://www.perldoc.com/perl5.6/pod/perlre.html) for
1206 details. A brief discussion of regular expressions is in the Appendix. For
1207 instance:
1208
1209 /.*/advert[0-9]+\.jpe?g - would match a URL from any domain, with any path that
1210 includes "advert" followed immediately by one or more digits, then a "." and
1211 ending in either "jpeg" or "jpg". So we match "example.com/ads/advert2.jpg",
1212 and "www.example.com/ads/banners/advert39.jpeg", but not "www.example.com/ads/
1213 banners/advert39.gif" (no gifs in the example pattern).
1214
1215 Please note that matching in the path is case INSENSITIVE by default, but you
1216 can switch to case sensitive at any point in the pattern by using the "(?-i)"
1217 switch:
1218
1219 www.example.com/(?-i)PaTtErN.* - will match only documents whose path starts
1220 with "PaTtErN" in exactly this capitalization.
1221 -------------------------------------------------------------------------------
1222
1223 5.4.2. Actions
1224
1225 Actions are enabled if preceded with a "+", and disabled if preceded with a "-"
1226 . Actions are invoked by enclosing the action name in curly braces (e.g.
1227 {+some_action}), followed by a list of URLs to which the action applies. There
1228 are three classes of actions:
1229
1230   * Boolean (e.g. "+/-block"):
1231    
1232       {+name}        # enable this action
1233       {-name}        # disable this action
1234          
1235    
1236   * parameterized (e.g. "+/-hide-user-agent"):
1237    
1238       {+name{param}}  # enable action and set parameter to "param"
1239       {-name}         # disable action
1240          
1241    
1242   * Multi-value (e.g. "{+/-add-header{Name: value}}", "{+/-wafer{name=value}}"
1243     ):
1244    
1245       {+name{param}}   # enable action and add parameter "param"
1246       {-name{param}}   # remove the parameter "param"
1247       {-name}          # disable this action totally
1248          
1249    
1250
1251 If nothing is specified in this file, no "actions" are taken. So in this case 
1252 Privoxy would just be a normal, non-blocking, non-anonymizing proxy. You must
1253 specifically enable the privacy and blocking features you need (although the
1254 provided default default.action file will give a good starting point).
1255
1256 Later defined actions always over-ride earlier ones. So exceptions to any rules
1257 you make, should come in the latter part of the file. For multi-valued actions,
1258 the actions are applied in the order they are specified.
1259
1260 The list of valid Privoxy "actions" are:
1261
1262   * Add the specified HTTP header, which is not checked for validity. You may
1263     specify this many times to specify many different headers:
1264    
1265       +add-header{Name: value}
1266          
1267    
1268   * Block this URL totally. In a default installation, a "blocked" URL will
1269     result in bright red banner that says "BLOCKED", with a reason why it is
1270     being blocked, and an option to see it anyway. The page displayed for this
1271     is the "blocked" template file.
1272    
1273       +block
1274          
1275    
1276   * De-animate all animated GIF images, i.e. reduce them to their last frame.
1277     This will also shrink the images considerably (in bytes, not pixels!). If
1278     the option "first" is given, the first frame of the animation is used as
1279     the replacement. If "last" is given, the last frame of the animation is
1280     used instead, which probably makes more sense for most banner animations,
1281     but also has the risk of not showing the entire last frame (if it is only a
1282     delta to an earlier frame).
1283    
1284       +deanimate-gifs{last}
1285       +deanimate-gifs{first}
1286          
1287    
1288   * "+downgrade" will downgrade HTTP/1.1 client requests to HTTP/1.0 and
1289     downgrade the responses as well. Use this action for servers that use HTTP/
1290     1.1 protocol features that Privoxy doesn't handle well yet. HTTP/1.1 is
1291     only partially implemented. Default is not to downgrade requests.
1292    
1293       +downgrade
1294          
1295    
1296   * Many sites, like yahoo.com, don't just link to other sites. Instead, they
1297     will link to some script on their own server, giving the destination as a
1298     parameter, which will then redirect you to the final target. URLs resulting
1299     from this scheme typically look like: http://some.place/some_script?http://
1300     some.where-else.
1301    
1302     Sometimes, there are even multiple consecutive redirects encoded in the
1303     URL. These redirections via scripts make your web browsing more traceable,
1304     since the server from which you follow such a link can see where you go to.
1305     Apart from that, valuable bandwidth and time is wasted, while your browser
1306     ask the server for one redirect after the other. Plus, it feeds the
1307     advertisers.
1308    
1309     The "+fast-redirects" option enables interception of these types of
1310     requests by Privoxy, who will cut off all but the last valid URL in the
1311     request and send a local redirect back to your browser without contacting
1312     the intermediate site(s).
1313    
1314       +fast-redirects
1315          
1316    
1317   * Apply the filters in the section_header section of the default.filter file
1318     to the site(s). default.filter sections are grouped according to like
1319     functionality. Filters can be used to re-write any of the raw page content.
1320     This is a potentially a very powerful feature!
1321    
1322      +filter{section_header}
1323          
1324    
1325     Filter sections that are pre-defined in the supplied default.filter
1326     include:
1327    
1328        
1329         html-annoyances: Get rid of particularly annoying HTML abuse.
1330        
1331         js-annoyances: Get rid of particularly annoying JavaScript abuse
1332        
1333         no-poups: Kill all popups in JS and HTML
1334        
1335         frameset-borders: Give frames a border
1336        
1337         webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
1338        
1339         no-refresh: Automatic refresh sucks on auto-dialup lines
1340        
1341         fun: Text replacements for subversive browsing fun!
1342        
1343         nimda: Remove (virus) Nimda code.
1344        
1345         banners-by-size: Kill banners by size
1346        
1347         crude-parental: Kill all web pages that contain the words "sex" or     
1348         "warez"                                                                
1349        
1350        
1351    
1352   * Block any existing X-Forwarded-for header, and do not add a new one:
1353    
1354       +hide-forwarded
1355          
1356    
1357   * If the browser sends a "From:" header containing your e-mail address, this
1358     either completely removes the header ("block"), or changes it to the
1359     specified e-mail address.
1360    
1361       +hide-from{block}
1362       +hide-from{spam@sittingduck.xqq}
1363          
1364    
1365   * Don't send the "Referer:" (sic) header to the web site. You can block it,
1366     forge a URL to the same server as the request (which is preferred because
1367     some sites will not send images otherwise) or set it to a constant, user
1368     defined string of your choice.
1369    
1370       +hide-referer{block}
1371       +hide-referer{forge}
1372       +hide-referer{http://nowhere.com}
1373          
1374    
1375   * Alternative spelling of "+hide-referer". It has the same parameters, and
1376     can be freely mixed with, "+hide-referer". ("referrer" is the correct
1377     English spelling, however the HTTP specification has a bug - it requires it
1378     to be spelled "referer".)
1379    
1380       +hide-referrer{...}
1381          
1382    
1383   * Change the "User-Agent:" header so web servers can't tell your browser
1384     type. Warning! This breaks many web sites. Specify the user-agent value you
1385     want. Example, pretend to be using Netscape on Linux:
1386    
1387       +hide-user-agent{Mozilla (X11; I; Linux 2.0.32 i586)}
1388          
1389    
1390   * Treat this URL as an image. This only matters if it's also "+block"ed, in
1391     which case a "blocked" image can be sent rather than a HTML page. See 
1392     "+image-blocker{}" below for the control over what is actually sent. If you
1393     want invisible ads, they should be defined as images and blocked. And also,
1394     "image-blocker" should be set to "blank". Note you cannot treat HTML pages
1395     as images in most cases. For instance, frames require an HTML page to
1396     display. So a frame that is an ad, cannot be treated as an image. Forcing
1397     an "image" in this situation just will not work.
1398    
1399       +image
1400          
1401    
1402   * Decides what to do with URLs that end up tagged with "{+block +image}", e.g
1403     an advertizement. There are five options. "-image-blocker" will send a HTML
1404     "blocked" page, usually resulting in a "broken image" icon. "+image-blocker
1405     {blank}" will send a 1x1 transparent GIF image. And finally, 
1406     "+image-blocker{http://xyz.com}" will send a HTTP temporary redirect to the
1407     specified image. This has the advantage of the icon being being cached by
1408     the browser, which will speed up the display. "+image-blocker{pattern}"
1409     will send a checkboard type pattern
1410    
1411       +image-blocker{blank}
1412       +image-blocker{pattern}
1413       +image-blocker{http://p.p/send-banner}
1414          
1415    
1416   * By default (i.e. in the absence of a "+limit-connect" action), Privoxy will
1417     only allow CONNECT requests to port 443, which is the standard port for
1418     https as a precaution.
1419    
1420     The CONNECT methods exists in HTTP to allow access to secure websites
1421     (https:// URLs) through proxies. It works very simply: the proxy connects
1422     to the server on the specified port, and then short-circuits its
1423     connections to the client and to the remote proxy. This can be a big
1424     security hole, since CONNECT-enabled proxies can be abused as TCP relays
1425     very easily.
1426    
1427     If you want to allow CONNECT for more ports than this, or want to forbid
1428     CONNECT altogether, you can specify a comma separated list of ports and
1429     port ranges (the latter using dashes, with the minimum defaulting to 0 and
1430     max to 65K):
1431    
1432       +limit-connect{443} # This is the default and need no be specified.
1433       +limit-connect{80,443} # Ports 80 and 443 are OK.
1434       +limit-connect{-3, 7, 20-100, 500-} # Port less than 3, 7, 20 to 100
1435        #and above 500 are OK.
1436          
1437    
1438   * "+no-compression" prevents the website from compressing the data. Some
1439     websites do this, which can be a problem for Privoxy, since "+filter", 
1440     "+no-popup" and "+gif-deanimate" will not work on compressed data. This
1441     will slow down connections to those websites, though. Default is 
1442     "no-compression" is turned on.
1443    
1444       +nocompression
1445          
1446    
1447   * If the website sets cookies, "no-cookies-keep" will make sure they are
1448     erased when you exit and restart your web browser. This makes profiling
1449     cookies useless, but won't break sites which require cookies so that you
1450     can log in for transactions. Default: on.
1451    
1452       +no-cookies-keep
1453          
1454    
1455   * Prevent the website from reading cookies:
1456    
1457       +no-cookies-read
1458          
1459    
1460   * Prevent the website from setting cookies:
1461    
1462       +no-cookies-set
1463          
1464    
1465   * Filter the website through a built-in filter to disable those obnoxious
1466     JavaScript pop-up windows via window.open(), etc. The two alternative
1467     spellings are equivalent.
1468    
1469       +no-popup
1470       +no-popups
1471          
1472    
1473   * This action only applies if you are using a jarfile for saving cookies. It
1474     sends a cookie to every site stating that you do not accept any copyright
1475     on cookies sent to you, and asking them not to track you. Of course, this
1476     is a (relatively) unique header they could use to track you.
1477    
1478       +vanilla-wafer
1479          
1480    
1481   * This allows you to add an arbitrary cookie. It can be specified multiple
1482     times in order to add as many cookies as you like.
1483    
1484       +wafer{name=value}
1485          
1486    
1487
1488 The meaning of any of the above is reversed by preceding the action with a "-",
1489 in place of the "+".
1490
1491 Some examples:
1492
1493 Turn off cookies by default, then allow a few through for specified sites:
1494
1495  # Turn off all persistent cookies
1496  { +no-cookies-read }
1497  { +no-cookies-set }
1498  # Allow cookies for this browser session ONLY
1499  { +no-cookies-keep }
1500
1501  # Exceptions to the above, sites that benefit from persistent cookies
1502  { -no-cookies-read }
1503  { -no-cookies-set }
1504  { -no-cookies-keep }
1505  .javasoft.com
1506  .sun.com
1507  .yahoo.com
1508  .msdn.microsoft.com
1509  .redhat.com
1510
1511  # Alternative way of saying the same thing
1512  {-no-cookies-set -no-cookies-read -no-cookies-keep}
1513  .sourceforge.net
1514  .sf.net
1515    
1516
1517 Now turn off "fast redirects", and then we allow two exceptions:
1518
1519  # Turn them off!
1520  {+fast-redirects}
1521  
1522  # Reverse it for these two sites, which don't work right without it.
1523  {-fast-redirects}
1524  www.ukc.ac.uk/cgi-bin/wac\.cgi\?
1525  login.yahoo.com
1526    
1527
1528 Turn on page filtering according to rules in the defined sections of
1529 refilterfile, and make one exception for sourceforge:
1530
1531  # Run everything through the filter file, using only the
1532  # specified sections:
1533  +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}\
1534  +filter{webbugs} +filter{nimda} +filter{banners-by-size}
1535               
1536  # Then disable filtering of code from sourceforge!
1537  {-filter}
1538  .cvs.sourceforge.net
1539    
1540
1541 Now some URLs that we want "blocked" (normally generates the "blocked" banner).
1542 Many of these use regular expressions that will expand to match multiple URLs:
1543
1544   # Blocklist:
1545   {+block}
1546   /.*/(.*[-_.])?ads?[0-9]?(/|[-_.].*|\.(gif|jpe?g))
1547   /.*/(.*[-_.])?count(er)?(\.cgi|\.dll|\.exe|[?/])
1548   /.*/(ng)?adclient\.cgi
1549   /.*/(plain|live|rotate)[-_.]?ads?/
1550   /.*/(sponsor)s?[0-9]?/
1551   /.*/_?(plain|live)?ads?(-banners)?/
1552   /.*/abanners/
1553   /.*/ad(sdna_image|gifs?)/
1554   /.*/ad(server|stream|juggler)\.(cgi|pl|dll|exe)
1555   /.*/adbanners/
1556   /.*/adserver
1557   /.*/adstream\.cgi
1558   /.*/adv((er)?ts?|ertis(ing|ements?))?/
1559   /.*/banner_?ads/
1560   /.*/banners?/
1561   /.*/banners?\.cgi/
1562   /.*/cgi-bin/centralad/getimage
1563   /.*/images/addver\.gif
1564   /.*/images/marketing/.*\.(gif|jpe?g)
1565   /.*/popupads/
1566   /.*/siteads/
1567   /.*/sponsor.*\.gif
1568   /.*/sponsors?[0-9]?/
1569   /.*/advert[0-9]+\.jpg
1570   /Media/Images/Adds/
1571   /ad_images/
1572   /adimages/
1573   /.*/ads/
1574   /bannerfarm/
1575   /grafikk/annonse/
1576   /graphics/defaultAd/
1577   /image\.ng/AdType
1578   /image\.ng/transactionID
1579   /images/.*/.*_anim\.gif # alvin brattli
1580   /ip_img/.*\.(gif|jpe?g)
1581   /rotateads/
1582   /rotations/ 
1583   /worldnet/ad\.cgi
1584   /cgi-bin/nph-adclick.exe/
1585   /.*/Image/BannerAdvertising/
1586   /.*/ad-bin/
1587   /.*/adlib/server\.cgi
1588   /autoads/
1589    
1590
1591 Note that many of these actions have the potential to cause a page to
1592 misbehave, possibly even not to display at all. There are many ways a site
1593 designer may choose to design his site, and what HTTP header content he may
1594 depend on. There is no way to have hard and fast rules for all sites. See the 
1595 Appendix for a brief example on troubleshooting actions.
1596 -------------------------------------------------------------------------------
1597
1598 5.4.3. Aliases
1599
1600 Custom "actions", known to Privoxy as "aliases", can be defined by combining
1601 other "actions". These can in turn be invoked just like the built-in "actions".
1602 Currently, an alias can contain any character except space, tab, "=", "{" or "}
1603 ". But please use only "a"- "z", "0"-"9", "+", and "-". Alias names are not
1604 case sensitive, and must be defined before anything else in the
1605 default.actionfile! And there can only be one set of "aliases" defined.
1606
1607 Now let's define a few aliases:
1608
1609  # Useful custom aliases we can use later. These must come first!
1610  {{alias}}
1611  +no-cookies = +no-cookies-set +no-cookies-read
1612  -no-cookies = -no-cookies-set -no-cookies-read
1613  fragile     =
1614  -block -no-cookies -filter -fast-redirects -hide-referer -no-popups
1615  shop        = -no-cookies -filter -fast-redirects
1616  +imageblock = +block +image
1617
1618  #For people who don't like to type too much:  ;-)
1619  c0 = +no-cookies
1620  c1 = -no-cookies
1621  c2 = -no-cookies-set +no-cookies-read
1622  c3 = +no-cookies-set -no-cookies-read
1623  #... etc.  Customize to your heart's content.
1624    
1625
1626 Some examples using our "shop" and "fragile" aliases from above:
1627
1628  # These sites are very complex and require
1629  # minimal interference.
1630  {fragile}
1631  .office.microsoft.com
1632  .windowsupdate.microsoft.com
1633  .nytimes.com
1634
1635  # Shopping sites - still want to block ads.
1636  {shop}
1637  .quietpc.com
1638  .worldpay.com   # for quietpc.com
1639  .jungle.com
1640  .scan.co.uk
1641
1642  # These shops require pop-ups
1643  {shop -no-popups}
1644  .dabs.com
1645  .overclockers.co.uk
1646    
1647
1648 The "shop" and "fragile" aliases are often used for "problem" sites that
1649 require most actions to be disabled in order to function properly. 
1650 -------------------------------------------------------------------------------
1651
1652 5.5. The Filter File
1653
1654 Any web page can be dynamically modified with the filter file. This
1655 modification can be removal, or re-writing, of any web page content, including
1656 tags and non-visible content. The default filter file is default.filter,
1657 located in the config directory.
1658
1659 This is potentially a very powerful feature, and requires knowledge of both 
1660 "regular expression" and HTML in order create custom filters. But, there are a
1661 number of useful filters included with Privoxy for many common situations.
1662
1663 The included example file is divided into sections. Each section begins with
1664 the FILTER keyword, followed by the identifier for that section, e.g. "FILTER:
1665 webbugs". Each section performs a similar type of filtering, such as 
1666 "html-annoyances".
1667
1668 This file uses regular expressions to alter or remove any string in the target
1669 page. The expressions can only operate on one line at a time. Some examples
1670 from the included default default.filter:
1671
1672 Stop web pages from displaying annoying messages in the status bar by deleting
1673 such references:
1674
1675  FILTER: html-annoyances
1676
1677  # New browser windows should be resizeable and have a location and status
1678  # bar. Make it so.
1679  #
1680  s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig
1681  s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig
1682  s/scrolling="?(no|0|Auto)"?/scrolling=1/ig
1683  s/menubar="?(no|0)"?/menubar=1/ig 
1684
1685  # The <BLINK> tag was a crime!
1686  #
1687  s*<blink>|</blink>**ig
1688
1689  # Is this evil? 
1690  #
1691  #s/framespacing="?(no|0)"?//ig
1692  #s/margin(height|width)=[0-9]*//gi
1693    
1694
1695 Just for kicks, replace any occurrence of "Microsoft" with "MicroSuck", and
1696 have a little fun with topical buzzwords:
1697
1698  FILTER: fun
1699
1700  s/microsoft(?!.com)/MicroSuck/ig
1701
1702  # Buzzword Bingo:
1703  #
1704  s/industry-leading|cutting-edge|award-winning/<font color=red><b>BINGO!</b></
1705 font>/ig
1706    
1707
1708 Kill those pesky little web-bugs:
1709
1710  # webbugs: Squish WebBugs (1x1 invisible GIFs used for user tracking)
1711  FILTER: webbugs
1712
1713  s/<img\s+[^>]*?(width|height)\s*=\s*['"]?1\D[^>]*?(width|height)\s*=\s*['"]?1
1714 (\D[^>]*?)?>/<!-- Squished WebBug -->/sig
1715    
1716 -------------------------------------------------------------------------------
1717
1718 5.6. Templates
1719
1720 When Privoxy displays one of its internal pages, such as a 404 Not Found error
1721 page, it uses the appropriate template. On Linux, BSD, and Unix, these are
1722 located in /etc/privoxy/templates by default. These may be customized, if
1723 desired.
1724
1725 The default "Blocked" banner page with the bright red top banner, is called
1726 just "blocked". This may be customized or replaced with something else if
1727 desired. 
1728 -------------------------------------------------------------------------------
1729
1730 6. Contacting the Developers, Bug Reporting and Feature Requests
1731
1732 We value your feedback. However, to provide you with the best support, please
1733 note:
1734
1735   *  Use the Sourceforge Support Forum to get help:
1736        
1737      http://sourceforge.net/tracker/?group_id=11118&atid=211118
1738        
1739    
1740   *  Submit bugs only through our Sourceforge Bug Forum:
1741      
1742      http://sourceforge.net/tracker/?group_id=11118&atid=111118. 
1743         
1744    
1745     Make sure that the bug has not already been submitted. Please try to verify
1746     that it is a Privoxy bug, and not a browser or site bug first. If you are
1747     using your own custom configuration, please try the stock configs to see if
1748     the problem is a configuration related bug. And if not using the latest
1749     development snapshot, please try the latest one. Or even better, CVS
1750     sources. Please be sure to include the Privoxy/Junkbuster version,
1751     platform, browser, any pertinent log data, any other relevant details
1752     (please be specific) and, if possible, some way to reproduce the bug.
1753    
1754   *  Submit feature requests only through our Sourceforge feature request 
1755      forum:
1756      
1757      http://sourceforge.net/tracker/?atid=361118&group_id=11118&func=browse.
1758        
1759    
1760   * We will soon have an automated way to submit advertisements, incorrectly
1761     blocked images, popups and the like. Check back.
1762        
1763    
1764   *  For any other issues, feel free to use the mailing lists:
1765      
1766      http://sourceforge.net/mail/?group_id=11118.
1767      
1768    
1769     Anyone interested in actively participating in development and related
1770     discussions can also join the appropriate mailing list. Archives are
1771     available too.
1772    
1773
1774 -------------------------------------------------------------------------------
1775 7. Copyright and History
1776
1777 7.1. Copyright
1778
1779 Privoxy is free software; you can redistribute it and/or modify it under the
1780 terms of the GNU General Public License as published by the Free Software
1781 Foundation; either version 2 of the License, or (at your option) any later
1782 version.
1783
1784 This program is distributed in the hope that it will be useful, but WITHOUT ANY
1785 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
1786 PARTICULAR PURPOSE. See the GNU General Public License for more details, which
1787 is available from the Free Software Foundation, Inc, 59 Temple Place - Suite
1788 330, Boston, MA 02111-1307, USA.
1789
1790 You should have received a copy of the GNU General Public License along with
1791 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
1792 Place, Suite 330, Boston, MA 02111-1307 USA.
1793 -------------------------------------------------------------------------------
1794
1795 7.2. History
1796
1797 Privoxy is evolved, and derived from, the Internet Junkbuster, with many
1798 improvments and enhancements over the original.
1799
1800 Junkbuster was originally written by Anonymous Coders and Junkbuster's
1801 Corporation, and was released as free open-source software under the GNU GPL. 
1802 Stefan Waldherr made many improvements, and started the SourceForge project
1803 Privoxy to rekindle development. There are now several active developers
1804 contributing. The last stable release of Junkbuster was v2.0.2, which has now
1805 grown whiskers ;-).
1806 -------------------------------------------------------------------------------
1807
1808 8. See Also
1809
1810 Other references and sites of interest to Privoxy users:
1811
1812 http://www.privoxy.org/, The Privoxy Home page.
1813
1814 http://sourceforge.net/projects/ijbswa, the Project Page for Privoxy on        
1815 Sourceforge.                                                                   
1816
1817 http://p.p/, access Privoxy from your browser. Alternately, http://            
1818 config.privoxy.org may work in some situations where the first does not.       
1819
1820 http://www.junkbusters.com/ht/en/cookies.html
1821
1822 http://www.waldherr.org/junkbuster/
1823
1824 http://privacy.net/analyze/
1825
1826 http://www.squid-cache.org/
1827
1828  
1829 -------------------------------------------------------------------------------
1830
1831 9. Appendix
1832
1833 9.1. Regular Expressions
1834
1835 Privoxy can use "regular expressions" in various config files. Assuming support
1836 for "pcre" (Perl Compatible Regular Expressions) is compiled in, which is the
1837 default. Such configuration directives do not require regular expressions, but
1838 they can be used to increase flexibility by matching a pattern with wild-cards
1839 against URLs.
1840
1841 If you are reading this, you probably don't understand what "regular
1842 expressions" are, or what they can do. So this will be a very brief
1843 introduction only. A full explanation would require a book ;-)
1844
1845 "Regular expressions" is a way of matching one character expression against
1846 another to see if it matches or not. One of the "expressions" is a literal
1847 string of readable characters (letter, numbers, etc), and the other is a
1848 complex string of literal characters combined with wild-cards, and other
1849 special characters, called meta-characters. The "meta-characters" have special
1850 meanings and are used to build the complex pattern to be matched against. Perl
1851 Compatible Regular Expressions is an enhanced form of the regular expression
1852 language with backward compatibility.
1853
1854 To make a simple analogy, we do something similar when we use wild-card
1855 characters when listing files with the dir command in DOS. *.* matches all
1856 filenames. The "special" character here is the asterisk which matches any and
1857 all characters. We can be more specific and use ? to match just individual
1858 characters. So "dir file?.text" would match "file1.txt", "file2.txt", etc. We
1859 are pattern matching, using a similar technique to "regular expressions"!
1860
1861 Regular expressions do essentially the same thing, but are much, much more
1862 powerful. There are many more "special characters" and ways of building complex
1863 patterns however. Let's look at a few of the common ones, and then some
1864 examples:
1865
1866 . - Matches any single character, e.g. "a", "A", "4", ":", or "@".
1867
1868 ? - The preceding character or expression is matched ZERO or ONE times. Either/
1869 or.                                                                            
1870
1871 + - The preceding character or expression is matched ONE or MORE times.
1872
1873 * - The preceding character or expression is matched ZERO or MORE times.
1874
1875 \ - The "escape" character denotes that the following character should be taken
1876 literally. This is used where one of the special characters (e.g. ".") needs to
1877 be taken literally and not as a special meta-character.                        
1878
1879 [] - Characters enclosed in brackets will be matched if any of the enclosed    
1880 characters are encountered.                                                    
1881
1882 () - parentheses are used to group a sub-expression, or multiple               
1883 sub-expressions.                                                               
1884
1885 | - The "bar" character works like an "or" conditional statement. A match is   
1886 successful if the sub-expression on either side of "|" matches.                
1887
1888 s/string1/string2/g - This is used to rewrite strings of text. "string1" is    
1889 replaced by "string2" in this example.                                         
1890
1891 These are just some of the ones you are likely to use when matching URLs with 
1892 Privoxy, and is a long way from a definitive list. This is enough to get us
1893 started with a few simple examples which may be more illuminating:
1894
1895 /.*/banners/.* - A simple example that uses the common combination of "." and "
1896 *" to denote any character, zero or more times. In other words, any string at
1897 all. So we start with a literal forward slash, then our regular expression
1898 pattern (".*") another literal forward slash, the string "banners", another
1899 forward slash, and lastly another ".*". We are building a directory path here.
1900 This will match any file with the path that has a directory named "banners" in
1901 it. The ".*" matches any characters, and this could conceivably be more forward
1902 slashes, so it might expand into a much longer looking path. For example, this
1903 could match: "/eye/hate/spammers/banners/annoy_me_please.gif", or just "/
1904 banners/annoying.html", or almost an infinite number of other possible
1905 combinations, just so it has "banners" in the path somewhere.
1906
1907 A now something a little more complex:
1908
1909 /.*/adv((er)?ts?|ertis(ing|ements?))?/ - We have several literal forward
1910 slashes again ("/"), so we are building another expression that is a file path
1911 statement. We have another ".*", so we are matching against any conceivable
1912 sub-path, just so it matches our expression. The only true literal that must
1913 match our pattern is adv, together with the forward slashes. What comes after
1914 the "adv" string is the interesting part.
1915
1916 Remember the "?" means the preceding expression (either a literal character or
1917 anything grouped with "(...)" in this case) can exist or not, since this means
1918 either zero or one match. So "((er)?ts?|ertis(ing|ements?))" is optional, as
1919 are the individual sub-expressions: "(er)", "(ing|ements?)", and the "s". The "
1920 |" means "or". We have two of those. For instance, "(ing|ements?)", can expand
1921 to match either "ing" OR "ements?". What is being done here, is an attempt at
1922 matching as many variations of "advertisement", and similar, as possible. So
1923 this would expand to match just "adv", or "advert", or "adverts", or 
1924 "advertising", or "advertisement", or "advertisements". You get the idea. But
1925 it would not match "advertizements" (with a "z"). We could fix that by changing
1926 our regular expression to: "/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/", which
1927 would then match either spelling.
1928
1929 /.*/advert[0-9]+\.(gif|jpe?g) - Again another path statement with forward
1930 slashes. Anything in the square brackets "[]" can be matched. This is using 
1931 "0-9" as a shorthand expression to mean any digit one through nine. It is the
1932 same as saying "0123456789". So any digit matches. The "+" means one or more of
1933 the preceding expression must be included. The preceding expression here is
1934 what is in the square brackets -- in this case, any digit one through nine.
1935 Then, at the end, we have a grouping: "(gif|jpe?g)". This includes a "|", so
1936 this needs to match the expression on either side of that bar character also. A
1937 simple "gif" on one side, and the other side will in turn match either "jpeg"
1938 or "jpg", since the "?" means the letter "e" is optional and can be matched
1939 once or not at all. So we are building an expression here to match image GIF or
1940 JPEG type image file. It must include the literal string "advert", then one or
1941 more digits, and a "." (which is now a literal, and not a special character,
1942 since it is escaped with "\"), and lastly either "gif", or "jpeg", or "jpg".
1943 Some possible matches would include: "//advert1.jpg", "/nasty/ads/
1944 advert1234.gif", "/banners/from/hell/advert99.jpg". It would not match 
1945 "advert1.gif" (no leading slash), or "/adverts232.jpg" (the expression does not
1946 include an "s"), or "/advert1.jsp" ("jsp" is not in the expression anywhere).
1947
1948 s/microsoft(?!.com)/MicroSuck/i - This is a substitution. "MicroSuck" will
1949 replace any occurrence of "microsoft". The "i" at the end of the expression
1950 means ignore case. The "(?!.com)" means the match should fail if "microsoft" is
1951 followed by ".com". In other words, this acts like a "NOT" modifier. In case
1952 this is a hyperlink, we don't want to break it ;-).
1953
1954 We are barely scratching the surface of regular expressions here so that you
1955 can understand the default Privoxy configuration files, and maybe use this
1956 knowledge to customize your own installation. There is much, much more that can
1957 be done with regular expressions. Now that you know enough to get started, you
1958 can learn more on your own :/
1959
1960 More reading on Perl Compatible Regular expressions: http://www.perldoc.com/
1961 perl5.6/pod/perlre.html
1962 -------------------------------------------------------------------------------
1963
1964 9.2. Privoxy's Internal Pages
1965
1966 Since Privoxy proxies each requested web page, it is easy for Privoxy to trap
1967 certain special URLs. In this way, we can talk directly to Privoxy, and see how
1968 it is configured, see how our rules are being applied, change these rules and
1969 other configuration options, and even turn Privoxy's filtering off, all with a
1970 web browser. 
1971
1972 The URLs listed below are the special ones that allow direct access to Privoxy.
1973 Of course, Privoxy must be running to access these. If not, you will get a
1974 friendly error message. Internet access is not necessary either.
1975
1976   * Privoxy main page:
1977    
1978        
1979         http://config.privoxy.org/
1980        
1981    
1982     Alternately, this may be reached at http://p.p/, but this variation may not
1983     work as reliably as the above in some configurations.
1984    
1985   * Show information about the current configuration:
1986    
1987        
1988         http://config.privoxy.org/show-status
1989        
1990    
1991   * Show the source code version numbers:
1992    
1993        
1994         http://config.privoxy.org/show-version
1995        
1996    
1997   * Show the client's request headers:
1998    
1999        
2000         http://config.privoxy.org/show-request
2001        
2002    
2003   * Show which actions apply to a URL and why:
2004    
2005        
2006         http://config.privoxy.org/show-url-info
2007        
2008    
2009   * Toggle Privoxy on or off. In this case, "Privoxy" continues to run, but
2010     only as a pass-through proxy, with no actions taking place:
2011    
2012        
2013         http://config.privoxy.org/toggle
2014        
2015    
2016     Short cuts. Turn off, then on:
2017    
2018        
2019         http://config.privoxy.org/toggle?set=disable
2020        
2021    
2022        
2023         http://config.privoxy.org/toggle?set=enable
2024        
2025    
2026   * Edit the actions list file:
2027    
2028        
2029         http://config.privoxy.org/edit-actions
2030        
2031    
2032
2033 These may be bookmarked for quick reference. 
2034 -------------------------------------------------------------------------------
2035
2036 9.2.1. Bookmarklets
2037
2038 Here are some bookmarklets to allow you to easily access a "mini" version of
2039 this page. They are designed for MS Internet Explorer, but should work equally
2040 well in Netscape, Mozilla, and other browsers which support JavaScript. They
2041 are designed to run directly from your bookmarks - not by clicking the links
2042 below (although that will work for testing).
2043
2044 To save them, right-click the link and choose "Add to Favorites" (IE) or "Add
2045 Bookmark" (Netscape). You will get a warning that the bookmark "may not be
2046 safe" - just click OK. Then you can run the Bookmarklet directly from your
2047 favourites/bookmarks. For even faster access, you can put them on the "Links"
2048 bar (IE) or the "Personal Toolbar" (Netscape), and run them with a single
2049 click.
2050
2051   * Enable Privoxy
2052    
2053   * Disable Privoxy
2054    
2055   * Toggle Privoxy (Toggles between enabled and disabled)
2056    
2057   * View Privoxy Status
2058    
2059
2060 Credit: The site which gave me the general idea for these bookmarklets is 
2061 www.bookmarklets.com. They have more information about bookmarklets.
2062 -------------------------------------------------------------------------------
2063
2064 9.3. Anatomy of an Action
2065
2066 The way Privoxy applies "actions" and "filters" to any given URL can be
2067 complex, and not always so easy to understand what is happening. And sometimes
2068 we need to be able to see just what Privoxy is doing. Especially, if something 
2069 Privoxy is doing is causing us a problem inadvertantly. It can be a little
2070 daunting to look at the actions and filters files themselves, since they tend
2071 to be filled with "regular expressions" whose consequences are not always so
2072 obvious. Privoxy provides the http://config.privoxy.org/show-url-info page that
2073 can show us very specifically how actions are being applied to any given URL.
2074 This is a big help for troubleshooting.
2075
2076 First, enter one URL (or partial URL) at the prompt, and then Privoxy will tell
2077 us how the current configuration will handle it. This will not help with
2078 filtering effects from the default.filter file! It also will not tell you about
2079 any other URLs that may be embedded within the URL you are testing. For
2080 instance, images such as ads are expressed as URLs within the raw page source
2081 of HTML pages. So you will only get info for the actual URL that is pasted into
2082 the prompt area -- not any sub-URLs. If you want to know about embedded URLs
2083 like ads, you will have to dig those out of the HTML source. Use your browser's
2084 "View Page Source" option for this. Or right click on the ad, and grab the URL.
2085
2086 Let's look at an example, google.com, one section at a time:
2087
2088  System default actions:                                                       
2089                                                                                
2090  { -add-header -block -deanimate-gifs -downgrade -fast-redirects -filter       
2091    -hide-forwarded -hide-from -hide-referer -hide-user-agent -image            
2092    -image-blocker -limit-connect -no-compression -no-cookies-keep              
2093    -no-cookies-read -no-cookies-set -no-popups -vanilla-wafer -wafer }         
2094                                                                                
2095                                                                                
2096
2097 This is the top section, and only tells us of the compiled in defaults. This is
2098 basically what Privoxy would do if there were not any "actions" defined, i.e.
2099 it does nothing. Every action is disabled. This is not particularly informative
2100 for our purposes here. OK, next section:
2101
2102  Matches for http://google.com:                                                
2103                                                                                
2104  { -add-header -block +deanimate-gifs -downgrade +fast-redirects               
2105    +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}          
2106    +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}       
2107    +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge}         
2108    -hide-user-agent -image +image-blocker{blank} +no-compression               
2109    +no-cookies-keep -no-cookies-read -no-cookies-set +no-popups                
2110    -vanilla-wafer -wafer }                                                     
2111    /                                                                           
2112                                                                                
2113  { -no-cookies-keep -no-cookies-read -no-cookies-set }                         
2114   .google.com                                                                  
2115                                                                                
2116  { -fast-redirects }                                                           
2117   .google.com                                                                  
2118                                                                                
2119                                                                                
2120
2121 This is much more informative, and tells us how we have defined our "actions",
2122 and which ones match for our example, "google.com". The first grouping shows
2123 our default settings, which would apply to all URLs. If you look at your 
2124 "actions" file, this would be the section just below the "aliases" section near
2125 the top. This applies to all URLs as signified by the single forward slash -- "
2126 /".
2127
2128 These are the default actions we have enabled. But we can define additional
2129 actions that would be exceptions to these general rules, and then list specific
2130 URLs that these exceptions would apply to. Last match wins. Just below this
2131 then are two explict matches for ".google.com". The first is negating our
2132 various cookie blocking actions (i.e. we will allow cookies here). The second
2133 is allowing "fast-redirects". Note that there is a leading dot here -- 
2134 ".google.com". This will match any hosts and sub-domains, in the google.com
2135 domain also, such as "www.google.com". So, apparently, we have these actions
2136 defined somewhere in the lower part of our actions file, and "google.com" is
2137 referenced in these sections. 
2138
2139 And now we pull it altogether in the bottom section and summarize how Privoxy
2140 is appying all its "actions" to "google.com": 
2141
2142  Final results:                                                                
2143                                                                                
2144  -add-header -block -deanimate-gifs -downgrade -fast-redirects                 
2145  +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}            
2146  +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}         
2147  +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge}           
2148  -hide-user-agent -image +image-blocker{blank} -limit-connect +no-compression  
2149  -no-cookies-keep -no-cookies-read -no-cookies-set +no-popups -vanilla-wafer   
2150  -wafer                                                                        
2151                                                                                
2152                                                                                
2153
2154 Now another example, "ad.doubleclick.net":
2155
2156  { +block +image }                                                             
2157   .ad.doubleclick.net                                                          
2158                                                                                
2159  { +block +image }                                                             
2160   ad*.                                                                         
2161                                                                                
2162  { +block +image }                                                             
2163   .doubleclick.net                                                             
2164                                                                                
2165                                                                                
2166
2167 We'll just show the interesting part here, the explicit matches. It is matched
2168 three different times. Each as an "+block +image", which is the expanded form
2169 of one of our aliases that had been defined as: "+imageblock". ("Aliases" are
2170 defined in the first section of the actions file and typically used to combine
2171 more than one action.)
2172
2173 Any one of these would have done the trick and blocked this as an unwanted
2174 image. This is unnecessarily redundant since the last case effectively would
2175 also cover the first. No point in taking chances with these guys though ;-)
2176 Note that if you want an ad or obnoxious URL to be invisible, it should be
2177 defined as "ad.doubleclick.net" is done here -- as both a "+block" and an 
2178 "+image". The custom alias "+imageblock" does this for us.
2179
2180 One last example. Let's try "http://www.rhapsodyk.net/adsl/HOWTO/". This one is
2181 giving us problems. We are getting a blank page. Hmmm...
2182
2183  Matches for http://www.rhapsodyk.net/adsl/HOWTO/:                             
2184                                                                                
2185  { -add-header -block +deanimate-gifs -downgrade +fast-redirects               
2186    +filter{html-annoyances} +filter{js-annoyances} +filter{no-popups}          
2187    +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal}       
2188    +filter{fun} +hide-forwarded +hide-from{block} +hide-referer{forge}         
2189    -hide-user-agent -image +image-blocker{blank} +no-compression               
2190    +no-cookies-keep -no-cookies-read -no-cookies-set +no-popups                
2191    -vanilla-wafer -wafer }                                                     
2192    /                                                                           
2193                                                                                
2194  { +block +image }                                                             
2195   /ads                                                                         
2196                                                                                
2197                                                                                
2198
2199 Ooops, the "/adsl/" is matching "/ads"! But we did not want this at all! Now we
2200 see why we get the blank page. We could now add a new action below this that
2201 explictly does not block (-block) pages with "adsl". There are various ways to
2202 handle such exceptions. Example:
2203
2204  { -block }                                                                    
2205   /adsl                                                                        
2206                                                                                
2207                                                                                
2208
2209 Now the page displays ;-) Be sure to flush your browser's caches when making
2210 such changes. Or, try using Shift+Reload.
2211
2212 But now what about a situation where we get no explicit matches like we did
2213 with:
2214
2215  { -block }                                                                    
2216   /adsl                                                                        
2217                                                                                
2218                                                                                
2219
2220 That actually was very telling and pointed us quickly to where the problem was.
2221 If you don't get this kind of match, then it means one of the default rules in
2222 the first section is causing the problem. This would require some guesswork,
2223 and maybe a little trial and error to isolate the offending rule. One likely
2224 cause would be one of the "{+filter}" actions. Try adding the URL for the site
2225 to one of aliases that turn off "+filter":
2226
2227  {shop}                                                                        
2228  .quietpc.com                                                                  
2229  .worldpay.com   # for quietpc.com                                             
2230  .jungle.com                                                                   
2231  .scan.co.uk                                                                   
2232  .forbes.com                                                                   
2233                                                                                
2234                                                                                
2235
2236 "{shop}" is an "alias" that expands to "{ -filter -no-cookies -no-cookies-keep
2237 }". Or you could do your own exception to negate filtering: 
2238
2239  {-filter}                                                                     
2240  .forbes.com                                                                   
2241                                                                                
2242                                                                                
2243
2244 "{fragile}" is an alias that disables most actions. This can be used as a last
2245 resort for problem sites. Remember to flush caches! If this still does not
2246 work, you will have to go through the remaining actions one by one to find
2247 which one(s) is causing the problem.