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