Documentation for 3.0.19, regenerated with the modified tidy changes
[privoxy.git] / doc / webserver / user-manual / actions-file.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
3
4 <html>
5 <head>
6   <title>Actions Files</title>
7   <meta name="GENERATOR" content=
8   "Modular DocBook HTML Stylesheet Version 1.79">
9   <link rel="HOME" title="Privoxy 3.0.19 User Manual" href="index.html">
10   <link rel="PREVIOUS" title="The Main Configuration File" href=
11   "config.html">
12   <link rel="NEXT" title="Filter Files" href="filter-file.html">
13   <link rel="STYLESHEET" type="text/css" href="../p_doc.css">
14   <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
15   <link rel="STYLESHEET" type="text/css" href="p_doc.css">
16 </head>
17
18 <body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink=
19 "#840084" alink="#0000FF">
20   <div class="NAVHEADER">
21     <table summary="Header navigation table" width="100%" border="0"
22     cellpadding="0" cellspacing="0">
23       <tr>
24         <th colspan="3" align="center">Privoxy 3.0.19 User Manual</th>
25       </tr>
26
27       <tr>
28         <td width="10%" align="left" valign="bottom"><a href="config.html"
29         accesskey="P">Prev</a></td>
30
31         <td width="80%" align="center" valign="bottom"></td>
32
33         <td width="10%" align="right" valign="bottom"><a href=
34         "filter-file.html" accesskey="N">Next</a></td>
35       </tr>
36     </table>
37     <hr align="left" width="100%">
38   </div>
39
40   <div class="SECT1">
41     <h1 class="SECT1"><a name="ACTIONS-FILE" id="ACTIONS-FILE">8. Actions
42     Files</a></h1>
43
44     <p>The actions files are used to define what <span class=
45     "emphasis"><i class="EMPHASIS">actions</i></span> <span class=
46     "APPLICATION">Privoxy</span> takes for which URLs, and thus determines
47     how ad images, cookies and various other aspects of HTTP content and
48     transactions are handled, and on which sites (or even parts thereof).
49     There are a number of such actions, with a wide range of functionality.
50     Each action does something a little different. These actions give us a
51     veritable arsenal of tools with which to exert our control, preferences
52     and independence. Actions can be combined so that their effects are
53     aggregated when applied against a given set of URLs.</p>
54
55     <p>There are three action files included with <span class=
56     "APPLICATION">Privoxy</span> with differing purposes:</p>
57
58     <ul>
59       <li>
60         <p><tt class="FILENAME">match-all.action</tt> - is used to define
61         which <span class="QUOTE">"actions"</span> relating to
62         banner-blocking, images, pop-ups, content modification, cookie
63         handling etc should be applied by default. It should be the first
64         actions file loaded</p>
65       </li>
66
67       <li>
68         <p><tt class="FILENAME">default.action</tt> - defines many exceptions
69         (both positive and negative) from the default set of actions that's
70         configured in <tt class="FILENAME">match-all.action</tt>. It is a set
71         of rules that should work reasonably well as-is for most users. This
72         file is only supposed to be edited by the developers. It should be
73         the second actions file loaded.</p>
74       </li>
75
76       <li>
77         <p><tt class="FILENAME">user.action</tt> - is intended to be for
78         local site preferences and exceptions. As an example, if your ISP or
79         your bank has specific requirements, and need special handling, this
80         kind of thing should go here. This file will not be upgraded.</p>
81       </li>
82
83       <li>
84         <p><span class="GUIBUTTON">Edit</span> <span class="GUIBUTTON">Set to
85         Cautious</span> <span class="GUIBUTTON">Set to Medium</span>
86         <span class="GUIBUTTON">Set to Advanced</span></p>
87
88         <p>These have increasing levels of aggressiveness <span class=
89         "emphasis"><i class="EMPHASIS">and have no influence on your browsing
90         unless you select them explicitly in the editor</i></span>. A default
91         installation should be pre-set to <tt class="LITERAL">Cautious</tt>.
92         New users should try this for a while before adjusting the settings
93         to more aggressive levels. The more aggressive the settings, then the
94         more likelihood there is of problems such as sites not working as
95         they should.</p>
96
97         <p>The <span class="GUIBUTTON">Edit</span> button allows you to turn
98         each action on/off individually for fine-tuning. The <span class=
99         "GUIBUTTON">Cautious</span> button changes the actions list to
100         low/safe settings which will activate ad blocking and a minimal set
101         of <span class="APPLICATION">Privoxy</span>'s features, and
102         subsequently there will be less of a chance for accidental problems.
103         The <span class="GUIBUTTON">Medium</span> button sets the list to a
104         medium level of other features and a low level set of privacy
105         features. The <span class="GUIBUTTON">Advanced</span> button sets the
106         list to a high level of ad blocking and medium level of privacy. See
107         the chart below. The latter three buttons over-ride any changes via
108         with the <span class="GUIBUTTON">Edit</span> button. More fine-tuning
109         can be done in the lower sections of this internal page.</p>
110
111         <p>While the actions file editor allows to enable these settings in
112         all actions files, they are only supposed to be enabled in the first
113         one to make sure you don't unintentionally overrule earlier
114         rules.</p>
115
116         <p>The default profiles, and their associated actions, as pre-defined
117         in <tt class="FILENAME">default.action</tt> are:</p>
118
119         <div class="TABLE">
120           <a name="AEN2780" id="AEN2780"></a>
121
122           <p><b>Table 1. Default Configurations</b></p>
123
124           <table border="1" frame="border" rules="all" class="CALSTABLE">
125             <col width="1*" title="C1">
126             <col width="1*" title="C2">
127             <col width="1*" title="C3">
128             <col width="1*" title="C4">
129
130             <thead>
131               <tr>
132                 <th>Feature</th>
133
134                 <th>Cautious</th>
135
136                 <th>Medium</th>
137
138                 <th>Advanced</th>
139               </tr>
140             </thead>
141
142             <tbody>
143               <tr>
144                 <td>Ad-blocking Aggressiveness</td>
145
146                 <td>medium</td>
147
148                 <td>high</td>
149
150                 <td>high</td>
151               </tr>
152
153               <tr>
154                 <td>Ad-filtering by size</td>
155
156                 <td>no</td>
157
158                 <td>yes</td>
159
160                 <td>yes</td>
161               </tr>
162
163               <tr>
164                 <td>Ad-filtering by link</td>
165
166                 <td>no</td>
167
168                 <td>no</td>
169
170                 <td>yes</td>
171               </tr>
172
173               <tr>
174                 <td>Pop-up killing</td>
175
176                 <td>blocks only</td>
177
178                 <td>blocks only</td>
179
180                 <td>blocks only</td>
181               </tr>
182
183               <tr>
184                 <td>Privacy Features</td>
185
186                 <td>low</td>
187
188                 <td>medium</td>
189
190                 <td>medium/high</td>
191               </tr>
192
193               <tr>
194                 <td>Cookie handling</td>
195
196                 <td>none</td>
197
198                 <td>session-only</td>
199
200                 <td>kill</td>
201               </tr>
202
203               <tr>
204                 <td>Referer forging</td>
205
206                 <td>no</td>
207
208                 <td>yes</td>
209
210                 <td>yes</td>
211               </tr>
212
213               <tr>
214                 <td>GIF de-animation</td>
215
216                 <td>no</td>
217
218                 <td>yes</td>
219
220                 <td>yes</td>
221               </tr>
222
223               <tr>
224                 <td>Fast redirects</td>
225
226                 <td>no</td>
227
228                 <td>no</td>
229
230                 <td>yes</td>
231               </tr>
232
233               <tr>
234                 <td>HTML taming</td>
235
236                 <td>no</td>
237
238                 <td>no</td>
239
240                 <td>yes</td>
241               </tr>
242
243               <tr>
244                 <td>JavaScript taming</td>
245
246                 <td>no</td>
247
248                 <td>no</td>
249
250                 <td>yes</td>
251               </tr>
252
253               <tr>
254                 <td>Web-bug killing</td>
255
256                 <td>no</td>
257
258                 <td>yes</td>
259
260                 <td>yes</td>
261               </tr>
262
263               <tr>
264                 <td>Image tag reordering</td>
265
266                 <td>no</td>
267
268                 <td>yes</td>
269
270                 <td>yes</td>
271               </tr>
272             </tbody>
273           </table>
274         </div>
275       </li>
276     </ul>
277
278     <p>The list of actions files to be used are defined in the main
279     configuration file, and are processed in the order they are defined (e.g.
280     <tt class="FILENAME">default.action</tt> is typically processed before
281     <tt class="FILENAME">user.action</tt>). The content of these can all be
282     viewed and edited from <a href="http://config.privoxy.org/show-status"
283     target="_top">http://config.privoxy.org/show-status</a>. The over-riding
284     principle when applying actions, is that the last action that matches a
285     given URL wins. The broadest, most general rules go first (defined in
286     <tt class="FILENAME">default.action</tt>), followed by any exceptions
287     (typically also in <tt class="FILENAME">default.action</tt>), which are
288     then followed lastly by any local preferences (typically in <span class=
289     "emphasis"><i class="EMPHASIS">user</i></span><tt class=
290     "FILENAME">.action</tt>). Generally, <tt class=
291     "FILENAME">user.action</tt> has the last word.</p>
292
293     <p>An actions file typically has multiple sections. If you want to use
294     <span class="QUOTE">"aliases"</span> in an actions file, you have to
295     place the (optional) <a href="actions-file.html#ALIASES">alias
296     section</a> at the top of that file. Then comes the default set of rules
297     which will apply universally to all sites and pages (be <span class=
298     "emphasis"><i class="EMPHASIS">very careful</i></span> with using such a
299     universal set in <tt class="FILENAME">user.action</tt> or any other
300     actions file after <tt class="FILENAME">default.action</tt>, because it
301     will override the result from consulting any previous file). And then
302     below that, exceptions to the defined universal policies. You can regard
303     <tt class="FILENAME">user.action</tt> as an appendix to <tt class=
304     "FILENAME">default.action</tt>, with the advantage that it is a separate
305     file, which makes preserving your personal settings across <span class=
306     "APPLICATION">Privoxy</span> upgrades easier.</p>
307
308     <p>Actions can be used to block anything you want, including ads,
309     banners, or just some obnoxious URL whose content you would rather not
310     see. Cookies can be accepted or rejected, or accepted only during the
311     current browser session (i.e. not written to disk), content can be
312     modified, some JavaScripts tamed, user-tracking fooled, and much more.
313     See below for a <a href="actions-file.html#ACTIONS">complete list of
314     actions</a>.</p>
315
316     <div class="SECT2">
317       <h2 class="SECT2"><a name="AEN2879" id="AEN2879">8.1. Finding the Right
318       Mix</a></h2>
319
320       <p>Note that some <a href="actions-file.html#ACTIONS">actions</a>, like
321       cookie suppression or script disabling, may render some sites unusable
322       that rely on these techniques to work properly. Finding the right mix
323       of actions is not always easy and certainly a matter of personal taste.
324       And, things can always change, requiring refinements in the
325       configuration. In general, it can be said that the more <span class=
326       "QUOTE">"aggressive"</span> your default settings (in the top section
327       of the actions file) are, the more exceptions for <span class=
328       "QUOTE">"trusted"</span> sites you will have to make later. If, for
329       example, you want to crunch all cookies per default, you'll have to
330       make exceptions from that rule for sites that you regularly use and
331       that require cookies for actually useful purposes, like maybe your
332       bank, favorite shop, or newspaper.</p>
333
334       <p>We have tried to provide you with reasonable rules to start from in
335       the distribution actions files. But there is no general rule of thumb
336       on these things. There just are too many variables, and sites are
337       constantly changing. Sooner or later you will want to change the rules
338       (and read this chapter again :).</p>
339     </div>
340
341     <div class="SECT2">
342       <h2 class="SECT2"><a name="AEN2886" id="AEN2886">8.2. How to
343       Edit</a></h2>
344
345       <p>The easiest way to edit the actions files is with a browser by using
346       our browser-based editor, which can be reached from <a href=
347       "http://config.privoxy.org/show-status" target=
348       "_top">http://config.privoxy.org/show-status</a>. Note: the config file
349       option <a href=
350       "config.html#ENABLE-EDIT-ACTIONS">enable-edit-actions</a> must be
351       enabled for this to work. The editor allows both fine-grained control
352       over every single feature on a per-URL basis, and easy choosing from
353       wholesale sets of defaults like <span class="QUOTE">"Cautious"</span>,
354       <span class="QUOTE">"Medium"</span> or <span class=
355       "QUOTE">"Advanced"</span>. Warning: the <span class=
356       "QUOTE">"Advanced"</span> setting is more aggressive, and will be more
357       likely to cause problems for some sites. Experienced users only!</p>
358
359       <p>If you prefer plain text editing to GUIs, you can of course also
360       directly edit the the actions files with your favorite text editor.
361       Look at <tt class="FILENAME">default.action</tt> which is richly
362       commented with many good examples.</p>
363     </div>
364
365     <div class="SECT2">
366       <h2 class="SECT2"><a name="ACTIONS-APPLY" id="ACTIONS-APPLY">8.3. How
367       Actions are Applied to Requests</a></h2>
368
369       <p>Actions files are divided into sections. There are special sections,
370       like the <span class="QUOTE">"<a href=
371       "actions-file.html#ALIASES">alias</a>"</span> sections which will be
372       discussed later. For now let's concentrate on regular sections: They
373       have a heading line (often split up to multiple lines for readability)
374       which consist of a list of actions, separated by whitespace and
375       enclosed in curly braces. Below that, there is a list of URL and tag
376       patterns, each on a separate line.</p>
377
378       <p>To determine which actions apply to a request, the URL of the
379       request is compared to all URL patterns in each <span class=
380       "QUOTE">"action file"</span>. Every time it matches, the list of
381       applicable actions for the request is incrementally updated, using the
382       heading of the section in which the pattern is located. The same is
383       done again for tags and tag patterns later on.</p>
384
385       <p>If multiple applying sections set the same action differently, the
386       last match wins. If not, the effects are aggregated. E.g. a URL might
387       match a regular section with a heading line of <tt class="LITERAL">{
388       +<a href="actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a>
389       }</tt>, then later another one with just <tt class="LITERAL">{
390       +<a href="actions-file.html#BLOCK">block</a> }</tt>, resulting in
391       <span class="emphasis"><i class="EMPHASIS">both</i></span> actions to
392       apply. And there may well be cases where you will want to combine
393       actions together. Such a section then might look like:</p>
394
395       <table border="0" bgcolor="#E0E0E0" width="100%">
396         <tr>
397           <td>
398             <pre class="SCREEN">
399   { +<tt class="LITERAL">handle-as-image</tt>  +<tt class=
400 "LITERAL">block{Banner ads.}</tt> }
401   # Block these as if they were images. Send no block page.
402    banners.example.com
403    media.example.com/.*banners
404    .example.com/images/ads/
405 </pre>
406           </td>
407         </tr>
408       </table>
409
410       <p>You can trace this process for URL patterns and any given URL by
411       visiting <a href="http://config.privoxy.org/show-url-info" target=
412       "_top">http://config.privoxy.org/show-url-info</a>.</p>
413
414       <p>Examples and more detail on this is provided in the Appendix,
415       <a href="appendix.html#ACTIONSANAT">Troubleshooting: Anatomy of an
416       Action</a> section.</p>
417     </div>
418
419     <div class="SECT2">
420       <h2 class="SECT2"><a name="AF-PATTERNS" id="AF-PATTERNS">8.4.
421       Patterns</a></h2>
422
423       <p>As mentioned, <span class="APPLICATION">Privoxy</span> uses
424       <span class="QUOTE">"patterns"</span> to determine what <span class=
425       "emphasis"><i class="EMPHASIS">actions</i></span> might apply to which
426       sites and pages your browser attempts to access. These <span class=
427       "QUOTE">"patterns"</span> use wild card type <span class=
428       "emphasis"><i class="EMPHASIS">pattern</i></span> matching to achieve a
429       high degree of flexibility. This allows one expression to be expanded
430       and potentially match against many similar patterns.</p>
431
432       <p>Generally, an URL pattern has the form <tt class=
433       "LITERAL">&lt;domain&gt;&lt;port&gt;/&lt;path&gt;</tt>, where the
434       <tt class="LITERAL">&lt;domain&gt;</tt>, the <tt class=
435       "LITERAL">&lt;port&gt;</tt> and the <tt class=
436       "LITERAL">&lt;path&gt;</tt> are optional. (This is why the special
437       <tt class="LITERAL">/</tt> pattern matches all URLs). Note that the
438       protocol portion of the URL pattern (e.g. <tt class=
439       "LITERAL">http://</tt>) should <span class="emphasis"><i class=
440       "EMPHASIS">not</i></span> be included in the pattern. This is assumed
441       already!</p>
442
443       <p>The pattern matching syntax is different for the domain and path
444       parts of the URL. The domain part uses a simple globbing type matching
445       technique, while the path part uses more flexible <a href=
446       "http://en.wikipedia.org/wiki/Regular_expressions" target=
447       "_top"><span class="QUOTE">"Regular Expressions"</span></a> (POSIX
448       1003.2).</p>
449
450       <p>The port part of a pattern is a decimal port number preceded by a
451       colon (<tt class="LITERAL">:</tt>). If the domain part contains a
452       numerical IPv6 address, it has to be put into angle brackets
453       (<tt class="LITERAL">&lt;</tt>, <tt class="LITERAL">&gt;</tt>).</p>
454
455       <div class="VARIABLELIST">
456         <dl>
457           <dt><tt class="LITERAL">www.example.com/</tt></dt>
458
459           <dd>
460             <p>is a domain-only pattern and will match any request to
461             <tt class="LITERAL">www.example.com</tt>, regardless of which
462             document on that server is requested. So ALL pages in this domain
463             would be covered by the scope of this action. Note that a simple
464             <tt class="LITERAL">example.com</tt> is different and would NOT
465             match.</p>
466           </dd>
467
468           <dt><tt class="LITERAL">www.example.com</tt></dt>
469
470           <dd>
471             <p>means exactly the same. For domain-only patterns, the trailing
472             <tt class="LITERAL">/</tt> may be omitted.</p>
473           </dd>
474
475           <dt><tt class="LITERAL">www.example.com/index.html</tt></dt>
476
477           <dd>
478             <p>matches all the documents on <tt class=
479             "LITERAL">www.example.com</tt> whose name starts with <tt class=
480             "LITERAL">/index.html</tt>.</p>
481           </dd>
482
483           <dt><tt class="LITERAL">www.example.com/index.html$</tt></dt>
484
485           <dd>
486             <p>matches only the single document <tt class=
487             "LITERAL">/index.html</tt> on <tt class=
488             "LITERAL">www.example.com</tt>.</p>
489           </dd>
490
491           <dt><tt class="LITERAL">/index.html$</tt></dt>
492
493           <dd>
494             <p>matches the document <tt class="LITERAL">/index.html</tt>,
495             regardless of the domain, i.e. on <span class=
496             "emphasis"><i class="EMPHASIS">any</i></span> web server
497             anywhere.</p>
498           </dd>
499
500           <dt><tt class="LITERAL">/</tt></dt>
501
502           <dd>
503             <p>Matches any URL because there's no requirement for either the
504             domain or the path to match anything.</p>
505           </dd>
506
507           <dt><tt class="LITERAL">:8000/</tt></dt>
508
509           <dd>
510             <p>Matches any URL pointing to TCP port 8000.</p>
511           </dd>
512
513           <dt><tt class="LITERAL">&lt;2001:db8::1&gt;/</tt></dt>
514
515           <dd>
516             <p>Matches any URL with the host address <tt class=
517             "LITERAL">2001:db8::1</tt>. (Note that the real URL uses plain
518             brackets, not angle brackets.)</p>
519           </dd>
520
521           <dt><tt class="LITERAL">index.html</tt></dt>
522
523           <dd>
524             <p>matches nothing, since it would be interpreted as a domain
525             name and there is no top-level domain called <tt class=
526             "LITERAL">.html</tt>. So its a mistake.</p>
527           </dd>
528         </dl>
529       </div>
530
531       <div class="SECT3">
532         <h3 class="SECT3"><a name="AEN2998" id="AEN2998">8.4.1. The Domain
533         Pattern</a></h3>
534
535         <p>The matching of the domain part offers some flexible options: if
536         the domain starts or ends with a dot, it becomes unanchored at that
537         end. For example:</p>
538
539         <div class="VARIABLELIST">
540           <dl>
541             <dt><tt class="LITERAL">.example.com</tt></dt>
542
543             <dd>
544               <p>matches any domain with first-level domain <tt class=
545               "LITERAL">com</tt> and second-level domain <tt class=
546               "LITERAL">example</tt>. For example <tt class=
547               "LITERAL">www.example.com</tt>, <tt class=
548               "LITERAL">example.com</tt> and <tt class=
549               "LITERAL">foo.bar.baz.example.com</tt>. Note that it wouldn't
550               match if the second-level domain was <tt class=
551               "LITERAL">another-example</tt>.</p>
552             </dd>
553
554             <dt><tt class="LITERAL">www.</tt></dt>
555
556             <dd>
557               <p>matches any domain that <span class="emphasis"><i class=
558               "EMPHASIS">STARTS</i></span> with <tt class="LITERAL">www.</tt>
559               (It also matches the domain <tt class="LITERAL">www</tt> but
560               most of the time that doesn't matter.)</p>
561             </dd>
562
563             <dt><tt class="LITERAL">.example.</tt></dt>
564
565             <dd>
566               <p>matches any domain that <span class="emphasis"><i class=
567               "EMPHASIS">CONTAINS</i></span> <tt class=
568               "LITERAL">.example.</tt>. And, by the way, also included would
569               be any files or documents that exist within that domain since
570               no path limitations are specified. (Correctly speaking: It
571               matches any FQDN that contains <tt class="LITERAL">example</tt>
572               as a domain.) This might be <tt class=
573               "LITERAL">www.example.com</tt>, <tt class=
574               "LITERAL">news.example.de</tt>, or <tt class=
575               "LITERAL">www.example.net/cgi/testing.pl</tt> for instance. All
576               these cases are matched.</p>
577             </dd>
578           </dl>
579         </div>
580
581         <p>Additionally, there are wild-cards that you can use in the domain
582         names themselves. These work similarly to shell globbing type
583         wild-cards: <span class="QUOTE">"*"</span> represents zero or more
584         arbitrary characters (this is equivalent to the <a href=
585         "http://en.wikipedia.org/wiki/Regular_expressions" target=
586         "_top"><span class="QUOTE">"Regular Expression"</span></a> based
587         syntax of <span class="QUOTE">".*"</span>), <span class=
588         "QUOTE">"?"</span> represents any single character (this is
589         equivalent to the regular expression syntax of a simple <span class=
590         "QUOTE">"."</span>), and you can define <span class=
591         "QUOTE">"character classes"</span> in square brackets which is
592         similar to the same regular expression technique. All of this can be
593         freely mixed:</p>
594
595         <div class="VARIABLELIST">
596           <dl>
597             <dt><tt class="LITERAL">ad*.example.com</tt></dt>
598
599             <dd>
600               <p>matches <span class="QUOTE">"adserver.example.com"</span>,
601               <span class="QUOTE">"ads.example.com"</span>, etc but not
602               <span class="QUOTE">"sfads.example.com"</span></p>
603             </dd>
604
605             <dt><tt class="LITERAL">*ad*.example.com</tt></dt>
606
607             <dd>
608               <p>matches all of the above, and then some.</p>
609             </dd>
610
611             <dt><tt class="LITERAL">.?pix.com</tt></dt>
612
613             <dd>
614               <p>matches <tt class="LITERAL">www.ipix.com</tt>, <tt class=
615               "LITERAL">pictures.epix.com</tt>, <tt class=
616               "LITERAL">a.b.c.d.e.upix.com</tt> etc.</p>
617             </dd>
618
619             <dt><tt class="LITERAL">www[1-9a-ez].example.c*</tt></dt>
620
621             <dd>
622               <p>matches <tt class="LITERAL">www1.example.com</tt>,
623               <tt class="LITERAL">www4.example.cc</tt>, <tt class=
624               "LITERAL">wwwd.example.cy</tt>, <tt class=
625               "LITERAL">wwwz.example.com</tt> etc., but <span class=
626               "emphasis"><i class="EMPHASIS">not</i></span> <tt class=
627               "LITERAL">wwww.example.com</tt>.</p>
628             </dd>
629           </dl>
630         </div>
631
632         <p>While flexible, this is not the sophistication of full regular
633         expression based syntax.</p>
634       </div>
635
636       <div class="SECT3">
637         <h3 class="SECT3"><a name="AEN3074" id="AEN3074">8.4.2. The Path
638         Pattern</a></h3>
639
640         <p><span class="APPLICATION">Privoxy</span> uses <span class=
641         "QUOTE">"modern"</span> POSIX 1003.2 <a href=
642         "http://en.wikipedia.org/wiki/Regular_expressions" target=
643         "_top"><span class="QUOTE">"Regular Expressions"</span></a> for
644         matching the path portion (after the slash), and is thus more
645         flexible.</p>
646
647         <p>There is an <a href="appendix.html#REGEX">Appendix</a> with a
648         brief quick-start into regular expressions, you also might want to
649         have a look at your operating system's documentation on regular
650         expressions (try <tt class="LITERAL">man re_format</tt>).</p>
651
652         <p>Note that the path pattern is automatically left-anchored at the
653         <span class="QUOTE">"/"</span>, i.e. it matches as if it would start
654         with a <span class="QUOTE">"^"</span> (regular expression speak for
655         the beginning of a line).</p>
656
657         <p>Please also note that matching in the path is <span class=
658         "emphasis"><i class="EMPHASIS">CASE INSENSITIVE</i></span> by
659         default, but you can switch to case sensitive at any point in the
660         pattern by using the <span class="QUOTE">"(?-i)"</span> switch:
661         <tt class="LITERAL">www.example.com/(?-i)PaTtErN.*</tt> will match
662         only documents whose path starts with <tt class=
663         "LITERAL">PaTtErN</tt> in <span class="emphasis"><i class=
664         "EMPHASIS">exactly</i></span> this capitalization.</p>
665
666         <div class="VARIABLELIST">
667           <dl>
668             <dt><tt class="LITERAL">.example.com/.*</tt></dt>
669
670             <dd>
671               <p>Is equivalent to just <span class=
672               "QUOTE">".example.com"</span>, since any documents within that
673               domain are matched with or without the <span class=
674               "QUOTE">".*"</span> regular expression. This is redundant</p>
675             </dd>
676
677             <dt><tt class="LITERAL">.example.com/.*/index.html$</tt></dt>
678
679             <dd>
680               <p>Will match any page in the domain of <span class=
681               "QUOTE">"example.com"</span> that is named <span class=
682               "QUOTE">"index.html"</span>, and that is part of some path. For
683               example, it matches <span class=
684               "QUOTE">"www.example.com/testing/index.html"</span> but NOT
685               <span class="QUOTE">"www.example.com/index.html"</span> because
686               the regular expression called for at least two <span class=
687               "QUOTE">"/'s"</span>, thus the path requirement. It also would
688               match <span class=
689               "QUOTE">"www.example.com/testing/index_html"</span>, because of
690               the special meta-character <span class="QUOTE">"."</span>.</p>
691             </dd>
692
693             <dt><tt class="LITERAL">.example.com/(.*/)?index\.html$</tt></dt>
694
695             <dd>
696               <p>This regular expression is conditional so it will match any
697               page named <span class="QUOTE">"index.html"</span> regardless
698               of path which in this case can have one or more <span class=
699               "QUOTE">"/'s"</span>. And this one must contain exactly
700               <span class="QUOTE">".html"</span> (but does not have to end
701               with that!).</p>
702             </dd>
703
704             <dt><tt class=
705             "LITERAL">.example.com/(.*/)(ads|banners?|junk)</tt></dt>
706
707             <dd>
708               <p>This regular expression will match any path of <span class=
709               "QUOTE">"example.com"</span> that contains any of the words
710               <span class="QUOTE">"ads"</span>, <span class=
711               "QUOTE">"banner"</span>, <span class="QUOTE">"banners"</span>
712               (because of the <span class="QUOTE">"?"</span>) or <span class=
713               "QUOTE">"junk"</span>. The path does not have to end in these
714               words, just contain them.</p>
715             </dd>
716
717             <dt><tt class=
718             "LITERAL">.example.com/(.*/)(ads|banners?|junk)/.*\.(jpe?g|gif|png)$</tt></dt>
719
720             <dd>
721               <p>This is very much the same as above, except now it must end
722               in either <span class="QUOTE">".jpg"</span>, <span class=
723               "QUOTE">".jpeg"</span>, <span class="QUOTE">".gif"</span> or
724               <span class="QUOTE">".png"</span>. So this one is limited to
725               common image formats.</p>
726             </dd>
727           </dl>
728         </div>
729
730         <p>There are many, many good examples to be found in <tt class=
731         "FILENAME">default.action</tt>, and more tutorials below in <a href=
732         "appendix.html#REGEX">Appendix on regular expressions</a>.</p>
733       </div>
734
735       <div class="SECT3">
736         <h3 class="SECT3"><a name="TAG-PATTERN" id="TAG-PATTERN">8.4.3. The
737         Tag Pattern</a></h3>
738
739         <p>Tag patterns are used to change the applying actions based on the
740         request's tags. Tags can be created with either the <a href=
741         "actions-file.html#CLIENT-HEADER-TAGGER">client-header-tagger</a> or
742         the <a href=
743         "actions-file.html#SERVER-HEADER-TAGGER">server-header-tagger</a>
744         action.</p>
745
746         <p>Tag patterns have to start with <span class="QUOTE">"TAG:"</span>,
747         so <span class="APPLICATION">Privoxy</span> can tell them apart from
748         URL patterns. Everything after the colon including white space, is
749         interpreted as a regular expression with path pattern syntax, except
750         that tag patterns aren't left-anchored automatically (<span class=
751         "APPLICATION">Privoxy</span> doesn't silently add a <span class=
752         "QUOTE">"^"</span>, you have to do it yourself if you need it).</p>
753
754         <p>To match all requests that are tagged with <span class=
755         "QUOTE">"foo"</span> your pattern line should be <span class=
756         "QUOTE">"TAG:^foo$"</span>, <span class="QUOTE">"TAG:foo"</span>
757         would work as well, but it would also match requests whose tags
758         contain <span class="QUOTE">"foo"</span> somewhere. <span class=
759         "QUOTE">"TAG: foo"</span> wouldn't work as it requires white
760         space.</p>
761
762         <p>Sections can contain URL and tag patterns at the same time, but
763         tag patterns are checked after the URL patterns and thus always
764         overrule them, even if they are located before the URL patterns.</p>
765
766         <p>Once a new tag is added, Privoxy checks right away if it's matched
767         by one of the tag patterns and updates the action settings
768         accordingly. As a result tags can be used to activate other tagger
769         actions, as long as these other taggers look for headers that haven't
770         already be parsed.</p>
771
772         <p>For example you could tag client requests which use the <tt class=
773         "LITERAL">POST</tt> method, then use this tag to activate another
774         tagger that adds a tag if cookies are sent, and then use a block
775         action based on the cookie tag. This allows the outcome of one
776         action, to be input into a subsequent action. However if you'd
777         reverse the position of the described taggers, and activated the
778         method tagger based on the cookie tagger, no method tags would be
779         created. The method tagger would look for the request line, but at
780         the time the cookie tag is created, the request line has already been
781         parsed.</p>
782
783         <p>While this is a limitation you should be aware of, this kind of
784         indirection is seldom needed anyway and even the example doesn't make
785         too much sense.</p>
786       </div>
787     </div>
788
789     <div class="SECT2">
790       <h2 class="SECT2"><a name="ACTIONS" id="ACTIONS">8.5. Actions</a></h2>
791
792       <p>All actions are disabled by default, until they are explicitly
793       enabled somewhere in an actions file. Actions are turned on if preceded
794       with a <span class="QUOTE">"+"</span>, and turned off if preceded with
795       a <span class="QUOTE">"-"</span>. So a <tt class="LITERAL">+action</tt>
796       means <span class="QUOTE">"do that action"</span>, e.g. <tt class=
797       "LITERAL">+block</tt> means <span class="QUOTE">"please block URLs that
798       match the following patterns"</span>, and <tt class=
799       "LITERAL">-block</tt> means <span class="QUOTE">"don't block URLs that
800       match the following patterns, even if <tt class="LITERAL">+block</tt>
801       previously applied."</span></p>
802
803       <p>Again, actions are invoked by placing them on a line, enclosed in
804       curly braces and separated by whitespace, like in <tt class=
805       "LITERAL">{+some-action -some-other-action{some-parameter}}</tt>,
806       followed by a list of URL patterns, one per line, to which they apply.
807       Together, the actions line and the following pattern lines make up a
808       section of the actions file.</p>
809
810       <p>Actions fall into three categories:</p>
811
812       <ul>
813         <li>
814           <p>Boolean, i.e the action can only be <span class=
815           "QUOTE">"enabled"</span> or <span class="QUOTE">"disabled"</span>.
816           Syntax:</p>
817
818           <table border="0" bgcolor="#E0E0E0" width="90%">
819             <tr>
820               <td>
821                 <pre class="SCREEN">
822   +<tt class="REPLACEABLE"><i>name</i></tt>        # enable action <tt class=
823 "REPLACEABLE"><i>name</i></tt>
824   -<tt class=
825 "REPLACEABLE"><i>name</i></tt>        # disable action <tt class="REPLACEABLE"><i>name</i></tt>
826 </pre>
827               </td>
828             </tr>
829           </table>
830
831           <p>Example: <tt class="LITERAL">+handle-as-image</tt></p>
832         </li>
833
834         <li>
835           <p>Parameterized, where some value is required in order to enable
836           this type of action. Syntax:</p>
837
838           <table border="0" bgcolor="#E0E0E0" width="90%">
839             <tr>
840               <td>
841                 <pre class="SCREEN">
842   +<tt class="REPLACEABLE"><i>name</i></tt>{<tt class=
843 "REPLACEABLE"><i>param</i></tt>}  # enable action and set parameter to <tt class="REPLACEABLE"><i>param</i></tt>,
844                # overwriting parameter from previous match if necessary
845   -<tt class=
846 "REPLACEABLE"><i>name</i></tt>         # disable action. The parameter can be omitted
847 </pre>
848               </td>
849             </tr>
850           </table>
851
852           <p>Note that if the URL matches multiple positive forms of a
853           parameterized action, the last match wins, i.e. the params from
854           earlier matches are simply ignored.</p>
855
856           <p>Example: <tt class="LITERAL">+hide-user-agent{Mozilla/5.0 (X11;
857           U; FreeBSD i386; en-US; rv:1.8.1.4) Gecko/20070602
858           Firefox/2.0.0.4}</tt></p>
859         </li>
860
861         <li>
862           <p>Multi-value. These look exactly like parameterized actions, but
863           they behave differently: If the action applies multiple times to
864           the same URL, but with different parameters, <span class=
865           "emphasis"><i class="EMPHASIS">all</i></span> the parameters from
866           <span class="emphasis"><i class="EMPHASIS">all</i></span> matches
867           are remembered. This is used for actions that can be executed for
868           the same request repeatedly, like adding multiple headers, or
869           filtering through multiple filters. Syntax:</p>
870
871           <table border="0" bgcolor="#E0E0E0" width="90%">
872             <tr>
873               <td>
874                 <pre class="SCREEN">
875   +<tt class="REPLACEABLE"><i>name</i></tt>{<tt class=
876 "REPLACEABLE"><i>param</i></tt>}   # enable action and add <tt class=
877 "REPLACEABLE"><i>param</i></tt> to the list of parameters
878   -<tt class="REPLACEABLE"><i>name</i></tt>{<tt class=
879 "REPLACEABLE"><i>param</i></tt>}   # remove the parameter <tt class=
880 "REPLACEABLE"><i>param</i></tt> from the list of parameters
881                 # If it was the last one left, disable the action.
882   <tt class=
883 "REPLACEABLE"><i>-name</i></tt>          # disable this action completely and remove all parameters from the list
884 </pre>
885               </td>
886             </tr>
887           </table>
888
889           <p>Examples: <tt class="LITERAL">+add-header{X-Fun-Header: Some
890           text}</tt> and <tt class=
891           "LITERAL">+filter{html-annoyances}</tt></p>
892         </li>
893       </ul>
894
895       <p>If nothing is specified in any actions file, no <span class=
896       "QUOTE">"actions"</span> are taken. So in this case <span class=
897       "APPLICATION">Privoxy</span> would just be a normal, non-blocking,
898       non-filtering proxy. You must specifically enable the privacy and
899       blocking features you need (although the provided default actions files
900       will give a good starting point).</p>
901
902       <p>Later defined action sections always over-ride earlier ones of the
903       same type. So exceptions to any rules you make, should come in the
904       latter part of the file (or in a file that is processed later when
905       using multiple actions files such as <tt class=
906       "FILENAME">user.action</tt>). For multi-valued actions, the actions are
907       applied in the order they are specified. Actions files are processed in
908       the order they are defined in <tt class="FILENAME">config</tt> (the
909       default installation has three actions files). It also quite possible
910       for any given URL to match more than one <span class=
911       "QUOTE">"pattern"</span> (because of wildcards and regular
912       expressions), and thus to trigger more than one set of actions! Last
913       match wins.</p>
914
915       <p>The list of valid <span class="APPLICATION">Privoxy</span> actions
916       are:</p>
917
918       <div class="SECT3">
919         <h4 class="SECT3"><a name="ADD-HEADER" id="ADD-HEADER">8.5.1.
920         add-header</a></h4>
921
922         <div class="VARIABLELIST">
923           <dl>
924             <dt>Typical use:</dt>
925
926             <dd>
927               <p>Confuse log analysis, custom applications</p>
928             </dd>
929
930             <dt>Effect:</dt>
931
932             <dd>
933               <p>Sends a user defined HTTP header to the web server.</p>
934             </dd>
935
936             <dt>Type:</dt>
937
938             <dd>
939               <p>Multi-value.</p>
940             </dd>
941
942             <dt>Parameter:</dt>
943
944             <dd>
945               <p>Any string value is possible. Validity of the defined HTTP
946               headers is not checked. It is recommended that you use the
947               <span class="QUOTE">"<tt class="LITERAL">X-</tt>"</span> prefix
948               for custom headers.</p>
949             </dd>
950
951             <dt>Notes:</dt>
952
953             <dd>
954               <p>This action may be specified multiple times, in order to
955               define multiple headers. This is rarely needed for the typical
956               user. If you don't know what <span class="QUOTE">"HTTP
957               headers"</span> are, you definitely don't need to worry about
958               this one.</p>
959
960               <p>Headers added by this action are not modified by other
961               actions.</p>
962             </dd>
963
964             <dt>Example usage:</dt>
965
966             <dd>
967               <table border="0" bgcolor="#E0E0E0" width="90%">
968                 <tr>
969                   <td>
970                     <pre class="SCREEN">
971 +add-header{X-User-Tracking: sucks}
972 </pre>
973                   </td>
974                 </tr>
975               </table>
976             </dd>
977           </dl>
978         </div>
979       </div>
980
981       <div class="SECT3">
982         <h4 class="SECT3"><a name="BLOCK" id="BLOCK">8.5.2. block</a></h4>
983
984         <div class="VARIABLELIST">
985           <dl>
986             <dt>Typical use:</dt>
987
988             <dd>
989               <p>Block ads or other unwanted content</p>
990             </dd>
991
992             <dt>Effect:</dt>
993
994             <dd>
995               <p>Requests for URLs to which this action applies are blocked,
996               i.e. the requests are trapped by <span class=
997               "APPLICATION">Privoxy</span> and the requested URL is never
998               retrieved, but is answered locally with a substitute page or
999               image, as determined by the <tt class="LITERAL"><a href=
1000               "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt>,
1001               <tt class="LITERAL"><a href=
1002               "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a></tt>,
1003               and <tt class="LITERAL"><a href=
1004               "actions-file.html#HANDLE-AS-EMPTY-DOCUMENT">handle-as-empty-document</a></tt>
1005               actions.</p>
1006             </dd>
1007
1008             <dt>Type:</dt>
1009
1010             <dd>
1011               <p>Parameterized.</p>
1012             </dd>
1013
1014             <dt>Parameter:</dt>
1015
1016             <dd>
1017               <p>A block reason that should be given to the user.</p>
1018             </dd>
1019
1020             <dt>Notes:</dt>
1021
1022             <dd>
1023               <p><span class="APPLICATION">Privoxy</span> sends a special
1024               <span class="QUOTE">"BLOCKED"</span> page for requests to
1025               blocked pages. This page contains the block reason given as
1026               parameter, a link to find out why the block action applies, and
1027               a click-through to the blocked content (the latter only if the
1028               force feature is available and enabled).</p>
1029
1030               <p>A very important exception occurs if <span class=
1031               "emphasis"><i class="EMPHASIS">both</i></span> <tt class=
1032               "LITERAL">block</tt> and <tt class="LITERAL"><a href=
1033               "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt>,
1034               apply to the same request: it will then be replaced by an
1035               image. If <tt class="LITERAL"><a href=
1036               "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a></tt>
1037               (see below) also applies, the type of image will be determined
1038               by its parameter, if not, the standard checkerboard pattern is
1039               sent.</p>
1040
1041               <p>It is important to understand this process, in order to
1042               understand how <span class="APPLICATION">Privoxy</span> deals
1043               with ads and other unwanted content. Blocking is a core
1044               feature, and one upon which various other features depend.</p>
1045
1046               <p>The <tt class="LITERAL"><a href=
1047               "actions-file.html#FILTER">filter</a></tt> action can perform a
1048               very similar task, by <span class="QUOTE">"blocking"</span>
1049               banner images and other content through rewriting the relevant
1050               URLs in the document's HTML source, so they don't get requested
1051               in the first place. Note that this is a totally different
1052               technique, and it's easy to confuse the two.</p>
1053             </dd>
1054
1055             <dt>Example usage (section):</dt>
1056
1057             <dd>
1058               <table border="0" bgcolor="#E0E0E0" width="90%">
1059                 <tr>
1060                   <td>
1061                     <pre class="SCREEN">
1062 {+block{No nasty stuff for you.}}
1063 # Block and replace with "blocked" page
1064  .nasty-stuff.example.com
1065
1066 {+block{Doubleclick banners.} +handle-as-image}
1067 # Block and replace with image
1068  .ad.doubleclick.net
1069  .ads.r.us/banners/
1070
1071 {+block{Layered ads.} +handle-as-empty-document}
1072 # Block and then ignore
1073  adserver.example.net/.*\.js$
1074 </pre>
1075                   </td>
1076                 </tr>
1077               </table>
1078             </dd>
1079           </dl>
1080         </div>
1081       </div>
1082
1083       <div class="SECT3">
1084         <h4 class="SECT3"><a name="CHANGE-X-FORWARDED-FOR" id=
1085         "CHANGE-X-FORWARDED-FOR">8.5.3. change-x-forwarded-for</a></h4>
1086
1087         <div class="VARIABLELIST">
1088           <dl>
1089             <dt>Typical use:</dt>
1090
1091             <dd>
1092               <p>Improve privacy by not forwarding the source of the request
1093               in the HTTP headers.</p>
1094             </dd>
1095
1096             <dt>Effect:</dt>
1097
1098             <dd>
1099               <p>Deletes the <span class="QUOTE">"X-Forwarded-For:"</span>
1100               HTTP header from the client request, or adds a new one.</p>
1101             </dd>
1102
1103             <dt>Type:</dt>
1104
1105             <dd>
1106               <p>Parameterized.</p>
1107             </dd>
1108
1109             <dt>Parameter:</dt>
1110
1111             <dd>
1112               <ul>
1113                 <li>
1114                   <p><span class="QUOTE">"block"</span> to delete the
1115                   header.</p>
1116                 </li>
1117
1118                 <li>
1119                   <p><span class="QUOTE">"add"</span> to create the header
1120                   (or append the client's IP address to an already existing
1121                   one).</p>
1122                 </li>
1123               </ul>
1124             </dd>
1125
1126             <dt>Notes:</dt>
1127
1128             <dd>
1129               <p>It is safe and recommended to use <tt class=
1130               "LITERAL">block</tt>.</p>
1131
1132               <p>Forwarding the source address of the request may make sense
1133               in some multi-user setups but is also a privacy risk.</p>
1134             </dd>
1135
1136             <dt>Example usage:</dt>
1137
1138             <dd>
1139               <table border="0" bgcolor="#E0E0E0" width="90%">
1140                 <tr>
1141                   <td>
1142                     <pre class="SCREEN">
1143 +change-x-forwarded-for{block}
1144 </pre>
1145                   </td>
1146                 </tr>
1147               </table>
1148             </dd>
1149           </dl>
1150         </div>
1151       </div>
1152
1153       <div class="SECT3">
1154         <h4 class="SECT3"><a name="CLIENT-HEADER-FILTER" id=
1155         "CLIENT-HEADER-FILTER">8.5.4. client-header-filter</a></h4>
1156
1157         <div class="VARIABLELIST">
1158           <dl>
1159             <dt>Typical use:</dt>
1160
1161             <dd>
1162               <p>Rewrite or remove single client headers.</p>
1163             </dd>
1164
1165             <dt>Effect:</dt>
1166
1167             <dd>
1168               <p>All client headers to which this action applies are filtered
1169               on-the-fly through the specified regular expression based
1170               substitutions.</p>
1171             </dd>
1172
1173             <dt>Type:</dt>
1174
1175             <dd>
1176               <p>Parameterized.</p>
1177             </dd>
1178
1179             <dt>Parameter:</dt>
1180
1181             <dd>
1182               <p>The name of a client-header filter, as defined in one of the
1183               <a href="filter-file.html">filter files</a>.</p>
1184             </dd>
1185
1186             <dt>Notes:</dt>
1187
1188             <dd>
1189               <p>Client-header filters are applied to each header on its own,
1190               not to all at once. This makes it easier to diagnose problems,
1191               but on the downside you can't write filters that only change
1192               header x if header y's value is z. You can do that by using
1193               tags though.</p>
1194
1195               <p>Client-header filters are executed after the other header
1196               actions have finished and use their output as input.</p>
1197
1198               <p>If the request URL gets changed, <span class=
1199               "APPLICATION">Privoxy</span> will detect that and use the new
1200               one. This can be used to rewrite the request destination behind
1201               the client's back, for example to specify a Tor exit relay for
1202               certain requests.</p>
1203
1204               <p>Please refer to the <a href="filter-file.html">filter file
1205               chapter</a> to learn which client-header filters are available
1206               by default, and how to create your own.</p>
1207             </dd>
1208
1209             <dt>Example usage (section):</dt>
1210
1211             <dd>
1212               <table border="0" bgcolor="#E0E0E0" width="90%">
1213                 <tr>
1214                   <td>
1215                     <pre class="SCREEN">
1216 # Hide Tor exit notation in Host and Referer Headers
1217 {+client-header-filter{hide-tor-exit-notation}}
1218 /
1219
1220 </pre>
1221                   </td>
1222                 </tr>
1223               </table>
1224             </dd>
1225           </dl>
1226         </div>
1227       </div>
1228
1229       <div class="SECT3">
1230         <h4 class="SECT3"><a name="CLIENT-HEADER-TAGGER" id=
1231         "CLIENT-HEADER-TAGGER">8.5.5. client-header-tagger</a></h4>
1232
1233         <div class="VARIABLELIST">
1234           <dl>
1235             <dt>Typical use:</dt>
1236
1237             <dd>
1238               <p>Block requests based on their headers.</p>
1239             </dd>
1240
1241             <dt>Effect:</dt>
1242
1243             <dd>
1244               <p>Client headers to which this action applies are filtered
1245               on-the-fly through the specified regular expression based
1246               substitutions, the result is used as tag.</p>
1247             </dd>
1248
1249             <dt>Type:</dt>
1250
1251             <dd>
1252               <p>Parameterized.</p>
1253             </dd>
1254
1255             <dt>Parameter:</dt>
1256
1257             <dd>
1258               <p>The name of a client-header tagger, as defined in one of the
1259               <a href="filter-file.html">filter files</a>.</p>
1260             </dd>
1261
1262             <dt>Notes:</dt>
1263
1264             <dd>
1265               <p>Client-header taggers are applied to each header on its own,
1266               and as the header isn't modified, each tagger <span class=
1267               "QUOTE">"sees"</span> the original.</p>
1268
1269               <p>Client-header taggers are the first actions that are
1270               executed and their tags can be used to control every other
1271               action.</p>
1272             </dd>
1273
1274             <dt>Example usage (section):</dt>
1275
1276             <dd>
1277               <table border="0" bgcolor="#E0E0E0" width="90%">
1278                 <tr>
1279                   <td>
1280                     <pre class="SCREEN">
1281 # Tag every request with the User-Agent header
1282 {+client-header-tagger{user-agent}}
1283 /
1284
1285 # Tagging itself doesn't change the action
1286 # settings, sections with TAG patterns do:
1287 #
1288 # If it's a download agent, use a different forwarding proxy,
1289 # show the real User-Agent and make sure resume works.
1290 {+forward-override{forward-socks5 10.0.0.2:2222 .} \
1291  -hide-if-modified-since      \
1292  -overwrite-last-modified     \
1293  -hide-user-agent             \
1294  -filter                      \
1295  -deanimate-gifs              \
1296 }
1297 TAG:^User-Agent: NetBSD-ftp/
1298 TAG:^User-Agent: Novell ZYPP Installer
1299 TAG:^User-Agent: RPM APT-HTTP/
1300 TAG:^User-Agent: fetch libfetch/
1301 TAG:^User-Agent: Ubuntu APT-HTTP/
1302 TAG:^User-Agent: MPlayer/
1303
1304 </pre>
1305                   </td>
1306                 </tr>
1307               </table>
1308             </dd>
1309           </dl>
1310         </div>
1311       </div>
1312
1313       <div class="SECT3">
1314         <h4 class="SECT3"><a name="CONTENT-TYPE-OVERWRITE" id=
1315         "CONTENT-TYPE-OVERWRITE">8.5.6. content-type-overwrite</a></h4>
1316
1317         <div class="VARIABLELIST">
1318           <dl>
1319             <dt>Typical use:</dt>
1320
1321             <dd>
1322               <p>Stop useless download menus from popping up, or change the
1323               browser's rendering mode</p>
1324             </dd>
1325
1326             <dt>Effect:</dt>
1327
1328             <dd>
1329               <p>Replaces the <span class="QUOTE">"Content-Type:"</span> HTTP
1330               server header.</p>
1331             </dd>
1332
1333             <dt>Type:</dt>
1334
1335             <dd>
1336               <p>Parameterized.</p>
1337             </dd>
1338
1339             <dt>Parameter:</dt>
1340
1341             <dd>
1342               <p>Any string.</p>
1343             </dd>
1344
1345             <dt>Notes:</dt>
1346
1347             <dd>
1348               <p>The <span class="QUOTE">"Content-Type:"</span> HTTP server
1349               header is used by the browser to decide what to do with the
1350               document. The value of this header can cause the browser to
1351               open a download menu instead of displaying the document by
1352               itself, even if the document's format is supported by the
1353               browser.</p>
1354
1355               <p>The declared content type can also affect which rendering
1356               mode the browser chooses. If XHTML is delivered as <span class=
1357               "QUOTE">"text/html"</span>, many browsers treat it as yet
1358               another broken HTML document. If it is send as <span class=
1359               "QUOTE">"application/xml"</span>, browsers with XHTML support
1360               will only display it, if the syntax is correct.</p>
1361
1362               <p>If you see a web site that proudly uses XHTML buttons, but
1363               sets <span class="QUOTE">"Content-Type: text/html"</span>, you
1364               can use <span class="APPLICATION">Privoxy</span> to overwrite
1365               it with <span class="QUOTE">"application/xml"</span> and
1366               validate the web master's claim inside your XHTML-supporting
1367               browser. If the syntax is incorrect, the browser will complain
1368               loudly.</p>
1369
1370               <p>You can also go the opposite direction: if your browser
1371               prints error messages instead of rendering a document falsely
1372               declared as XHTML, you can overwrite the content type with
1373               <span class="QUOTE">"text/html"</span> and have it rendered as
1374               broken HTML document.</p>
1375
1376               <p>By default <tt class="LITERAL">content-type-overwrite</tt>
1377               only replaces <span class="QUOTE">"Content-Type:"</span>
1378               headers that look like some kind of text. If you want to
1379               overwrite it unconditionally, you have to combine it with
1380               <tt class="LITERAL"><a href=
1381               "actions-file.html#FORCE-TEXT-MODE">force-text-mode</a></tt>.
1382               This limitation exists for a reason, think twice before
1383               circumventing it.</p>
1384
1385               <p>Most of the time it's easier to replace this action with a
1386               custom <tt class="LITERAL"><a href=
1387               "actions-file.html#SERVER-HEADER-FILTER">server-header
1388               filter</a></tt>. It allows you to activate it for every
1389               document of a certain site and it will still only replace the
1390               content types you aimed at.</p>
1391
1392               <p>Of course you can apply <tt class=
1393               "LITERAL">content-type-overwrite</tt> to a whole site and then
1394               make URL based exceptions, but it's a lot more work to get the
1395               same precision.</p>
1396             </dd>
1397
1398             <dt>Example usage (sections):</dt>
1399
1400             <dd>
1401               <table border="0" bgcolor="#E0E0E0" width="90%">
1402                 <tr>
1403                   <td>
1404                     <pre class="SCREEN">
1405 # Check if www.example.net/ really uses valid XHTML
1406 { +content-type-overwrite{application/xml} }
1407 www.example.net/
1408
1409 # but leave the content type unmodified if the URL looks like a style sheet
1410 {-content-type-overwrite}
1411 www.example.net/.*\.css$
1412 www.example.net/.*style
1413 </pre>
1414                   </td>
1415                 </tr>
1416               </table>
1417             </dd>
1418           </dl>
1419         </div>
1420       </div>
1421
1422       <div class="SECT3">
1423         <h4 class="SECT3"><a name="CRUNCH-CLIENT-HEADER" id=
1424         "CRUNCH-CLIENT-HEADER">8.5.7. crunch-client-header</a></h4>
1425
1426         <div class="VARIABLELIST">
1427           <dl>
1428             <dt>Typical use:</dt>
1429
1430             <dd>
1431               <p>Remove a client header <span class=
1432               "APPLICATION">Privoxy</span> has no dedicated action for.</p>
1433             </dd>
1434
1435             <dt>Effect:</dt>
1436
1437             <dd>
1438               <p>Deletes every header sent by the client that contains the
1439               string the user supplied as parameter.</p>
1440             </dd>
1441
1442             <dt>Type:</dt>
1443
1444             <dd>
1445               <p>Parameterized.</p>
1446             </dd>
1447
1448             <dt>Parameter:</dt>
1449
1450             <dd>
1451               <p>Any string.</p>
1452             </dd>
1453
1454             <dt>Notes:</dt>
1455
1456             <dd>
1457               <p>This action allows you to block client headers for which no
1458               dedicated <span class="APPLICATION">Privoxy</span> action
1459               exists. <span class="APPLICATION">Privoxy</span> will remove
1460               every client header that contains the string you supplied as
1461               parameter.</p>
1462
1463               <p>Regular expressions are <span class="emphasis"><i class=
1464               "EMPHASIS">not supported</i></span> and you can't use this
1465               action to block different headers in the same request, unless
1466               they contain the same string.</p>
1467
1468               <p><tt class="LITERAL">crunch-client-header</tt> is only meant
1469               for quick tests. If you have to block several different
1470               headers, or only want to modify parts of them, you should use a
1471               <tt class="LITERAL"><a href=
1472               "actions-file.html#CLIENT-HEADER-FILTER">client-header
1473               filter</a></tt>.</p>
1474
1475               <div class="WARNING">
1476                 <table class="WARNING" border="1" width="90%">
1477                   <tr>
1478                     <td align="center"><b>Warning</b></td>
1479                   </tr>
1480
1481                   <tr>
1482                     <td align="left">
1483                       <p>Don't block any header without understanding the
1484                       consequences.</p>
1485                     </td>
1486                   </tr>
1487                 </table>
1488               </div>
1489             </dd>
1490
1491             <dt>Example usage (section):</dt>
1492
1493             <dd>
1494               <table border="0" bgcolor="#E0E0E0" width="90%">
1495                 <tr>
1496                   <td>
1497                     <pre class="SCREEN">
1498 # Block the non-existent "Privacy-Violation:" client header
1499 { +crunch-client-header{Privacy-Violation:} }
1500 /
1501
1502 </pre>
1503                   </td>
1504                 </tr>
1505               </table>
1506             </dd>
1507           </dl>
1508         </div>
1509       </div>
1510
1511       <div class="SECT3">
1512         <h4 class="SECT3"><a name="CRUNCH-IF-NONE-MATCH" id=
1513         "CRUNCH-IF-NONE-MATCH">8.5.8. crunch-if-none-match</a></h4>
1514
1515         <div class="VARIABLELIST">
1516           <dl>
1517             <dt>Typical use:</dt>
1518
1519             <dd>
1520               <p>Prevent yet another way to track the user's steps between
1521               sessions.</p>
1522             </dd>
1523
1524             <dt>Effect:</dt>
1525
1526             <dd>
1527               <p>Deletes the <span class="QUOTE">"If-None-Match:"</span> HTTP
1528               client header.</p>
1529             </dd>
1530
1531             <dt>Type:</dt>
1532
1533             <dd>
1534               <p>Boolean.</p>
1535             </dd>
1536
1537             <dt>Parameter:</dt>
1538
1539             <dd>
1540               <p>N/A</p>
1541             </dd>
1542
1543             <dt>Notes:</dt>
1544
1545             <dd>
1546               <p>Removing the <span class="QUOTE">"If-None-Match:"</span>
1547               HTTP client header is useful for filter testing, where you want
1548               to force a real reload instead of getting status code
1549               <span class="QUOTE">"304"</span> which would cause the browser
1550               to use a cached copy of the page.</p>
1551
1552               <p>It is also useful to make sure the header isn't used as a
1553               cookie replacement (unlikely but possible).</p>
1554
1555               <p>Blocking the <span class="QUOTE">"If-None-Match:"</span>
1556               header shouldn't cause any caching problems, as long as the
1557               <span class="QUOTE">"If-Modified-Since:"</span> header isn't
1558               blocked or missing as well.</p>
1559
1560               <p>It is recommended to use this action together with
1561               <tt class="LITERAL"><a href=
1562               "actions-file.html#HIDE-IF-MODIFIED-SINCE">hide-if-modified-since</a></tt>
1563               and <tt class="LITERAL"><a href=
1564               "actions-file.html#OVERWRITE-LAST-MODIFIED">overwrite-last-modified</a></tt>.</p>
1565             </dd>
1566
1567             <dt>Example usage (section):</dt>
1568
1569             <dd>
1570               <table border="0" bgcolor="#E0E0E0" width="90%">
1571                 <tr>
1572                   <td>
1573                     <pre class="SCREEN">
1574 # Let the browser revalidate cached documents but don't
1575 # allow the server to use the revalidation headers for user tracking.
1576 {+hide-if-modified-since{-60} \
1577  +overwrite-last-modified{randomize} \
1578  +crunch-if-none-match}
1579 /
1580 </pre>
1581                   </td>
1582                 </tr>
1583               </table>
1584             </dd>
1585           </dl>
1586         </div>
1587       </div>
1588
1589       <div class="SECT3">
1590         <h4 class="SECT3"><a name="CRUNCH-INCOMING-COOKIES" id=
1591         "CRUNCH-INCOMING-COOKIES">8.5.9. crunch-incoming-cookies</a></h4>
1592
1593         <div class="VARIABLELIST">
1594           <dl>
1595             <dt>Typical use:</dt>
1596
1597             <dd>
1598               <p>Prevent the web server from setting HTTP cookies on your
1599               system</p>
1600             </dd>
1601
1602             <dt>Effect:</dt>
1603
1604             <dd>
1605               <p>Deletes any <span class="QUOTE">"Set-Cookie:"</span> HTTP
1606               headers from server replies.</p>
1607             </dd>
1608
1609             <dt>Type:</dt>
1610
1611             <dd>
1612               <p>Boolean.</p>
1613             </dd>
1614
1615             <dt>Parameter:</dt>
1616
1617             <dd>
1618               <p>N/A</p>
1619             </dd>
1620
1621             <dt>Notes:</dt>
1622
1623             <dd>
1624               <p>This action is only concerned with <span class=
1625               "emphasis"><i class="EMPHASIS">incoming</i></span> HTTP
1626               cookies. For <span class="emphasis"><i class=
1627               "EMPHASIS">outgoing</i></span> HTTP cookies, use <tt class=
1628               "LITERAL"><a href=
1629               "actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a></tt>.
1630               Use <span class="emphasis"><i class="EMPHASIS">both</i></span>
1631               to disable HTTP cookies completely.</p>
1632
1633               <p>It makes <span class="emphasis"><i class="EMPHASIS">no sense
1634               at all</i></span> to use this action in conjunction with the
1635               <tt class="LITERAL"><a href=
1636               "actions-file.html#SESSION-COOKIES-ONLY">session-cookies-only</a></tt>
1637               action, since it would prevent the session cookies from being
1638               set. See also <tt class="LITERAL"><a href=
1639               "actions-file.html#FILTER-CONTENT-COOKIES">filter-content-cookies</a></tt>.</p>
1640             </dd>
1641
1642             <dt>Example usage:</dt>
1643
1644             <dd>
1645               <table border="0" bgcolor="#E0E0E0" width="90%">
1646                 <tr>
1647                   <td>
1648                     <pre class="SCREEN">
1649 +crunch-incoming-cookies
1650 </pre>
1651                   </td>
1652                 </tr>
1653               </table>
1654             </dd>
1655           </dl>
1656         </div>
1657       </div>
1658
1659       <div class="SECT3">
1660         <h4 class="SECT3"><a name="CRUNCH-SERVER-HEADER" id=
1661         "CRUNCH-SERVER-HEADER">8.5.10. crunch-server-header</a></h4>
1662
1663         <div class="VARIABLELIST">
1664           <dl>
1665             <dt>Typical use:</dt>
1666
1667             <dd>
1668               <p>Remove a server header <span class=
1669               "APPLICATION">Privoxy</span> has no dedicated action for.</p>
1670             </dd>
1671
1672             <dt>Effect:</dt>
1673
1674             <dd>
1675               <p>Deletes every header sent by the server that contains the
1676               string the user supplied as parameter.</p>
1677             </dd>
1678
1679             <dt>Type:</dt>
1680
1681             <dd>
1682               <p>Parameterized.</p>
1683             </dd>
1684
1685             <dt>Parameter:</dt>
1686
1687             <dd>
1688               <p>Any string.</p>
1689             </dd>
1690
1691             <dt>Notes:</dt>
1692
1693             <dd>
1694               <p>This action allows you to block server headers for which no
1695               dedicated <span class="APPLICATION">Privoxy</span> action
1696               exists. <span class="APPLICATION">Privoxy</span> will remove
1697               every server header that contains the string you supplied as
1698               parameter.</p>
1699
1700               <p>Regular expressions are <span class="emphasis"><i class=
1701               "EMPHASIS">not supported</i></span> and you can't use this
1702               action to block different headers in the same request, unless
1703               they contain the same string.</p>
1704
1705               <p><tt class="LITERAL">crunch-server-header</tt> is only meant
1706               for quick tests. If you have to block several different
1707               headers, or only want to modify parts of them, you should use a
1708               custom <tt class="LITERAL"><a href=
1709               "actions-file.html#SERVER-HEADER-FILTER">server-header
1710               filter</a></tt>.</p>
1711
1712               <div class="WARNING">
1713                 <table class="WARNING" border="1" width="90%">
1714                   <tr>
1715                     <td align="center"><b>Warning</b></td>
1716                   </tr>
1717
1718                   <tr>
1719                     <td align="left">
1720                       <p>Don't block any header without understanding the
1721                       consequences.</p>
1722                     </td>
1723                   </tr>
1724                 </table>
1725               </div>
1726             </dd>
1727
1728             <dt>Example usage (section):</dt>
1729
1730             <dd>
1731               <table border="0" bgcolor="#E0E0E0" width="90%">
1732                 <tr>
1733                   <td>
1734                     <pre class="SCREEN">
1735 # Crunch server headers that try to prevent caching
1736 { +crunch-server-header{no-cache} }
1737 /
1738 </pre>
1739                   </td>
1740                 </tr>
1741               </table>
1742             </dd>
1743           </dl>
1744         </div>
1745       </div>
1746
1747       <div class="SECT3">
1748         <h4 class="SECT3"><a name="CRUNCH-OUTGOING-COOKIES" id=
1749         "CRUNCH-OUTGOING-COOKIES">8.5.11. crunch-outgoing-cookies</a></h4>
1750
1751         <div class="VARIABLELIST">
1752           <dl>
1753             <dt>Typical use:</dt>
1754
1755             <dd>
1756               <p>Prevent the web server from reading any HTTP cookies from
1757               your system</p>
1758             </dd>
1759
1760             <dt>Effect:</dt>
1761
1762             <dd>
1763               <p>Deletes any <span class="QUOTE">"Cookie:"</span> HTTP
1764               headers from client requests.</p>
1765             </dd>
1766
1767             <dt>Type:</dt>
1768
1769             <dd>
1770               <p>Boolean.</p>
1771             </dd>
1772
1773             <dt>Parameter:</dt>
1774
1775             <dd>
1776               <p>N/A</p>
1777             </dd>
1778
1779             <dt>Notes:</dt>
1780
1781             <dd>
1782               <p>This action is only concerned with <span class=
1783               "emphasis"><i class="EMPHASIS">outgoing</i></span> HTTP
1784               cookies. For <span class="emphasis"><i class=
1785               "EMPHASIS">incoming</i></span> HTTP cookies, use <tt class=
1786               "LITERAL"><a href=
1787               "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a></tt>.
1788               Use <span class="emphasis"><i class="EMPHASIS">both</i></span>
1789               to disable HTTP cookies completely.</p>
1790
1791               <p>It makes <span class="emphasis"><i class="EMPHASIS">no sense
1792               at all</i></span> to use this action in conjunction with the
1793               <tt class="LITERAL"><a href=
1794               "actions-file.html#SESSION-COOKIES-ONLY">session-cookies-only</a></tt>
1795               action, since it would prevent the session cookies from being
1796               read.</p>
1797             </dd>
1798
1799             <dt>Example usage:</dt>
1800
1801             <dd>
1802               <table border="0" bgcolor="#E0E0E0" width="90%">
1803                 <tr>
1804                   <td>
1805                     <pre class="SCREEN">
1806 +crunch-outgoing-cookies
1807 </pre>
1808                   </td>
1809                 </tr>
1810               </table>
1811             </dd>
1812           </dl>
1813         </div>
1814       </div>
1815
1816       <div class="SECT3">
1817         <h4 class="SECT3"><a name="DEANIMATE-GIFS" id=
1818         "DEANIMATE-GIFS">8.5.12. deanimate-gifs</a></h4>
1819
1820         <div class="VARIABLELIST">
1821           <dl>
1822             <dt>Typical use:</dt>
1823
1824             <dd>
1825               <p>Stop those annoying, distracting animated GIF images.</p>
1826             </dd>
1827
1828             <dt>Effect:</dt>
1829
1830             <dd>
1831               <p>De-animate GIF animations, i.e. reduce them to their first
1832               or last image.</p>
1833             </dd>
1834
1835             <dt>Type:</dt>
1836
1837             <dd>
1838               <p>Parameterized.</p>
1839             </dd>
1840
1841             <dt>Parameter:</dt>
1842
1843             <dd>
1844               <p><span class="QUOTE">"last"</span> or <span class=
1845               "QUOTE">"first"</span></p>
1846             </dd>
1847
1848             <dt>Notes:</dt>
1849
1850             <dd>
1851               <p>This will also shrink the images considerably (in bytes, not
1852               pixels!). If the option <span class="QUOTE">"first"</span> is
1853               given, the first frame of the animation is used as the
1854               replacement. If <span class="QUOTE">"last"</span> is given, the
1855               last frame of the animation is used instead, which probably
1856               makes more sense for most banner animations, but also has the
1857               risk of not showing the entire last frame (if it is only a
1858               delta to an earlier frame).</p>
1859
1860               <p>You can safely use this action with patterns that will also
1861               match non-GIF objects, because no attempt will be made at
1862               anything that doesn't look like a GIF.</p>
1863             </dd>
1864
1865             <dt>Example usage:</dt>
1866
1867             <dd>
1868               <table border="0" bgcolor="#E0E0E0" width="90%">
1869                 <tr>
1870                   <td>
1871                     <pre class="SCREEN">
1872 +deanimate-gifs{last}
1873 </pre>
1874                   </td>
1875                 </tr>
1876               </table>
1877             </dd>
1878           </dl>
1879         </div>
1880       </div>
1881
1882       <div class="SECT3">
1883         <h4 class="SECT3"><a name="DOWNGRADE-HTTP-VERSION" id=
1884         "DOWNGRADE-HTTP-VERSION">8.5.13. downgrade-http-version</a></h4>
1885
1886         <div class="VARIABLELIST">
1887           <dl>
1888             <dt>Typical use:</dt>
1889
1890             <dd>
1891               <p>Work around (very rare) problems with HTTP/1.1</p>
1892             </dd>
1893
1894             <dt>Effect:</dt>
1895
1896             <dd>
1897               <p>Downgrades HTTP/1.1 client requests and server replies to
1898               HTTP/1.0.</p>
1899             </dd>
1900
1901             <dt>Type:</dt>
1902
1903             <dd>
1904               <p>Boolean.</p>
1905             </dd>
1906
1907             <dt>Parameter:</dt>
1908
1909             <dd>
1910               <p>N/A</p>
1911             </dd>
1912
1913             <dt>Notes:</dt>
1914
1915             <dd>
1916               <p>This is a left-over from the time when <span class=
1917               "APPLICATION">Privoxy</span> didn't support important HTTP/1.1
1918               features well. It is left here for the unlikely case that you
1919               experience HTTP/1.1-related problems with some server out
1920               there.</p>
1921
1922               <p>Note that enabling this action is only a workaround. It
1923               should not be enabled for sites that work without it. While it
1924               shouldn't break any pages, it has an (usually negative)
1925               performance impact.</p>
1926
1927               <p>If you come across a site where enabling this action helps,
1928               please report it, so the cause of the problem can be analyzed.
1929               If the problem turns out to be caused by a bug in <span class=
1930               "APPLICATION">Privoxy</span> it should be fixed so the
1931               following release works without the work around.</p>
1932             </dd>
1933
1934             <dt>Example usage (section):</dt>
1935
1936             <dd>
1937               <table border="0" bgcolor="#E0E0E0" width="90%">
1938                 <tr>
1939                   <td>
1940                     <pre class="SCREEN">
1941 {+downgrade-http-version}
1942 problem-host.example.com
1943 </pre>
1944                   </td>
1945                 </tr>
1946               </table>
1947             </dd>
1948           </dl>
1949         </div>
1950       </div>
1951
1952       <div class="SECT3">
1953         <h4 class="SECT3"><a name="FAST-REDIRECTS" id=
1954         "FAST-REDIRECTS">8.5.14. fast-redirects</a></h4>
1955
1956         <div class="VARIABLELIST">
1957           <dl>
1958             <dt>Typical use:</dt>
1959
1960             <dd>
1961               <p>Fool some click-tracking scripts and speed up indirect
1962               links.</p>
1963             </dd>
1964
1965             <dt>Effect:</dt>
1966
1967             <dd>
1968               <p>Detects redirection URLs and redirects the browser without
1969               contacting the redirection server first.</p>
1970             </dd>
1971
1972             <dt>Type:</dt>
1973
1974             <dd>
1975               <p>Parameterized.</p>
1976             </dd>
1977
1978             <dt>Parameter:</dt>
1979
1980             <dd>
1981               <ul>
1982                 <li>
1983                   <p><span class="QUOTE">"simple-check"</span> to just search
1984                   for the string <span class="QUOTE">"http://"</span> to
1985                   detect redirection URLs.</p>
1986                 </li>
1987
1988                 <li>
1989                   <p><span class="QUOTE">"check-decoded-url"</span> to decode
1990                   URLs (if necessary) before searching for redirection
1991                   URLs.</p>
1992                 </li>
1993               </ul>
1994             </dd>
1995
1996             <dt>Notes:</dt>
1997
1998             <dd>
1999               <p>Many sites, like yahoo.com, don't just link to other sites.
2000               Instead, they will link to some script on their own servers,
2001               giving the destination as a parameter, which will then redirect
2002               you to the final target. URLs resulting from this scheme
2003               typically look like: <span class=
2004               "QUOTE">"http://www.example.org/click-tracker.cgi?target=http%3a//www.example.net/"</span>.</p>
2005
2006               <p>Sometimes, there are even multiple consecutive redirects
2007               encoded in the URL. These redirections via scripts make your
2008               web browsing more traceable, since the server from which you
2009               follow such a link can see where you go to. Apart from that,
2010               valuable bandwidth and time is wasted, while your browser asks
2011               the server for one redirect after the other. Plus, it feeds the
2012               advertisers.</p>
2013
2014               <p>This feature is currently not very smart and is scheduled
2015               for improvement. If it is enabled by default, you will have to
2016               create some exceptions to this action. It can lead to failures
2017               in several ways:</p>
2018
2019               <p>Not every URLs with other URLs as parameters is evil. Some
2020               sites offer a real service that requires this information to
2021               work. For example a validation service needs to know, which
2022               document to validate. <tt class="LITERAL">fast-redirects</tt>
2023               assumes that every URL parameter that looks like another URL is
2024               a redirection target, and will always redirect to the last one.
2025               Most of the time the assumption is correct, but if it isn't,
2026               the user gets redirected anyway.</p>
2027
2028               <p>Another failure occurs if the URL contains other parameters
2029               after the URL parameter. The URL: <span class=
2030               "QUOTE">"http://www.example.org/?redirect=http%3a//www.example.net/&amp;foo=bar"</span>.
2031               contains the redirection URL <span class=
2032               "QUOTE">"http://www.example.net/"</span>, followed by another
2033               parameter. <tt class="LITERAL">fast-redirects</tt> doesn't know
2034               that and will cause a redirect to <span class=
2035               "QUOTE">"http://www.example.net/&amp;foo=bar"</span>. Depending
2036               on the target server configuration, the parameter will be
2037               silently ignored or lead to a <span class="QUOTE">"page not
2038               found"</span> error. You can prevent this problem by first
2039               using the <tt class="LITERAL"><a href=
2040               "actions-file.html#REDIRECT">redirect</a></tt> action to remove
2041               the last part of the URL, but it requires a little effort.</p>
2042
2043               <p>To detect a redirection URL, <tt class=
2044               "LITERAL">fast-redirects</tt> only looks for the string
2045               <span class="QUOTE">"http://"</span>, either in plain text
2046               (invalid but often used) or encoded as <span class=
2047               "QUOTE">"http%3a//"</span>. Some sites use their own URL
2048               encoding scheme, encrypt the address of the target server or
2049               replace it with a database id. In theses cases <tt class=
2050               "LITERAL">fast-redirects</tt> is fooled and the request reaches
2051               the redirection server where it probably gets logged.</p>
2052             </dd>
2053
2054             <dt>Example usage:</dt>
2055
2056             <dd>
2057               <table border="0" bgcolor="#E0E0E0" width="90%">
2058                 <tr>
2059                   <td>
2060                     <pre class="SCREEN">
2061  { +fast-redirects{simple-check} }
2062    one.example.com
2063
2064  { +fast-redirects{check-decoded-url} }
2065    another.example.com/testing
2066 </pre>
2067                   </td>
2068                 </tr>
2069               </table>
2070             </dd>
2071           </dl>
2072         </div>
2073       </div>
2074
2075       <div class="SECT3">
2076         <h4 class="SECT3"><a name="FILTER" id="FILTER">8.5.15.
2077         filter</a></h4>
2078
2079         <div class="VARIABLELIST">
2080           <dl>
2081             <dt>Typical use:</dt>
2082
2083             <dd>
2084               <p>Get rid of HTML and JavaScript annoyances, banner
2085               advertisements (by size), do fun text replacements, add
2086               personalized effects, etc.</p>
2087             </dd>
2088
2089             <dt>Effect:</dt>
2090
2091             <dd>
2092               <p>All instances of text-based type, most notably HTML and
2093               JavaScript, to which this action applies, can be filtered
2094               on-the-fly through the specified regular expression based
2095               substitutions. (Note: as of version 3.0.3 plain text documents
2096               are exempted from filtering, because web servers often use the
2097               <tt class="LITERAL">text/plain</tt> MIME type for all files
2098               whose type they don't know.)</p>
2099             </dd>
2100
2101             <dt>Type:</dt>
2102
2103             <dd>
2104               <p>Parameterized.</p>
2105             </dd>
2106
2107             <dt>Parameter:</dt>
2108
2109             <dd>
2110               <p>The name of a content filter, as defined in the <a href=
2111               "filter-file.html">filter file</a>. Filters can be defined in
2112               one or more files as defined by the <tt class=
2113               "LITERAL"><a href="config.html#FILTERFILE">filterfile</a></tt>
2114               option in the <a href="config.html">config file</a>. <tt class=
2115               "FILENAME">default.filter</tt> is the collection of filters
2116               supplied by the developers. Locally defined filters should go
2117               in their own file, such as <tt class=
2118               "FILENAME">user.filter</tt>.</p>
2119
2120               <p>When used in its negative form, and without parameters,
2121               <span class="emphasis"><i class="EMPHASIS">all</i></span>
2122               filtering is completely disabled.</p>
2123             </dd>
2124
2125             <dt>Notes:</dt>
2126
2127             <dd>
2128               <p>For your convenience, there are a number of pre-defined
2129               filters available in the distribution filter file that you can
2130               use. See the examples below for a list.</p>
2131
2132               <p>Filtering requires buffering the page content, which may
2133               appear to slow down page rendering since nothing is displayed
2134               until all content has passed the filters. (The total time until
2135               the page is completely rendered doesn't change much, but it may
2136               be perceived as slower since the page is not incrementally
2137               displayed.) This effect will be more noticeable on slower
2138               connections.</p>
2139
2140               <p><span class="QUOTE">"Rolling your own"</span> filters
2141               requires a knowledge of <a href=
2142               "http://en.wikipedia.org/wiki/Regular_expressions" target=
2143               "_top"><span class="QUOTE">"Regular Expressions"</span></a> and
2144               <a href="http://en.wikipedia.org/wiki/Html" target=
2145               "_top"><span class="QUOTE">"HTML"</span></a>. This is very
2146               powerful feature, and potentially very intrusive. Filters
2147               should be used with caution, and where an equivalent
2148               <span class="QUOTE">"action"</span> is not available.</p>
2149
2150               <p>The amount of data that can be filtered is limited to the
2151               <tt class="LITERAL"><a href=
2152               "config.html#BUFFER-LIMIT">buffer-limit</a></tt> option in the
2153               main <a href="config.html">config file</a>. The default is 4096
2154               KB (4 Megs). Once this limit is exceeded, the buffered data,
2155               and all pending data, is passed through unfiltered.</p>
2156
2157               <p>Inappropriate MIME types, such as zipped files, are not
2158               filtered at all. (Again, only text-based types except plain
2159               text). Encrypted SSL data (from HTTPS servers) cannot be
2160               filtered either, since this would violate the integrity of the
2161               secure transaction. In some situations it might be necessary to
2162               protect certain text, like source code, from filtering by
2163               defining appropriate <tt class="LITERAL">-filter</tt>
2164               exceptions.</p>
2165
2166               <p>Compressed content can't be filtered either, but if
2167               <span class="APPLICATION">Privoxy</span> is compiled with zlib
2168               support and a supported compression algorithm is used (gzip or
2169               deflate), <span class="APPLICATION">Privoxy</span> can first
2170               decompress the content and then filter it.</p>
2171
2172               <p>If you use a <span class="APPLICATION">Privoxy</span>
2173               version without zlib support, but want filtering to work on as
2174               much documents as possible, even those that would normally be
2175               sent compressed, you must use the <tt class="LITERAL"><a href=
2176               "actions-file.html#PREVENT-COMPRESSION">prevent-compression</a></tt>
2177               action in conjunction with <tt class="LITERAL">filter</tt>.</p>
2178
2179               <p>Content filtering can achieve some of the same effects as
2180               the <tt class="LITERAL"><a href=
2181               "actions-file.html#BLOCK">block</a></tt> action, i.e. it can be
2182               used to block ads and banners. But the mechanism works quite
2183               differently. One effective use, is to block ad banners based on
2184               their size (see below), since many of these seem to be somewhat
2185               standardized.</p>
2186
2187               <p><a href="contact.html">Feedback</a> with suggestions for new
2188               or improved filters is particularly welcome!</p>
2189
2190               <p>The below list has only the names and a one-line description
2191               of each predefined filter. There are <a href=
2192               "filter-file.html#PREDEFINED-FILTERS">more verbose
2193               explanations</a> of what these filters do in the <a href=
2194               "filter-file.html">filter file chapter</a>.</p>
2195             </dd>
2196
2197             <dt>Example usage (with filters from the distribution <tt class=
2198             "FILENAME">default.filter</tt> file). See <a href=
2199             "filter-file.html#PREDEFINED-FILTERS">the Predefined Filters
2200             section</a> for more explanation on each:</dt>
2201
2202             <dd>
2203               <p><a name="FILTER-JS-ANNOYANCES" id=
2204               "FILTER-JS-ANNOYANCES"></a></p>
2205
2206               <table border="0" bgcolor="#E0E0E0" width="90%">
2207                 <tr>
2208                   <td>
2209                     <pre class="SCREEN">
2210 +filter{js-annoyances}       # Get rid of particularly annoying JavaScript abuse.
2211 </pre>
2212                   </td>
2213                 </tr>
2214               </table>
2215
2216               <p><a name="FILTER-JS-EVENTS" id="FILTER-JS-EVENTS"></a></p>
2217
2218               <table border="0" bgcolor="#E0E0E0" width="90%">
2219                 <tr>
2220                   <td>
2221                     <pre class="SCREEN">
2222 +filter{js-events}           # Kill all JS event bindings and timers (Radically destructive! Only for extra nasty sites).
2223 </pre>
2224                   </td>
2225                 </tr>
2226               </table>
2227
2228               <p><a name="FILTER-HTML-ANNOYANCES" id=
2229               "FILTER-HTML-ANNOYANCES"></a></p>
2230
2231               <table border="0" bgcolor="#E0E0E0" width="90%">
2232                 <tr>
2233                   <td>
2234                     <pre class="SCREEN">
2235 +filter{html-annoyances}     # Get rid of particularly annoying HTML abuse.
2236 </pre>
2237                   </td>
2238                 </tr>
2239               </table>
2240
2241               <p><a name="FILTER-CONTENT-COOKIES" id=
2242               "FILTER-CONTENT-COOKIES"></a></p>
2243
2244               <table border="0" bgcolor="#E0E0E0" width="90%">
2245                 <tr>
2246                   <td>
2247                     <pre class="SCREEN">
2248 +filter{content-cookies}     # Kill cookies that come in the HTML or JS content.
2249 </pre>
2250                   </td>
2251                 </tr>
2252               </table>
2253
2254               <p><a name="FILTER-REFRESH-TAGS" id=
2255               "FILTER-REFRESH-TAGS"></a></p>
2256
2257               <table border="0" bgcolor="#E0E0E0" width="90%">
2258                 <tr>
2259                   <td>
2260                     <pre class="SCREEN">
2261 +filter{refresh-tags}        # Kill automatic refresh tags (for dial-on-demand setups).
2262 </pre>
2263                   </td>
2264                 </tr>
2265               </table>
2266
2267               <p><a name="FILTER-UNSOLICITED-POPUPS" id=
2268               "FILTER-UNSOLICITED-POPUPS"></a></p>
2269
2270               <table border="0" bgcolor="#E0E0E0" width="90%">
2271                 <tr>
2272                   <td>
2273                     <pre class="SCREEN">
2274 +filter{unsolicited-popups}  # Disable only unsolicited pop-up windows. Useful if your browser lacks this ability.
2275 </pre>
2276                   </td>
2277                 </tr>
2278               </table>
2279
2280               <p><a name="FILTER-ALL-POPUPS" id="FILTER-ALL-POPUPS"></a></p>
2281
2282               <table border="0" bgcolor="#E0E0E0" width="90%">
2283                 <tr>
2284                   <td>
2285                     <pre class="SCREEN">
2286 +filter{all-popups}          # Kill all popups in JavaScript and HTML. Useful if your browser lacks this ability.
2287 </pre>
2288                   </td>
2289                 </tr>
2290               </table>
2291
2292               <p><a name="FILTER-IMG-REORDER" id=
2293               "FILTER-IMG-REORDER"></a></p>
2294
2295               <table border="0" bgcolor="#E0E0E0" width="90%">
2296                 <tr>
2297                   <td>
2298                     <pre class="SCREEN">
2299 +filter{img-reorder}         # Reorder attributes in &lt;img&gt; tags to make the banners-by-* filters more effective.
2300 </pre>
2301                   </td>
2302                 </tr>
2303               </table>
2304
2305               <p><a name="FILTER-BANNERS-BY-SIZE" id=
2306               "FILTER-BANNERS-BY-SIZE"></a></p>
2307
2308               <table border="0" bgcolor="#E0E0E0" width="90%">
2309                 <tr>
2310                   <td>
2311                     <pre class="SCREEN">
2312 +filter{banners-by-size}     # Kill banners by size.
2313 </pre>
2314                   </td>
2315                 </tr>
2316               </table>
2317
2318               <p><a name="FILTER-BANNERS-BY-LINK" id=
2319               "FILTER-BANNERS-BY-LINK"></a></p>
2320
2321               <table border="0" bgcolor="#E0E0E0" width="90%">
2322                 <tr>
2323                   <td>
2324                     <pre class="SCREEN">
2325 +filter{banners-by-link}     # Kill banners by their links to known clicktrackers.
2326 </pre>
2327                   </td>
2328                 </tr>
2329               </table>
2330
2331               <p><a name="FILTER-WEBBUGS" id="FILTER-WEBBUGS"></a></p>
2332
2333               <table border="0" bgcolor="#E0E0E0" width="90%">
2334                 <tr>
2335                   <td>
2336                     <pre class="SCREEN">
2337 +filter{webbugs}             # Squish WebBugs (1x1 invisible GIFs used for user tracking).
2338 </pre>
2339                   </td>
2340                 </tr>
2341               </table>
2342
2343               <p><a name="FILTER-TINY-TEXTFORMS" id=
2344               "FILTER-TINY-TEXTFORMS"></a></p>
2345
2346               <table border="0" bgcolor="#E0E0E0" width="90%">
2347                 <tr>
2348                   <td>
2349                     <pre class="SCREEN">
2350 +filter{tiny-textforms}      # Extend those tiny textareas up to 40x80 and kill the hard wrap.
2351 </pre>
2352                   </td>
2353                 </tr>
2354               </table>
2355
2356               <p><a name="FILTER-JUMPING-WINDOWS" id=
2357               "FILTER-JUMPING-WINDOWS"></a></p>
2358
2359               <table border="0" bgcolor="#E0E0E0" width="90%">
2360                 <tr>
2361                   <td>
2362                     <pre class="SCREEN">
2363 +filter{jumping-windows}     # Prevent windows from resizing and moving themselves.
2364 </pre>
2365                   </td>
2366                 </tr>
2367               </table>
2368
2369               <p><a name="FILTER-FRAMESET-BORDERS" id=
2370               "FILTER-FRAMESET-BORDERS"></a></p>
2371
2372               <table border="0" bgcolor="#E0E0E0" width="90%">
2373                 <tr>
2374                   <td>
2375                     <pre class="SCREEN">
2376 +filter{frameset-borders}    # Give frames a border and make them resizable.
2377 </pre>
2378                   </td>
2379                 </tr>
2380               </table>
2381
2382               <p><a name="FILTER-DEMORONIZER" id=
2383               "FILTER-DEMORONIZER"></a></p>
2384
2385               <table border="0" bgcolor="#E0E0E0" width="90%">
2386                 <tr>
2387                   <td>
2388                     <pre class="SCREEN">
2389 +filter{demoronizer}         # Fix MS's non-standard use of standard charsets.
2390 </pre>
2391                   </td>
2392                 </tr>
2393               </table>
2394
2395               <p><a name="FILTER-SHOCKWAVE-FLASH" id=
2396               "FILTER-SHOCKWAVE-FLASH"></a></p>
2397
2398               <table border="0" bgcolor="#E0E0E0" width="90%">
2399                 <tr>
2400                   <td>
2401                     <pre class="SCREEN">
2402 +filter{shockwave-flash}     # Kill embedded Shockwave Flash objects.
2403 </pre>
2404                   </td>
2405                 </tr>
2406               </table>
2407
2408               <p><a name="FILTER-QUICKTIME-KIOSKMODE" id=
2409               "FILTER-QUICKTIME-KIOSKMODE"></a></p>
2410
2411               <table border="0" bgcolor="#E0E0E0" width="90%">
2412                 <tr>
2413                   <td>
2414                     <pre class="SCREEN">
2415 +filter{quicktime-kioskmode} # Make Quicktime movies saveable.
2416 </pre>
2417                   </td>
2418                 </tr>
2419               </table>
2420
2421               <p><a name="FILTER-FUN" id="FILTER-FUN"></a></p>
2422
2423               <table border="0" bgcolor="#E0E0E0" width="90%">
2424                 <tr>
2425                   <td>
2426                     <pre class="SCREEN">
2427 +filter{fun}                 # Text replacements for subversive browsing fun!
2428 </pre>
2429                   </td>
2430                 </tr>
2431               </table>
2432
2433               <p><a name="FILTER-CRUDE-PARENTAL" id=
2434               "FILTER-CRUDE-PARENTAL"></a></p>
2435
2436               <table border="0" bgcolor="#E0E0E0" width="90%">
2437                 <tr>
2438                   <td>
2439                     <pre class="SCREEN">
2440 +filter{crude-parental}      # Crude parental filtering. Note that this filter doesn't work reliably.
2441 </pre>
2442                   </td>
2443                 </tr>
2444               </table>
2445
2446               <p><a name="FILTER-IE-EXPLOITS" id=
2447               "FILTER-IE-EXPLOITS"></a></p>
2448
2449               <table border="0" bgcolor="#E0E0E0" width="90%">
2450                 <tr>
2451                   <td>
2452                     <pre class="SCREEN">
2453 +filter{ie-exploits}         # Disable some known Internet Explorer bug exploits.
2454 </pre>
2455                   </td>
2456                 </tr>
2457               </table>
2458
2459               <p><a name="FILTER-SITE-SPECIFICS" id=
2460               "FILTER-SITE-SPECIFICS"></a></p>
2461
2462               <table border="0" bgcolor="#E0E0E0" width="90%">
2463                 <tr>
2464                   <td>
2465                     <pre class="SCREEN">
2466 +filter{site-specifics}      # Cure for site-specific problems. Don't apply generally!
2467 </pre>
2468                   </td>
2469                 </tr>
2470               </table>
2471
2472               <p><a name="FILTER-NO-PING" id="FILTER-NO-PING"></a></p>
2473
2474               <table border="0" bgcolor="#E0E0E0" width="90%">
2475                 <tr>
2476                   <td>
2477                     <pre class="SCREEN">
2478 +filter{no-ping}             # Removes non-standard ping attributes in &lt;a&gt; and &lt;area&gt; tags.
2479 </pre>
2480                   </td>
2481                 </tr>
2482               </table>
2483
2484               <p><a name="FILTER-GOOGLE" id="FILTER-GOOGLE"></a></p>
2485
2486               <table border="0" bgcolor="#E0E0E0" width="90%">
2487                 <tr>
2488                   <td>
2489                     <pre class="SCREEN">
2490 +filter{google}              # CSS-based block for Google text ads. Also removes a width limitation and the toolbar advertisement.
2491 </pre>
2492                   </td>
2493                 </tr>
2494               </table>
2495
2496               <p><a name="FILTER-YAHOO" id="FILTER-YAHOO"></a></p>
2497
2498               <table border="0" bgcolor="#E0E0E0" width="90%">
2499                 <tr>
2500                   <td>
2501                     <pre class="SCREEN">
2502 +filter{yahoo}               # CSS-based block for Yahoo text ads. Also removes a width limitation.
2503 </pre>
2504                   </td>
2505                 </tr>
2506               </table>
2507
2508               <p><a name="FILTER-MSN" id="FILTER-MSN"></a></p>
2509
2510               <table border="0" bgcolor="#E0E0E0" width="90%">
2511                 <tr>
2512                   <td>
2513                     <pre class="SCREEN">
2514 +filter{msn}                 # CSS-based block for MSN text ads. Also removes tracking URLs and a width limitation.
2515 </pre>
2516                   </td>
2517                 </tr>
2518               </table>
2519
2520               <p><a name="FILTER-BLOGSPOT" id="FILTER-BLOGSPOT"></a></p>
2521
2522               <table border="0" bgcolor="#E0E0E0" width="90%">
2523                 <tr>
2524                   <td>
2525                     <pre class="SCREEN">
2526 +filter{blogspot}            # Cleans up some Blogspot blogs. Read the fine print before using this.
2527 </pre>
2528                   </td>
2529                 </tr>
2530               </table>
2531             </dd>
2532           </dl>
2533         </div>
2534       </div>
2535
2536       <div class="SECT3">
2537         <h4 class="SECT3"><a name="FORCE-TEXT-MODE" id=
2538         "FORCE-TEXT-MODE">8.5.16. force-text-mode</a></h4>
2539
2540         <div class="VARIABLELIST">
2541           <dl>
2542             <dt>Typical use:</dt>
2543
2544             <dd>
2545               <p>Force <span class="APPLICATION">Privoxy</span> to treat a
2546               document as if it was in some kind of <span class=
2547               "emphasis"><i class="EMPHASIS">text</i></span> format.</p>
2548             </dd>
2549
2550             <dt>Effect:</dt>
2551
2552             <dd>
2553               <p>Declares a document as text, even if the <span class=
2554               "QUOTE">"Content-Type:"</span> isn't detected as such.</p>
2555             </dd>
2556
2557             <dt>Type:</dt>
2558
2559             <dd>
2560               <p>Boolean.</p>
2561             </dd>
2562
2563             <dt>Parameter:</dt>
2564
2565             <dd>
2566               <p>N/A</p>
2567             </dd>
2568
2569             <dt>Notes:</dt>
2570
2571             <dd>
2572               <p>As explained <tt class="LITERAL"><a href=
2573               "actions-file.html#FILTER">above</a></tt>, <span class=
2574               "APPLICATION">Privoxy</span> tries to only filter files that
2575               are in some kind of text format. The same restrictions apply to
2576               <tt class="LITERAL"><a href=
2577               "actions-file.html#CONTENT-TYPE-OVERWRITE">content-type-overwrite</a></tt>.
2578               <tt class="LITERAL">force-text-mode</tt> declares a document as
2579               text, without looking at the <span class=
2580               "QUOTE">"Content-Type:"</span> first.</p>
2581
2582               <div class="WARNING">
2583                 <table class="WARNING" border="1" width="90%">
2584                   <tr>
2585                     <td align="center"><b>Warning</b></td>
2586                   </tr>
2587
2588                   <tr>
2589                     <td align="left">
2590                       <p>Think twice before activating this action. Filtering
2591                       binary data with regular expressions can cause file
2592                       damage.</p>
2593                     </td>
2594                   </tr>
2595                 </table>
2596               </div>
2597             </dd>
2598
2599             <dt>Example usage:</dt>
2600
2601             <dd>
2602               <table border="0" bgcolor="#E0E0E0" width="90%">
2603                 <tr>
2604                   <td>
2605                     <pre class="SCREEN">
2606 +force-text-mode
2607
2608 </pre>
2609                   </td>
2610                 </tr>
2611               </table>
2612             </dd>
2613           </dl>
2614         </div>
2615       </div>
2616
2617       <div class="SECT3">
2618         <h4 class="SECT3"><a name="FORWARD-OVERRIDE" id=
2619         "FORWARD-OVERRIDE">8.5.17. forward-override</a></h4>
2620
2621         <div class="VARIABLELIST">
2622           <dl>
2623             <dt>Typical use:</dt>
2624
2625             <dd>
2626               <p>Change the forwarding settings based on User-Agent or
2627               request origin</p>
2628             </dd>
2629
2630             <dt>Effect:</dt>
2631
2632             <dd>
2633               <p>Overrules the forward directives in the configuration
2634               file.</p>
2635             </dd>
2636
2637             <dt>Type:</dt>
2638
2639             <dd>
2640               <p>Multi-value.</p>
2641             </dd>
2642
2643             <dt>Parameter:</dt>
2644
2645             <dd>
2646               <ul>
2647                 <li>
2648                   <p><span class="QUOTE">"forward ."</span> to use a direct
2649                   connection without any additional proxies.</p>
2650                 </li>
2651
2652                 <li>
2653                   <p><span class="QUOTE">"forward 127.0.0.1:8123"</span> to
2654                   use the HTTP proxy listening at 127.0.0.1 port 8123.</p>
2655                 </li>
2656
2657                 <li>
2658                   <p><span class="QUOTE">"forward-socks4a 127.0.0.1:9050
2659                   ."</span> to use the socks4a proxy listening at 127.0.0.1
2660                   port 9050. Replace <span class=
2661                   "QUOTE">"forward-socks4a"</span> with <span class=
2662                   "QUOTE">"forward-socks4"</span> to use a socks4 connection
2663                   (with local DNS resolution) instead, use <span class=
2664                   "QUOTE">"forward-socks5"</span> for socks5 connections
2665                   (with remote DNS resolution).</p>
2666                 </li>
2667
2668                 <li>
2669                   <p><span class="QUOTE">"forward-socks4a 127.0.0.1:9050
2670                   proxy.example.org:8000"</span> to use the socks4a proxy
2671                   listening at 127.0.0.1 port 9050 to reach the HTTP proxy
2672                   listening at proxy.example.org port 8000. Replace
2673                   <span class="QUOTE">"forward-socks4a"</span> with
2674                   <span class="QUOTE">"forward-socks4"</span> to use a socks4
2675                   connection (with local DNS resolution) instead, use
2676                   <span class="QUOTE">"forward-socks5"</span> for socks5
2677                   connections (with remote DNS resolution).</p>
2678                 </li>
2679               </ul>
2680             </dd>
2681
2682             <dt>Notes:</dt>
2683
2684             <dd>
2685               <p>This action takes parameters similar to the <a href=
2686               "config.html#FORWARDING">forward</a> directives in the
2687               configuration file, but without the URL pattern. It can be used
2688               as replacement, but normally it's only used in cases where
2689               matching based on the request URL isn't sufficient.</p>
2690
2691               <div class="WARNING">
2692                 <table class="WARNING" border="1" width="90%">
2693                   <tr>
2694                     <td align="center"><b>Warning</b></td>
2695                   </tr>
2696
2697                   <tr>
2698                     <td align="left">
2699                       <p>Please read the description for the <a href=
2700                       "config.html#FORWARDING">forward</a> directives before
2701                       using this action. Forwarding to the wrong people will
2702                       reduce your privacy and increase the chances of
2703                       man-in-the-middle attacks.</p>
2704
2705                       <p>If the ports are missing or invalid, default values
2706                       will be used. This might change in the future and you
2707                       shouldn't rely on it. Otherwise incorrect syntax causes
2708                       Privoxy to exit.</p>
2709
2710                       <p>Use the <a href=
2711                       "http://config.privoxy.org/show-url-info" target=
2712                       "_top">show-url-info CGI page</a> to verify that your
2713                       forward settings do what you thought the do.</p>
2714                     </td>
2715                   </tr>
2716                 </table>
2717               </div>
2718             </dd>
2719
2720             <dt>Example usage:</dt>
2721
2722             <dd>
2723               <table border="0" bgcolor="#E0E0E0" width="90%">
2724                 <tr>
2725                   <td>
2726                     <pre class="SCREEN">
2727 # Always use direct connections for requests previously tagged as
2728 # <span class="QUOTE">"User-Agent: fetch libfetch/2.0"</span> and make sure
2729 # resuming downloads continues to work.
2730 # This way you can continue to use Tor for your normal browsing,
2731 # without overloading the Tor network with your FreeBSD ports updates
2732 # or downloads of bigger files like ISOs.
2733 # Note that HTTP headers are easy to fake and therefore their
2734 # values are as (un)trustworthy as your clients and users.
2735 {+forward-override{forward .} \
2736  -hide-if-modified-since      \
2737  -overwrite-last-modified     \
2738 }
2739 TAG:^User-Agent: fetch libfetch/2\.0$
2740
2741 </pre>
2742                   </td>
2743                 </tr>
2744               </table>
2745             </dd>
2746           </dl>
2747         </div>
2748       </div>
2749
2750       <div class="SECT3">
2751         <h4 class="SECT3"><a name="HANDLE-AS-EMPTY-DOCUMENT" id=
2752         "HANDLE-AS-EMPTY-DOCUMENT">8.5.18. handle-as-empty-document</a></h4>
2753
2754         <div class="VARIABLELIST">
2755           <dl>
2756             <dt>Typical use:</dt>
2757
2758             <dd>
2759               <p>Mark URLs that should be replaced by empty documents
2760               <span class="emphasis"><i class="EMPHASIS">if they get
2761               blocked</i></span></p>
2762             </dd>
2763
2764             <dt>Effect:</dt>
2765
2766             <dd>
2767               <p>This action alone doesn't do anything noticeable. It just
2768               marks URLs. If the <tt class="LITERAL"><a href=
2769               "actions-file.html#BLOCK">block</a></tt> action <span class=
2770               "emphasis"><i class="EMPHASIS">also applies</i></span>, the
2771               presence or absence of this mark decides whether an HTML
2772               <span class="QUOTE">"BLOCKED"</span> page, or an empty document
2773               will be sent to the client as a substitute for the blocked
2774               content. The <span class="emphasis"><i class=
2775               "EMPHASIS">empty</i></span> document isn't literally empty, but
2776               actually contains a single space.</p>
2777             </dd>
2778
2779             <dt>Type:</dt>
2780
2781             <dd>
2782               <p>Boolean.</p>
2783             </dd>
2784
2785             <dt>Parameter:</dt>
2786
2787             <dd>
2788               <p>N/A</p>
2789             </dd>
2790
2791             <dt>Notes:</dt>
2792
2793             <dd>
2794               <p>Some browsers complain about syntax errors if JavaScript
2795               documents are blocked with <span class=
2796               "APPLICATION">Privoxy's</span> default HTML page; this option
2797               can be used to silence them. And of course this action can also
2798               be used to eliminate the <span class=
2799               "APPLICATION">Privoxy</span> BLOCKED message in frames.</p>
2800
2801               <p>The content type for the empty document can be specified
2802               with <tt class="LITERAL"><a href=
2803               "actions-file.html#CONTENT-TYPE-OVERWRITE">content-type-overwrite{}</a></tt>,
2804               but usually this isn't necessary.</p>
2805             </dd>
2806
2807             <dt>Example usage:</dt>
2808
2809             <dd>
2810               <table border="0" bgcolor="#E0E0E0" width="90%">
2811                 <tr>
2812                   <td>
2813                     <pre class="SCREEN">
2814 # Block all documents on example.org that end with ".js",
2815 # but send an empty document instead of the usual HTML message.
2816 {+block{Blocked JavaScript} +handle-as-empty-document}
2817 example.org/.*\.js$
2818
2819 </pre>
2820                   </td>
2821                 </tr>
2822               </table>
2823             </dd>
2824           </dl>
2825         </div>
2826       </div>
2827
2828       <div class="SECT3">
2829         <h4 class="SECT3"><a name="HANDLE-AS-IMAGE" id=
2830         "HANDLE-AS-IMAGE">8.5.19. handle-as-image</a></h4>
2831
2832         <div class="VARIABLELIST">
2833           <dl>
2834             <dt>Typical use:</dt>
2835
2836             <dd>
2837               <p>Mark URLs as belonging to images (so they'll be replaced by
2838               images <span class="emphasis"><i class="EMPHASIS">if they do
2839               get blocked</i></span>, rather than HTML pages)</p>
2840             </dd>
2841
2842             <dt>Effect:</dt>
2843
2844             <dd>
2845               <p>This action alone doesn't do anything noticeable. It just
2846               marks URLs as images. If the <tt class="LITERAL"><a href=
2847               "actions-file.html#BLOCK">block</a></tt> action <span class=
2848               "emphasis"><i class="EMPHASIS">also applies</i></span>, the
2849               presence or absence of this mark decides whether an HTML
2850               <span class="QUOTE">"blocked"</span> page, or a replacement
2851               image (as determined by the <tt class="LITERAL"><a href=
2852               "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a></tt>
2853               action) will be sent to the client as a substitute for the
2854               blocked content.</p>
2855             </dd>
2856
2857             <dt>Type:</dt>
2858
2859             <dd>
2860               <p>Boolean.</p>
2861             </dd>
2862
2863             <dt>Parameter:</dt>
2864
2865             <dd>
2866               <p>N/A</p>
2867             </dd>
2868
2869             <dt>Notes:</dt>
2870
2871             <dd>
2872               <p>The below generic example section is actually part of
2873               <tt class="FILENAME">default.action</tt>. It marks all URLs
2874               with well-known image file name extensions as images and should
2875               be left intact.</p>
2876
2877               <p>Users will probably only want to use the handle-as-image
2878               action in conjunction with <tt class="LITERAL"><a href=
2879               "actions-file.html#BLOCK">block</a></tt>, to block sources of
2880               banners, whose URLs don't reflect the file type, like in the
2881               second example section.</p>
2882
2883               <p>Note that you cannot treat HTML pages as images in most
2884               cases. For instance, (in-line) ad frames require an HTML page
2885               to be sent, or they won't display properly. Forcing <tt class=
2886               "LITERAL">handle-as-image</tt> in this situation will not
2887               replace the ad frame with an image, but lead to error
2888               messages.</p>
2889             </dd>
2890
2891             <dt>Example usage (sections):</dt>
2892
2893             <dd>
2894               <table border="0" bgcolor="#E0E0E0" width="90%">
2895                 <tr>
2896                   <td>
2897                     <pre class="SCREEN">
2898 # Generic image extensions:
2899 #
2900 {+handle-as-image}
2901 /.*\.(gif|jpg|jpeg|png|bmp|ico)$
2902
2903 # These don't look like images, but they're banners and should be
2904 # blocked as images:
2905 #
2906 {+block{Nasty banners.} +handle-as-image}
2907 nasty-banner-server.example.com/junk.cgi\?output=trash
2908 </pre>
2909                   </td>
2910                 </tr>
2911               </table>
2912             </dd>
2913           </dl>
2914         </div>
2915       </div>
2916
2917       <div class="SECT3">
2918         <h4 class="SECT3"><a name="HIDE-ACCEPT-LANGUAGE" id=
2919         "HIDE-ACCEPT-LANGUAGE">8.5.20. hide-accept-language</a></h4>
2920
2921         <div class="VARIABLELIST">
2922           <dl>
2923             <dt>Typical use:</dt>
2924
2925             <dd>
2926               <p>Pretend to use different language settings.</p>
2927             </dd>
2928
2929             <dt>Effect:</dt>
2930
2931             <dd>
2932               <p>Deletes or replaces the <span class=
2933               "QUOTE">"Accept-Language:"</span> HTTP header in client
2934               requests.</p>
2935             </dd>
2936
2937             <dt>Type:</dt>
2938
2939             <dd>
2940               <p>Parameterized.</p>
2941             </dd>
2942
2943             <dt>Parameter:</dt>
2944
2945             <dd>
2946               <p>Keyword: <span class="QUOTE">"block"</span>, or any user
2947               defined value.</p>
2948             </dd>
2949
2950             <dt>Notes:</dt>
2951
2952             <dd>
2953               <p>Faking the browser's language settings can be useful to make
2954               a foreign User-Agent set with <tt class="LITERAL"><a href=
2955               "actions-file.html#HIDE-USER-AGENT">hide-user-agent</a></tt>
2956               more believable.</p>
2957
2958               <p>However some sites with content in different languages check
2959               the <span class="QUOTE">"Accept-Language:"</span> to decide
2960               which one to take by default. Sometimes it isn't possible to
2961               later switch to another language without changing the
2962               <span class="QUOTE">"Accept-Language:"</span> header first.</p>
2963
2964               <p>Therefore it's a good idea to either only change the
2965               <span class="QUOTE">"Accept-Language:"</span> header to
2966               languages you understand, or to languages that aren't wide
2967               spread.</p>
2968
2969               <p>Before setting the <span class=
2970               "QUOTE">"Accept-Language:"</span> header to a rare language,
2971               you should consider that it helps to make your requests unique
2972               and thus easier to trace. If you don't plan to change this
2973               header frequently, you should stick to a common language.</p>
2974             </dd>
2975
2976             <dt>Example usage (section):</dt>
2977
2978             <dd>
2979               <table border="0" bgcolor="#E0E0E0" width="90%">
2980                 <tr>
2981                   <td>
2982                     <pre class="SCREEN">
2983 # Pretend to use Canadian language settings.
2984 {+hide-accept-language{en-ca} \
2985 +hide-user-agent{Mozilla/5.0 (X11; U; OpenBSD i386; en-CA; rv:1.8.0.4) Gecko/20060628 Firefox/1.5.0.4} \
2986 }
2987 /
2988 </pre>
2989                   </td>
2990                 </tr>
2991               </table>
2992             </dd>
2993           </dl>
2994         </div>
2995       </div>
2996
2997       <div class="SECT3">
2998         <h4 class="SECT3"><a name="HIDE-CONTENT-DISPOSITION" id=
2999         "HIDE-CONTENT-DISPOSITION">8.5.21. hide-content-disposition</a></h4>
3000
3001         <div class="VARIABLELIST">
3002           <dl>
3003             <dt>Typical use:</dt>
3004
3005             <dd>
3006               <p>Prevent download menus for content you prefer to view inside
3007               the browser.</p>
3008             </dd>
3009
3010             <dt>Effect:</dt>
3011
3012             <dd>
3013               <p>Deletes or replaces the <span class=
3014               "QUOTE">"Content-Disposition:"</span> HTTP header set by some
3015               servers.</p>
3016             </dd>
3017
3018             <dt>Type:</dt>
3019
3020             <dd>
3021               <p>Parameterized.</p>
3022             </dd>
3023
3024             <dt>Parameter:</dt>
3025
3026             <dd>
3027               <p>Keyword: <span class="QUOTE">"block"</span>, or any user
3028               defined value.</p>
3029             </dd>
3030
3031             <dt>Notes:</dt>
3032
3033             <dd>
3034               <p>Some servers set the <span class=
3035               "QUOTE">"Content-Disposition:"</span> HTTP header for documents
3036               they assume you want to save locally before viewing them. The
3037               <span class="QUOTE">"Content-Disposition:"</span> header
3038               contains the file name the browser is supposed to use by
3039               default.</p>
3040
3041               <p>In most browsers that understand this header, it makes it
3042               impossible to <span class="emphasis"><i class="EMPHASIS">just
3043               view</i></span> the document, without downloading it first,
3044               even if it's just a simple text file or an image.</p>
3045
3046               <p>Removing the <span class=
3047               "QUOTE">"Content-Disposition:"</span> header helps to prevent
3048               this annoyance, but some browsers additionally check the
3049               <span class="QUOTE">"Content-Type:"</span> header, before they
3050               decide if they can display a document without saving it first.
3051               In these cases, you have to change this header as well, before
3052               the browser stops displaying download menus.</p>
3053
3054               <p>It is also possible to change the server's file name
3055               suggestion to another one, but in most cases it isn't worth the
3056               time to set it up.</p>
3057
3058               <p>This action will probably be removed in the future, use
3059               server-header filters instead.</p>
3060             </dd>
3061
3062             <dt>Example usage:</dt>
3063
3064             <dd>
3065               <table border="0" bgcolor="#E0E0E0" width="90%">
3066                 <tr>
3067                   <td>
3068                     <pre class="SCREEN">
3069 # Disarm the download link in Sourceforge's patch tracker
3070 { -filter \
3071  +content-type-overwrite{text/plain}\
3072  +hide-content-disposition{block} }
3073  .sourceforge.net/tracker/download\.php
3074 </pre>
3075                   </td>
3076                 </tr>
3077               </table>
3078             </dd>
3079           </dl>
3080         </div>
3081       </div>
3082
3083       <div class="SECT3">
3084         <h4 class="SECT3"><a name="HIDE-IF-MODIFIED-SINCE" id=
3085         "HIDE-IF-MODIFIED-SINCE">8.5.22. hide-if-modified-since</a></h4>
3086
3087         <div class="VARIABLELIST">
3088           <dl>
3089             <dt>Typical use:</dt>
3090
3091             <dd>
3092               <p>Prevent yet another way to track the user's steps between
3093               sessions.</p>
3094             </dd>
3095
3096             <dt>Effect:</dt>
3097
3098             <dd>
3099               <p>Deletes the <span class="QUOTE">"If-Modified-Since:"</span>
3100               HTTP client header or modifies its value.</p>
3101             </dd>
3102
3103             <dt>Type:</dt>
3104
3105             <dd>
3106               <p>Parameterized.</p>
3107             </dd>
3108
3109             <dt>Parameter:</dt>
3110
3111             <dd>
3112               <p>Keyword: <span class="QUOTE">"block"</span>, or a user
3113               defined value that specifies a range of hours.</p>
3114             </dd>
3115
3116             <dt>Notes:</dt>
3117
3118             <dd>
3119               <p>Removing this header is useful for filter testing, where you
3120               want to force a real reload instead of getting status code
3121               <span class="QUOTE">"304"</span>, which would cause the browser
3122               to use a cached copy of the page.</p>
3123
3124               <p>Instead of removing the header, <tt class=
3125               "LITERAL">hide-if-modified-since</tt> can also add or subtract
3126               a random amount of time to/from the header's value. You specify
3127               a range of minutes where the random factor should be chosen
3128               from and <span class="APPLICATION">Privoxy</span> does the
3129               rest. A negative value means subtracting, a positive value
3130               adding.</p>
3131
3132               <p>Randomizing the value of the <span class=
3133               "QUOTE">"If-Modified-Since:"</span> makes it less likely that
3134               the server can use the time as a cookie replacement, but you
3135               will run into caching problems if the random range is too
3136               high.</p>
3137
3138               <p>It is a good idea to only use a small negative value and let
3139               <tt class="LITERAL"><a href=
3140               "actions-file.html#OVERWRITE-LAST-MODIFIED">overwrite-last-modified</a></tt>
3141               handle the greater changes.</p>
3142
3143               <p>It is also recommended to use this action together with
3144               <tt class="LITERAL"><a href=
3145               "actions-file.html#CRUNCH-IF-NONE-MATCH">crunch-if-none-match</a></tt>,
3146               otherwise it's more or less pointless.</p>
3147             </dd>
3148
3149             <dt>Example usage (section):</dt>
3150
3151             <dd>
3152               <table border="0" bgcolor="#E0E0E0" width="90%">
3153                 <tr>
3154                   <td>
3155                     <pre class="SCREEN">
3156 # Let the browser revalidate but make tracking based on the time less likely.
3157 {+hide-if-modified-since{-60} \
3158  +overwrite-last-modified{randomize} \
3159  +crunch-if-none-match}
3160 /
3161 </pre>
3162                   </td>
3163                 </tr>
3164               </table>
3165             </dd>
3166           </dl>
3167         </div>
3168       </div>
3169
3170       <div class="SECT3">
3171         <h4 class="SECT3"><a name="HIDE-FROM-HEADER" id=
3172         "HIDE-FROM-HEADER">8.5.23. hide-from-header</a></h4>
3173
3174         <div class="VARIABLELIST">
3175           <dl>
3176             <dt>Typical use:</dt>
3177
3178             <dd>
3179               <p>Keep your (old and ill) browser from telling web servers
3180               your email address</p>
3181             </dd>
3182
3183             <dt>Effect:</dt>
3184
3185             <dd>
3186               <p>Deletes any existing <span class="QUOTE">"From:"</span> HTTP
3187               header, or replaces it with the specified string.</p>
3188             </dd>
3189
3190             <dt>Type:</dt>
3191
3192             <dd>
3193               <p>Parameterized.</p>
3194             </dd>
3195
3196             <dt>Parameter:</dt>
3197
3198             <dd>
3199               <p>Keyword: <span class="QUOTE">"block"</span>, or any user
3200               defined value.</p>
3201             </dd>
3202
3203             <dt>Notes:</dt>
3204
3205             <dd>
3206               <p>The keyword <span class="QUOTE">"block"</span> will
3207               completely remove the header (not to be confused with the
3208               <tt class="LITERAL"><a href=
3209               "actions-file.html#BLOCK">block</a></tt> action).</p>
3210
3211               <p>Alternately, you can specify any value you prefer to be sent
3212               to the web server. If you do, it is a matter of fairness not to
3213               use any address that is actually used by a real person.</p>
3214
3215               <p>This action is rarely needed, as modern web browsers don't
3216               send <span class="QUOTE">"From:"</span> headers anymore.</p>
3217             </dd>
3218
3219             <dt>Example usage:</dt>
3220
3221             <dd>
3222               <table border="0" bgcolor="#E0E0E0" width="90%">
3223                 <tr>
3224                   <td>
3225                     <pre class="SCREEN">
3226 +hide-from-header{block}
3227 </pre>
3228                   </td>
3229                 </tr>
3230               </table>or
3231
3232               <table border="0" bgcolor="#E0E0E0" width="90%">
3233                 <tr>
3234                   <td>
3235                     <pre class="SCREEN">
3236 +hide-from-header{spam-me-senseless@sittingduck.example.com}
3237 </pre>
3238                   </td>
3239                 </tr>
3240               </table>
3241             </dd>
3242           </dl>
3243         </div>
3244       </div>
3245
3246       <div class="SECT3">
3247         <h4 class="SECT3"><a name="HIDE-REFERRER" id="HIDE-REFERRER">8.5.24.
3248         hide-referrer</a></h4><a name="HIDE-REFERER" id="HIDE-REFERER"></a>
3249
3250         <div class="VARIABLELIST">
3251           <dl>
3252             <dt>Typical use:</dt>
3253
3254             <dd>
3255               <p>Conceal which link you followed to get to a particular
3256               site</p>
3257             </dd>
3258
3259             <dt>Effect:</dt>
3260
3261             <dd>
3262               <p>Deletes the <span class="QUOTE">"Referer:"</span> (sic) HTTP
3263               header from the client request, or replaces it with a forged
3264               one.</p>
3265             </dd>
3266
3267             <dt>Type:</dt>
3268
3269             <dd>
3270               <p>Parameterized.</p>
3271             </dd>
3272
3273             <dt>Parameter:</dt>
3274
3275             <dd>
3276               <ul>
3277                 <li>
3278                   <p><span class="QUOTE">"conditional-block"</span> to delete
3279                   the header completely if the host has changed.</p>
3280                 </li>
3281
3282                 <li>
3283                   <p><span class="QUOTE">"conditional-forge"</span> to forge
3284                   the header if the host has changed.</p>
3285                 </li>
3286
3287                 <li>
3288                   <p><span class="QUOTE">"block"</span> to delete the header
3289                   unconditionally.</p>
3290                 </li>
3291
3292                 <li>
3293                   <p><span class="QUOTE">"forge"</span> to pretend to be
3294                   coming from the homepage of the server we are talking
3295                   to.</p>
3296                 </li>
3297
3298                 <li>
3299                   <p>Any other string to set a user defined referrer.</p>
3300                 </li>
3301               </ul>
3302             </dd>
3303
3304             <dt>Notes:</dt>
3305
3306             <dd>
3307               <p><tt class="LITERAL">conditional-block</tt> is the only
3308               parameter, that isn't easily detected in the server's log file.
3309               If it blocks the referrer, the request will look like the
3310               visitor used a bookmark or typed in the address directly.</p>
3311
3312               <p>Leaving the referrer unmodified for requests on the same
3313               host allows the server owner to see the visitor's <span class=
3314               "QUOTE">"click path"</span>, but in most cases she could also
3315               get that information by comparing other parts of the log file:
3316               for example the User-Agent if it isn't a very common one, or
3317               the user's IP address if it doesn't change between different
3318               requests.</p>
3319
3320               <p>Always blocking the referrer, or using a custom one, can
3321               lead to failures on servers that check the referrer before they
3322               answer any requests, in an attempt to prevent their content
3323               from being embedded or linked to elsewhere.</p>
3324
3325               <p>Both <tt class="LITERAL">conditional-block</tt> and
3326               <tt class="LITERAL">forge</tt> will work with referrer checks,
3327               as long as content and valid referring page are on the same
3328               host. Most of the time that's the case.</p>
3329
3330               <p><tt class="LITERAL">hide-referer</tt> is an alternate
3331               spelling of <tt class="LITERAL">hide-referrer</tt> and the two
3332               can be can be freely substituted with each other. (<span class=
3333               "QUOTE">"referrer"</span> is the correct English spelling,
3334               however the HTTP specification has a bug - it requires it to be
3335               spelled as <span class="QUOTE">"referer"</span>.)</p>
3336             </dd>
3337
3338             <dt>Example usage:</dt>
3339
3340             <dd>
3341               <table border="0" bgcolor="#E0E0E0" width="90%">
3342                 <tr>
3343                   <td>
3344                     <pre class="SCREEN">
3345 +hide-referrer{forge}
3346 </pre>
3347                   </td>
3348                 </tr>
3349               </table>or
3350
3351               <table border="0" bgcolor="#E0E0E0" width="90%">
3352                 <tr>
3353                   <td>
3354                     <pre class="SCREEN">
3355 +hide-referrer{http://www.yahoo.com/}
3356 </pre>
3357                   </td>
3358                 </tr>
3359               </table>
3360             </dd>
3361           </dl>
3362         </div>
3363       </div>
3364
3365       <div class="SECT3">
3366         <h4 class="SECT3"><a name="HIDE-USER-AGENT" id=
3367         "HIDE-USER-AGENT">8.5.25. hide-user-agent</a></h4>
3368
3369         <div class="VARIABLELIST">
3370           <dl>
3371             <dt>Typical use:</dt>
3372
3373             <dd>
3374               <p>Try to conceal your type of browser and client operating
3375               system</p>
3376             </dd>
3377
3378             <dt>Effect:</dt>
3379
3380             <dd>
3381               <p>Replaces the value of the <span class=
3382               "QUOTE">"User-Agent:"</span> HTTP header in client requests
3383               with the specified value.</p>
3384             </dd>
3385
3386             <dt>Type:</dt>
3387
3388             <dd>
3389               <p>Parameterized.</p>
3390             </dd>
3391
3392             <dt>Parameter:</dt>
3393
3394             <dd>
3395               <p>Any user-defined string.</p>
3396             </dd>
3397
3398             <dt>Notes:</dt>
3399
3400             <dd>
3401               <div class="WARNING">
3402                 <table class="WARNING" border="1" width="90%">
3403                   <tr>
3404                     <td align="center"><b>Warning</b></td>
3405                   </tr>
3406
3407                   <tr>
3408                     <td align="left">
3409                       <p>This can lead to problems on web sites that depend
3410                       on looking at this header in order to customize their
3411                       content for different browsers (which, by the way, is
3412                       <span class="emphasis"><i class=
3413                       "EMPHASIS">NOT</i></span> the right thing to do: good
3414                       web sites work browser-independently).</p>
3415                     </td>
3416                   </tr>
3417                 </table>
3418               </div>
3419
3420               <p>Using this action in multi-user setups or wherever different
3421               types of browsers will access the same <span class=
3422               "APPLICATION">Privoxy</span> is <span class=
3423               "emphasis"><i class="EMPHASIS">not recommended</i></span>. In
3424               single-user, single-browser setups, you might use it to delete
3425               your OS version information from the headers, because it is an
3426               invitation to exploit known bugs for your OS. It is also
3427               occasionally useful to forge this in order to access sites that
3428               won't let you in otherwise (though there may be a good reason
3429               in some cases).</p>
3430
3431               <p>More information on known user-agent strings can be found at
3432               <a href="http://www.user-agents.org/" target=
3433               "_top">http://www.user-agents.org/</a> and <a href=
3434               "http://en.wikipedia.org/wiki/User_agent" target=
3435               "_top">http://en.wikipedia.org/wiki/User_agent</a>.</p>
3436             </dd>
3437
3438             <dt>Example usage:</dt>
3439
3440             <dd>
3441               <table border="0" bgcolor="#E0E0E0" width="90%">
3442                 <tr>
3443                   <td>
3444                     <pre class="SCREEN">
3445 +hide-user-agent{Netscape 6.1 (X11; I; Linux 2.4.18 i686)}
3446 </pre>
3447                   </td>
3448                 </tr>
3449               </table>
3450             </dd>
3451           </dl>
3452         </div>
3453       </div>
3454
3455       <div class="SECT3">
3456         <h4 class="SECT3"><a name="LIMIT-CONNECT" id="LIMIT-CONNECT">8.5.26.
3457         limit-connect</a></h4>
3458
3459         <div class="VARIABLELIST">
3460           <dl>
3461             <dt>Typical use:</dt>
3462
3463             <dd>
3464               <p>Prevent abuse of <span class="APPLICATION">Privoxy</span> as
3465               a TCP proxy relay or disable SSL for untrusted sites</p>
3466             </dd>
3467
3468             <dt>Effect:</dt>
3469
3470             <dd>
3471               <p>Specifies to which ports HTTP CONNECT requests are
3472               allowable.</p>
3473             </dd>
3474
3475             <dt>Type:</dt>
3476
3477             <dd>
3478               <p>Parameterized.</p>
3479             </dd>
3480
3481             <dt>Parameter:</dt>
3482
3483             <dd>
3484               <p>A comma-separated list of ports or port ranges (the latter
3485               using dashes, with the minimum defaulting to 0 and the maximum
3486               to 65K).</p>
3487             </dd>
3488
3489             <dt>Notes:</dt>
3490
3491             <dd>
3492               <p>By default, i.e. if no <tt class=
3493               "LITERAL">limit-connect</tt> action applies, <span class=
3494               "APPLICATION">Privoxy</span> allows HTTP CONNECT requests to
3495               all ports. Use <tt class="LITERAL">limit-connect</tt> if
3496               fine-grained control is desired for some or all
3497               destinations.</p>
3498
3499               <p>The CONNECT methods exists in HTTP to allow access to secure
3500               websites (<span class="QUOTE">"https://"</span> URLs) through
3501               proxies. It works very simply: the proxy connects to the server
3502               on the specified port, and then short-circuits its connections
3503               to the client and to the remote server. This means
3504               CONNECT-enabled proxies can be used as TCP relays very
3505               easily.</p>
3506
3507               <p><span class="APPLICATION">Privoxy</span> relays HTTPS
3508               traffic without seeing the decoded content. Websites can
3509               leverage this limitation to circumvent <span class=
3510               "APPLICATION">Privoxy</span>'s filters. By specifying an
3511               invalid port range you can disable HTTPS entirely.</p>
3512             </dd>
3513
3514             <dt>Example usages:</dt>
3515
3516             <dd>
3517               <table border="0" bgcolor="#E0E0E0" width="90%">
3518                 <tr>
3519                   <td>
3520                     <pre class="SCREEN">
3521 +limit-connect{443}                   # Port 443 is OK.
3522 +limit-connect{80,443}                # Ports 80 and 443 are OK.
3523 +limit-connect{-3, 7, 20-100, 500-}   # Ports less than 3, 7, 20 to 100 and above 500 are OK.
3524 +limit-connect{-}                     # All ports are OK
3525 +limit-connect{,}                     # No HTTPS/SSL traffic is allowed
3526 </pre>
3527                   </td>
3528                 </tr>
3529               </table>
3530             </dd>
3531           </dl>
3532         </div>
3533       </div>
3534
3535       <div class="SECT3">
3536         <h4 class="SECT3"><a name="PREVENT-COMPRESSION" id=
3537         "PREVENT-COMPRESSION">8.5.27. prevent-compression</a></h4>
3538
3539         <div class="VARIABLELIST">
3540           <dl>
3541             <dt>Typical use:</dt>
3542
3543             <dd>
3544               <p>Ensure that servers send the content uncompressed, so it can
3545               be passed through <tt class="LITERAL"><a href=
3546               "actions-file.html#FILTER">filter</a></tt>s.</p>
3547             </dd>
3548
3549             <dt>Effect:</dt>
3550
3551             <dd>
3552               <p>Removes the Accept-Encoding header which can be used to ask
3553               for compressed transfer.</p>
3554             </dd>
3555
3556             <dt>Type:</dt>
3557
3558             <dd>
3559               <p>Boolean.</p>
3560             </dd>
3561
3562             <dt>Parameter:</dt>
3563
3564             <dd>
3565               <p>N/A</p>
3566             </dd>
3567
3568             <dt>Notes:</dt>
3569
3570             <dd>
3571               <p>More and more websites send their content compressed by
3572               default, which is generally a good idea and saves bandwidth.
3573               But the <tt class="LITERAL"><a href=
3574               "actions-file.html#FILTER">filter</a></tt> and <tt class=
3575               "LITERAL"><a href=
3576               "actions-file.html#DEANIMATE-GIFS">deanimate-gifs</a></tt>
3577               actions need access to the uncompressed data.</p>
3578
3579               <p>When compiled with zlib support (available since
3580               <span class="APPLICATION">Privoxy</span> 3.0.7), content that
3581               should be filtered is decompressed on-the-fly and you don't
3582               have to worry about this action. If you are using an older
3583               <span class="APPLICATION">Privoxy</span> version, or one that
3584               hasn't been compiled with zlib support, this action can be used
3585               to convince the server to send the content uncompressed.</p>
3586
3587               <p>Most text-based instances compress very well, the size is
3588               seldom decreased by less than 50%, for markup-heavy instances
3589               like news feeds saving more than 90% of the original size isn't
3590               unusual.</p>
3591
3592               <p>Not using compression will therefore slow down the transfer,
3593               and you should only enable this action if you really need it.
3594               As of <span class="APPLICATION">Privoxy</span> 3.0.7 it's
3595               disabled in all predefined action settings.</p>
3596
3597               <p>Note that some (rare) ill-configured sites don't handle
3598               requests for uncompressed documents correctly. Broken PHP
3599               applications tend to send an empty document body, some IIS
3600               versions only send the beginning of the content. If you enable
3601               <tt class="LITERAL">prevent-compression</tt> per default, you
3602               might want to add exceptions for those sites. See the example
3603               for how to do that.</p>
3604             </dd>
3605
3606             <dt>Example usage (sections):</dt>
3607
3608             <dd>
3609               <table border="0" bgcolor="#E0E0E0" width="90%">
3610                 <tr>
3611                   <td>
3612                     <pre class="SCREEN">
3613 # Selectively turn off compression, and enable a filter
3614 #
3615 { +filter{tiny-textforms} +prevent-compression }
3616 # Match only these sites
3617  .google.
3618  sourceforge.net
3619  sf.net
3620
3621 # Or instead, we could set a universal default:
3622 #
3623 { +prevent-compression }
3624  / # Match all sites
3625
3626 # Then maybe make exceptions for broken sites:
3627 #
3628 { -prevent-compression }
3629 .compusa.com/
3630 </pre>
3631                   </td>
3632                 </tr>
3633               </table>
3634             </dd>
3635           </dl>
3636         </div>
3637       </div>
3638
3639       <div class="SECT3">
3640         <h4 class="SECT3"><a name="OVERWRITE-LAST-MODIFIED" id=
3641         "OVERWRITE-LAST-MODIFIED">8.5.28. overwrite-last-modified</a></h4>
3642
3643         <div class="VARIABLELIST">
3644           <dl>
3645             <dt>Typical use:</dt>
3646
3647             <dd>
3648               <p>Prevent yet another way to track the user's steps between
3649               sessions.</p>
3650             </dd>
3651
3652             <dt>Effect:</dt>
3653
3654             <dd>
3655               <p>Deletes the <span class="QUOTE">"Last-Modified:"</span> HTTP
3656               server header or modifies its value.</p>
3657             </dd>
3658
3659             <dt>Type:</dt>
3660
3661             <dd>
3662               <p>Parameterized.</p>
3663             </dd>
3664
3665             <dt>Parameter:</dt>
3666
3667             <dd>
3668               <p>One of the keywords: <span class="QUOTE">"block"</span>,
3669               <span class="QUOTE">"reset-to-request-time"</span> and
3670               <span class="QUOTE">"randomize"</span></p>
3671             </dd>
3672
3673             <dt>Notes:</dt>
3674
3675             <dd>
3676               <p>Removing the <span class="QUOTE">"Last-Modified:"</span>
3677               header is useful for filter testing, where you want to force a
3678               real reload instead of getting status code <span class=
3679               "QUOTE">"304"</span>, which would cause the browser to reuse
3680               the old version of the page.</p>
3681
3682               <p>The <span class="QUOTE">"randomize"</span> option overwrites
3683               the value of the <span class="QUOTE">"Last-Modified:"</span>
3684               header with a randomly chosen time between the original value
3685               and the current time. In theory the server could send each
3686               document with a different <span class=
3687               "QUOTE">"Last-Modified:"</span> header to track visits without
3688               using cookies. <span class="QUOTE">"Randomize"</span> makes it
3689               impossible and the browser can still revalidate cached
3690               documents.</p>
3691
3692               <p><span class="QUOTE">"reset-to-request-time"</span>
3693               overwrites the value of the <span class=
3694               "QUOTE">"Last-Modified:"</span> header with the current time.
3695               You could use this option together with <tt class=
3696               "LITERAL"><a href=
3697               "actions-file.html#HIDE-IF-MODIFIED-SINCE">hide-if-modified-since</a></tt>
3698               to further customize your random range.</p>
3699
3700               <p>The preferred parameter here is <span class=
3701               "QUOTE">"randomize"</span>. It is safe to use, as long as the
3702               time settings are more or less correct. If the server sets the
3703               <span class="QUOTE">"Last-Modified:"</span> header to the time
3704               of the request, the random range becomes zero and the value
3705               stays the same. Therefore you should later randomize it a
3706               second time with <tt class="LITERAL"><a href=
3707               "actions-file.html#HIDE-IF-MODIFIED-SINCE">hided-if-modified-since</a></tt>,
3708               just to be sure.</p>
3709
3710               <p>It is also recommended to use this action together with
3711               <tt class="LITERAL"><a href=
3712               "actions-file.html#CRUNCH-IF-NONE-MATCH">crunch-if-none-match</a></tt>.</p>
3713             </dd>
3714
3715             <dt>Example usage:</dt>
3716
3717             <dd>
3718               <table border="0" bgcolor="#E0E0E0" width="90%">
3719                 <tr>
3720                   <td>
3721                     <pre class="SCREEN">
3722 # Let the browser revalidate without being tracked across sessions
3723 { +hide-if-modified-since{-60} \
3724  +overwrite-last-modified{randomize} \
3725  +crunch-if-none-match}
3726 /
3727 </pre>
3728                   </td>
3729                 </tr>
3730               </table>
3731             </dd>
3732           </dl>
3733         </div>
3734       </div>
3735
3736       <div class="SECT3">
3737         <h4 class="SECT3"><a name="REDIRECT" id="REDIRECT">8.5.29.
3738         redirect</a></h4>
3739
3740         <div class="VARIABLELIST">
3741           <dl>
3742             <dt>Typical use:</dt>
3743
3744             <dd>
3745               <p>Redirect requests to other sites.</p>
3746             </dd>
3747
3748             <dt>Effect:</dt>
3749
3750             <dd>
3751               <p>Convinces the browser that the requested document has been
3752               moved to another location and the browser should get it from
3753               there.</p>
3754             </dd>
3755
3756             <dt>Type:</dt>
3757
3758             <dd>
3759               <p>Parameterized</p>
3760             </dd>
3761
3762             <dt>Parameter:</dt>
3763
3764             <dd>
3765               <p>An absolute URL or a single pcrs command.</p>
3766             </dd>
3767
3768             <dt>Notes:</dt>
3769
3770             <dd>
3771               <p>Requests to which this action applies are answered with a
3772               HTTP redirect to URLs of your choosing. The new URL is either
3773               provided as parameter, or derived by applying a single pcrs
3774               command to the original URL.</p>
3775
3776               <p>This action will be ignored if you use it together with
3777               <tt class="LITERAL"><a href=
3778               "actions-file.html#BLOCK">block</a></tt>. It can be combined
3779               with <tt class="LITERAL"><a href=
3780               "actions-file.html#FAST-REDIRECTS">fast-redirects{check-decoded-url}</a></tt>
3781               to redirect to a decoded version of a rewritten URL.</p>
3782
3783               <p>Use this action carefully, make sure not to create
3784               redirection loops and be aware that using your own redirects
3785               might make it possible to fingerprint your requests.</p>
3786
3787               <p>In case of problems with your redirects, or simply to watch
3788               them working, enable <a href="config.html#DEBUG">debug
3789               128</a>.</p>
3790             </dd>
3791
3792             <dt>Example usages:</dt>
3793
3794             <dd>
3795               <table border="0" bgcolor="#E0E0E0" width="90%">
3796                 <tr>
3797                   <td>
3798                     <pre class="SCREEN">
3799 # Replace example.com's style sheet with another one
3800 { +redirect{http://localhost/css-replacements/example.com.css} }
3801  example.com/stylesheet\.css
3802
3803 # Create a short, easy to remember nickname for a favorite site
3804 # (relies on the browser accept and forward invalid URLs to <span class=
3805 "APPLICATION">Privoxy</span>)
3806 { +redirect{http://www.privoxy.org/user-manual/actions-file.html} }
3807  a
3808
3809 # Always use the expanded view for Undeadly.org articles
3810 # (Note the $ at the end of the URL pattern to make sure
3811 # the request for the rewritten URL isn't redirected as well)
3812 {+redirect{s@$@&amp;mode=expanded@}}
3813 undeadly.org/cgi\?action=article&amp;sid=\d*$
3814
3815 # Redirect Google search requests to MSN
3816 {+redirect{s@^http://[^/]*/search\?q=([^&amp;]*).*@http://search.msn.com/results.aspx?q=$1@}}
3817 .google.com/search
3818
3819 # Redirect MSN search requests to Yahoo
3820 {+redirect{s@^http://[^/]*/results\.aspx\?q=([^&amp;]*).*@http://search.yahoo.com/search?p=$1@}}
3821 search.msn.com//results\.aspx\?q=
3822
3823 # Redirect remote requests for this manual
3824 # to the local version delivered by Privoxy
3825 {+redirect{s@^http://www@http://config@}}
3826 www.privoxy.org/user-manual/
3827 </pre>
3828                   </td>
3829                 </tr>
3830               </table>
3831             </dd>
3832           </dl>
3833         </div>
3834       </div>
3835
3836       <div class="SECT3">
3837         <h4 class="SECT3"><a name="SERVER-HEADER-FILTER" id=
3838         "SERVER-HEADER-FILTER">8.5.30. server-header-filter</a></h4>
3839
3840         <div class="VARIABLELIST">
3841           <dl>
3842             <dt>Typical use:</dt>
3843
3844             <dd>
3845               <p>Rewrite or remove single server headers.</p>
3846             </dd>
3847
3848             <dt>Effect:</dt>
3849
3850             <dd>
3851               <p>All server headers to which this action applies are filtered
3852               on-the-fly through the specified regular expression based
3853               substitutions.</p>
3854             </dd>
3855
3856             <dt>Type:</dt>
3857
3858             <dd>
3859               <p>Parameterized.</p>
3860             </dd>
3861
3862             <dt>Parameter:</dt>
3863
3864             <dd>
3865               <p>The name of a server-header filter, as defined in one of the
3866               <a href="filter-file.html">filter files</a>.</p>
3867             </dd>
3868
3869             <dt>Notes:</dt>
3870
3871             <dd>
3872               <p>Server-header filters are applied to each header on its own,
3873               not to all at once. This makes it easier to diagnose problems,
3874               but on the downside you can't write filters that only change
3875               header x if header y's value is z. You can do that by using
3876               tags though.</p>
3877
3878               <p>Server-header filters are executed after the other header
3879               actions have finished and use their output as input.</p>
3880
3881               <p>Please refer to the <a href="filter-file.html">filter file
3882               chapter</a> to learn which server-header filters are available
3883               by default, and how to create your own.</p>
3884             </dd>
3885
3886             <dt>Example usage (section):</dt>
3887
3888             <dd>
3889               <table border="0" bgcolor="#E0E0E0" width="90%">
3890                 <tr>
3891                   <td>
3892                     <pre class="SCREEN">
3893 {+server-header-filter{html-to-xml}}
3894 example.org/xml-instance-that-is-delivered-as-html
3895
3896 {+server-header-filter{xml-to-html}}
3897 example.org/instance-that-is-delivered-as-xml-but-is-not
3898
3899 </pre>
3900                   </td>
3901                 </tr>
3902               </table>
3903             </dd>
3904           </dl>
3905         </div>
3906       </div>
3907
3908       <div class="SECT3">
3909         <h4 class="SECT3"><a name="SERVER-HEADER-TAGGER" id=
3910         "SERVER-HEADER-TAGGER">8.5.31. server-header-tagger</a></h4>
3911
3912         <div class="VARIABLELIST">
3913           <dl>
3914             <dt>Typical use:</dt>
3915
3916             <dd>
3917               <p>Enable or disable filters based on the Content-Type
3918               header.</p>
3919             </dd>
3920
3921             <dt>Effect:</dt>
3922
3923             <dd>
3924               <p>Server headers to which this action applies are filtered
3925               on-the-fly through the specified regular expression based
3926               substitutions, the result is used as tag.</p>
3927             </dd>
3928
3929             <dt>Type:</dt>
3930
3931             <dd>
3932               <p>Parameterized.</p>
3933             </dd>
3934
3935             <dt>Parameter:</dt>
3936
3937             <dd>
3938               <p>The name of a server-header tagger, as defined in one of the
3939               <a href="filter-file.html">filter files</a>.</p>
3940             </dd>
3941
3942             <dt>Notes:</dt>
3943
3944             <dd>
3945               <p>Server-header taggers are applied to each header on its own,
3946               and as the header isn't modified, each tagger <span class=
3947               "QUOTE">"sees"</span> the original.</p>
3948
3949               <p>Server-header taggers are executed before all other header
3950               actions that modify server headers. Their tags can be used to
3951               control all of the other server-header actions, the content
3952               filters and the crunch actions (<a href=
3953               "actions-file.html#REDIRECT">redirect</a> and <a href=
3954               "actions-file.html#BLOCK">block</a>).</p>
3955
3956               <p>Obviously crunching based on tags created by server-header
3957               taggers doesn't prevent the request from showing up in the
3958               server's log file.</p>
3959             </dd>
3960
3961             <dt>Example usage (section):</dt>
3962
3963             <dd>
3964               <table border="0" bgcolor="#E0E0E0" width="90%">
3965                 <tr>
3966                   <td>
3967                     <pre class="SCREEN">
3968 # Tag every request with the content type declared by the server
3969 {+server-header-tagger{content-type}}
3970 /
3971
3972 </pre>
3973                   </td>
3974                 </tr>
3975               </table>
3976             </dd>
3977           </dl>
3978         </div>
3979       </div>
3980
3981       <div class="SECT3">
3982         <h4 class="SECT3"><a name="SESSION-COOKIES-ONLY" id=
3983         "SESSION-COOKIES-ONLY">8.5.32. session-cookies-only</a></h4>
3984
3985         <div class="VARIABLELIST">
3986           <dl>
3987             <dt>Typical use:</dt>
3988
3989             <dd>
3990               <p>Allow only temporary <span class="QUOTE">"session"</span>
3991               cookies (for the current browser session <span class=
3992               "emphasis"><i class="EMPHASIS">only</i></span>).</p>
3993             </dd>
3994
3995             <dt>Effect:</dt>
3996
3997             <dd>
3998               <p>Deletes the <span class="QUOTE">"expires"</span> field from
3999               <span class="QUOTE">"Set-Cookie:"</span> server headers. Most
4000               browsers will not store such cookies permanently and forget
4001               them in between sessions.</p>
4002             </dd>
4003
4004             <dt>Type:</dt>
4005
4006             <dd>
4007               <p>Boolean.</p>
4008             </dd>
4009
4010             <dt>Parameter:</dt>
4011
4012             <dd>
4013               <p>N/A</p>
4014             </dd>
4015
4016             <dt>Notes:</dt>
4017
4018             <dd>
4019               <p>This is less strict than <tt class="LITERAL"><a href=
4020               "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a></tt>
4021               / <tt class="LITERAL"><a href=
4022               "actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a></tt>
4023               and allows you to browse websites that insist or rely on
4024               setting cookies, without compromising your privacy too
4025               badly.</p>
4026
4027               <p>Most browsers will not permanently store cookies that have
4028               been processed by <tt class="LITERAL">session-cookies-only</tt>
4029               and will forget about them between sessions. This makes
4030               profiling cookies useless, but won't break sites which require
4031               cookies so that you can log in for transactions. This is
4032               generally turned on for all sites, and is the recommended
4033               setting.</p>
4034
4035               <p>It makes <span class="emphasis"><i class="EMPHASIS">no sense
4036               at all</i></span> to use <tt class=
4037               "LITERAL">session-cookies-only</tt> together with <tt class=
4038               "LITERAL"><a href=
4039               "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a></tt>
4040               or <tt class="LITERAL"><a href=
4041               "actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a></tt>.
4042               If you do, cookies will be plainly killed.</p>
4043
4044               <p>Note that it is up to the browser how it handles such
4045               cookies without an <span class="QUOTE">"expires"</span> field.
4046               If you use an exotic browser, you might want to try it out to
4047               be sure.</p>
4048
4049               <p>This setting also has no effect on cookies that may have
4050               been stored previously by the browser before starting
4051               <span class="APPLICATION">Privoxy</span>. These would have to
4052               be removed manually.</p>
4053
4054               <p><span class="APPLICATION">Privoxy</span> also uses the
4055               <a href=
4056               "actions-file.html#FILTER-CONTENT-COOKIES">content-cookies
4057               filter</a> to block some types of cookies. Content cookies are
4058               not effected by <tt class=
4059               "LITERAL">session-cookies-only</tt>.</p>
4060             </dd>
4061
4062             <dt>Example usage:</dt>
4063
4064             <dd>
4065               <table border="0" bgcolor="#E0E0E0" width="90%">
4066                 <tr>
4067                   <td>
4068                     <pre class="SCREEN">
4069 +session-cookies-only
4070 </pre>
4071                   </td>
4072                 </tr>
4073               </table>
4074             </dd>
4075           </dl>
4076         </div>
4077       </div>
4078
4079       <div class="SECT3">
4080         <h4 class="SECT3"><a name="SET-IMAGE-BLOCKER" id=
4081         "SET-IMAGE-BLOCKER">8.5.33. set-image-blocker</a></h4>
4082
4083         <div class="VARIABLELIST">
4084           <dl>
4085             <dt>Typical use:</dt>
4086
4087             <dd>
4088               <p>Choose the replacement for blocked images</p>
4089             </dd>
4090
4091             <dt>Effect:</dt>
4092
4093             <dd>
4094               <p>This action alone doesn't do anything noticeable. If
4095               <span class="emphasis"><i class="EMPHASIS">both</i></span>
4096               <tt class="LITERAL"><a href=
4097               "actions-file.html#BLOCK">block</a></tt> <span class=
4098               "emphasis"><i class="EMPHASIS">and</i></span> <tt class=
4099               "LITERAL"><a href=
4100               "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt>
4101               <span class="emphasis"><i class="EMPHASIS">also</i></span>
4102               apply, i.e. if the request is to be blocked as an image,
4103               <span class="emphasis"><i class="EMPHASIS">then</i></span> the
4104               parameter of this action decides what will be sent as a
4105               replacement.</p>
4106             </dd>
4107
4108             <dt>Type:</dt>
4109
4110             <dd>
4111               <p>Parameterized.</p>
4112             </dd>
4113
4114             <dt>Parameter:</dt>
4115
4116             <dd>
4117               <ul>
4118                 <li>
4119                   <p><span class="QUOTE">"pattern"</span> to send a built-in
4120                   checkerboard pattern image. The image is visually decent,
4121                   scales very well, and makes it obvious where banners were
4122                   busted.</p>
4123                 </li>
4124
4125                 <li>
4126                   <p><span class="QUOTE">"blank"</span> to send a built-in
4127                   transparent image. This makes banners disappear completely,
4128                   but makes it hard to detect where <span class=
4129                   "APPLICATION">Privoxy</span> has blocked images on a given
4130                   page and complicates troubleshooting if <span class=
4131                   "APPLICATION">Privoxy</span> has blocked innocent images,
4132                   like navigation icons.</p>
4133                 </li>
4134
4135                 <li>
4136                   <p><span class="QUOTE">"<tt class=
4137                   "REPLACEABLE"><i>target-url</i></tt>"</span> to send a
4138                   redirect to <tt class="REPLACEABLE"><i>target-url</i></tt>.
4139                   You can redirect to any image anywhere, even in your local
4140                   filesystem via <span class="QUOTE">"file:///"</span> URL.
4141                   (But note that not all browsers support redirecting to a
4142                   local file system).</p>
4143
4144                   <p>A good application of redirects is to use special
4145                   <span class="APPLICATION">Privoxy</span>-built-in URLs,
4146                   which send the built-in images, as <tt class=
4147                   "REPLACEABLE"><i>target-url</i></tt>. This has the same
4148                   visual effect as specifying <span class=
4149                   "QUOTE">"blank"</span> or <span class=
4150                   "QUOTE">"pattern"</span> in the first place, but enables
4151                   your browser to cache the replacement image, instead of
4152                   requesting it over and over again.</p>
4153                 </li>
4154               </ul>
4155             </dd>
4156
4157             <dt>Notes:</dt>
4158
4159             <dd>
4160               <p>The URLs for the built-in images are <span class=
4161               "QUOTE">"http://config.privoxy.org/send-banner?type=<tt class=
4162               "REPLACEABLE"><i>type</i></tt>"</span>, where <tt class=
4163               "REPLACEABLE"><i>type</i></tt> is either <span class=
4164               "QUOTE">"blank"</span> or <span class=
4165               "QUOTE">"pattern"</span>.</p>
4166
4167               <p>There is a third (advanced) type, called <span class=
4168               "QUOTE">"auto"</span>. It is <span class="emphasis"><i class=
4169               "EMPHASIS">NOT</i></span> to be used in <tt class=
4170               "LITERAL">set-image-blocker</tt>, but meant for use from
4171               <a href="filter-file.html">filters</a>. Auto will select the
4172               type of image that would have applied to the referring page,
4173               had it been an image.</p>
4174             </dd>
4175
4176             <dt>Example usage:</dt>
4177
4178             <dd>
4179               <p>Built-in pattern:</p>
4180
4181               <table border="0" bgcolor="#E0E0E0" width="90%">
4182                 <tr>
4183                   <td>
4184                     <pre class="SCREEN">
4185 +set-image-blocker{pattern}
4186 </pre>
4187                   </td>
4188                 </tr>
4189               </table>
4190
4191               <p>Redirect to the BSD daemon:</p>
4192
4193               <table border="0" bgcolor="#E0E0E0" width="90%">
4194                 <tr>
4195                   <td>
4196                     <pre class="SCREEN">
4197 +set-image-blocker{http://www.freebsd.org/gifs/dae_up3.gif}
4198 </pre>
4199                   </td>
4200                 </tr>
4201               </table>
4202
4203               <p>Redirect to the built-in pattern for better caching:</p>
4204
4205               <table border="0" bgcolor="#E0E0E0" width="90%">
4206                 <tr>
4207                   <td>
4208                     <pre class="SCREEN">
4209 +set-image-blocker{http://config.privoxy.org/send-banner?type=pattern}
4210 </pre>
4211                   </td>
4212                 </tr>
4213               </table>
4214             </dd>
4215           </dl>
4216         </div>
4217       </div>
4218
4219       <div class="SECT3">
4220         <h3 class="SECT3"><a name="AEN4706" id="AEN4706">8.5.34.
4221         Summary</a></h3>
4222
4223         <p>Note that many of these actions have the potential to cause a page
4224         to misbehave, possibly even not to display at all. There are many
4225         ways a site designer may choose to design his site, and what HTTP
4226         header content, and other criteria, he may depend on. There is no way
4227         to have hard and fast rules for all sites. See the <a href=
4228         "appendix.html#ACTIONSANAT">Appendix</a> for a brief example on
4229         troubleshooting actions.</p>
4230       </div>
4231     </div>
4232
4233     <div class="SECT2">
4234       <h2 class="SECT2"><a name="ALIASES" id="ALIASES">8.6. Aliases</a></h2>
4235
4236       <p>Custom <span class="QUOTE">"actions"</span>, known to <span class=
4237       "APPLICATION">Privoxy</span> as <span class="QUOTE">"aliases"</span>,
4238       can be defined by combining other actions. These can in turn be invoked
4239       just like the built-in actions. Currently, an alias name can contain
4240       any character except space, tab, <span class="QUOTE">"="</span>,
4241       <span class="QUOTE">"{"</span> and <span class="QUOTE">"}"</span>, but
4242       we <span class="emphasis"><i class="EMPHASIS">strongly
4243       recommend</i></span> that you only use <span class="QUOTE">"a"</span>
4244       to <span class="QUOTE">"z"</span>, <span class="QUOTE">"0"</span> to
4245       <span class="QUOTE">"9"</span>, <span class="QUOTE">"+"</span>, and
4246       <span class="QUOTE">"-"</span>. Alias names are not case sensitive, and
4247       are not required to start with a <span class="QUOTE">"+"</span> or
4248       <span class="QUOTE">"-"</span> sign, since they are merely textually
4249       expanded.</p>
4250
4251       <p>Aliases can be used throughout the actions file, but they
4252       <span class="emphasis"><i class="EMPHASIS">must be defined in a special
4253       section at the top of the file!</i></span> And there can only be one
4254       such section per actions file. Each actions file may have its own alias
4255       section, and the aliases defined in it are only visible within that
4256       file.</p>
4257
4258       <p>There are two main reasons to use aliases: One is to save typing for
4259       frequently used combinations of actions, the other one is a gain in
4260       flexibility: If you decide once how you want to handle shops by
4261       defining an alias called <span class="QUOTE">"shop"</span>, you can
4262       later change your policy on shops in <span class="emphasis"><i class=
4263       "EMPHASIS">one</i></span> place, and your changes will take effect
4264       everywhere in the actions file where the <span class=
4265       "QUOTE">"shop"</span> alias is used. Calling aliases by their purpose
4266       also makes your actions files more readable.</p>
4267
4268       <p>Currently, there is one big drawback to using aliases, though:
4269       <span class="APPLICATION">Privoxy</span>'s built-in web-based action
4270       file editor honors aliases when reading the actions files, but it
4271       expands them before writing. So the effects of your aliases are of
4272       course preserved, but the aliases themselves are lost when you edit
4273       sections that use aliases with it.</p>
4274
4275       <p>Now let's define some aliases...</p>
4276
4277       <table border="0" bgcolor="#E0E0E0" width="100%">
4278         <tr>
4279           <td>
4280             <pre class="SCREEN">
4281  # Useful custom aliases we can use later.
4282  #
4283  # Note the (required!) section header line and that this section
4284  # must be at the top of the actions file!
4285  #
4286  {{alias}}
4287
4288  # These aliases just save typing later:
4289  # (Note that some already use other aliases!)
4290  #
4291  +crunch-all-cookies = +<a href=
4292 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a> +<a href="actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a>
4293  -crunch-all-cookies = -<a href=
4294 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a> -<a href="actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a>
4295  +block-as-image      = +block{Blocked image.} +handle-as-image
4296  allow-all-cookies   = -crunch-all-cookies -<a href=
4297 "actions-file.html#SESSION-COOKIES-ONLY">session-cookies-only</a> -<a href=
4298 "actions-file.html#FILTER-CONTENT-COOKIES">filter{content-cookies}</a>
4299
4300  # These aliases define combinations of actions
4301  # that are useful for certain types of sites:
4302  #
4303  fragile     = -<a href="actions-file.html#BLOCK">block</a> -<a href=
4304 "actions-file.html#FILTER">filter</a> -crunch-all-cookies -<a href=
4305 "actions-file.html#FAST-REDIRECTS">fast-redirects</a> -<a href=
4306 "actions-file.html#HIDE-REFERER">hide-referrer</a> -<a href=
4307 "actions-file.html#PREVENT-COMPRESSION">prevent-compression</a>
4308
4309  shop        = -crunch-all-cookies -<a href=
4310 "actions-file.html#FILTER-ALL-POPUPS">filter{all-popups}</a>
4311
4312  # Short names for other aliases, for really lazy people ;-)
4313  #
4314  c0 = +crunch-all-cookies
4315  c1 = -crunch-all-cookies
4316 </pre>
4317           </td>
4318         </tr>
4319       </table>
4320
4321       <p>...and put them to use. These sections would appear in the lower
4322       part of an actions file and define exceptions to the default actions
4323       (as specified further up for the <span class="QUOTE">"/"</span>
4324       pattern):</p>
4325
4326       <table border="0" bgcolor="#E0E0E0" width="100%">
4327         <tr>
4328           <td>
4329             <pre class="SCREEN">
4330  # These sites are either very complex or very keen on
4331  # user data and require minimal interference to work:
4332  #
4333  {fragile}
4334  .office.microsoft.com
4335  .windowsupdate.microsoft.com
4336  # Gmail is really mail.google.com, not gmail.com
4337  mail.google.com
4338
4339  # Shopping sites:
4340  # Allow cookies (for setting and retrieving your customer data)
4341  #
4342  {shop}
4343  .quietpc.com
4344  .worldpay.com   # for quietpc.com
4345  mybank.example.com
4346
4347  # These shops require pop-ups:
4348  #
4349  {-filter{all-popups} -filter{unsolicited-popups}}
4350   .dabs.com
4351   .overclockers.co.uk
4352 </pre>
4353           </td>
4354         </tr>
4355       </table>
4356
4357       <p>Aliases like <span class="QUOTE">"shop"</span> and <span class=
4358       "QUOTE">"fragile"</span> are typically used for <span class=
4359       "QUOTE">"problem"</span> sites that require more than one action to be
4360       disabled in order to function properly.</p>
4361     </div>
4362
4363     <div class="SECT2">
4364       <h2 class="SECT2"><a name="ACT-EXAMPLES" id="ACT-EXAMPLES">8.7. Actions
4365       Files Tutorial</a></h2>
4366
4367       <p>The above chapters have shown <a href="actions-file.html">which
4368       actions files there are and how they are organized</a>, how actions are
4369       <a href="actions-file.html#ACTIONS">specified</a> and <a href=
4370       "actions-file.html#ACTIONS-APPLY">applied to URLs</a>, how <a href=
4371       "actions-file.html#AF-PATTERNS">patterns</a> work, and how to define
4372       and use <a href="actions-file.html#ALIASES">aliases</a>. Now, let's
4373       look at an example <tt class="FILENAME">match-all.action</tt>,
4374       <tt class="FILENAME">default.action</tt> and <tt class=
4375       "FILENAME">user.action</tt> file and see how all these pieces come
4376       together:</p>
4377
4378       <div class="SECT3">
4379         <h3 class="SECT3"><a name="AEN4770" id="AEN4770">8.7.1.
4380         match-all.action</a></h3>
4381
4382         <p>Remember <span class="emphasis"><i class="EMPHASIS">all actions
4383         are disabled when matching starts</i></span>, so we have to
4384         explicitly enable the ones we want.</p>
4385
4386         <p>While the <tt class="FILENAME">match-all.action</tt> file only
4387         contains a single section, it is probably the most important one. It
4388         has only one pattern, <span class="QUOTE">"<tt class=
4389         "LITERAL">/</tt>"</span>, but this pattern <a href=
4390         "actions-file.html#AF-PATTERNS">matches all URLs</a>. Therefore, the
4391         set of actions used in this <span class="QUOTE">"default"</span>
4392         section <span class="emphasis"><i class="EMPHASIS">will be applied to
4393         all requests as a start</i></span>. It can be partly or wholly
4394         overridden by other actions files like <tt class=
4395         "FILENAME">default.action</tt> and <tt class=
4396         "FILENAME">user.action</tt>, but it will still be largely responsible
4397         for your overall browsing experience.</p>
4398
4399         <p>Again, at the start of matching, all actions are disabled, so
4400         there is no need to disable any actions here. (Remember: a
4401         <span class="QUOTE">"+"</span> preceding the action name enables the
4402         action, a <span class="QUOTE">"-"</span> disables!). Also note how
4403         this long line has been made more readable by splitting it into
4404         multiple lines with line continuation.</p>
4405
4406         <table border="0" bgcolor="#E0E0E0" width="100%">
4407           <tr>
4408             <td>
4409               <pre class="SCREEN">
4410 { \
4411  +<a href=
4412 "actions-file.html#CHANGE-X-FORWARDED-FOR">change-x-forwarded-for{block}</a> \
4413  +<a href="actions-file.html#HIDE-FROM-HEADER">hide-from-header{block}</a> \
4414  +<a href=
4415 "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker{pattern}</a> \
4416 }
4417 / # Match all URLs
4418
4419 </pre>
4420             </td>
4421           </tr>
4422         </table>
4423
4424         <p>The default behavior is now set.</p>
4425       </div>
4426
4427       <div class="SECT3">
4428         <h3 class="SECT3"><a name="AEN4792" id="AEN4792">8.7.2.
4429         default.action</a></h3>
4430
4431         <p>If you aren't a developer, there's no need for you to edit the
4432         <tt class="FILENAME">default.action</tt> file. It is maintained by
4433         the <span class="APPLICATION">Privoxy</span> developers and if you
4434         disagree with some of the sections, you should overrule them in your
4435         <tt class="FILENAME">user.action</tt>.</p>
4436
4437         <p>Understanding the <tt class="FILENAME">default.action</tt> file
4438         can help you with your <tt class="FILENAME">user.action</tt>,
4439         though.</p>
4440
4441         <p>The first section in this file is a special section for internal
4442         use that prevents older <span class="APPLICATION">Privoxy</span>
4443         versions from reading the file:</p>
4444
4445         <table border="0" bgcolor="#E0E0E0" width="100%">
4446           <tr>
4447             <td>
4448               <pre class="SCREEN">
4449 ##########################################################################
4450 # Settings -- Don't change! For internal Privoxy use ONLY.
4451 ##########################################################################
4452 {{settings}}
4453 for-privoxy-version=3.0.11
4454 </pre>
4455             </td>
4456           </tr>
4457         </table>
4458
4459         <p>After that comes the (optional) alias section. We'll use the
4460         example section from the above <a href=
4461         "actions-file.html#ALIASES">chapter on aliases</a>, that also
4462         explains why and how aliases are used:</p>
4463
4464         <table border="0" bgcolor="#E0E0E0" width="100%">
4465           <tr>
4466             <td>
4467               <pre class="SCREEN">
4468 ##########################################################################
4469 # Aliases
4470 ##########################################################################
4471 {{alias}}
4472
4473  # These aliases just save typing later:
4474  # (Note that some already use other aliases!)
4475  #
4476  +crunch-all-cookies = +<a href=
4477 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a> +<a href="actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a>
4478  -crunch-all-cookies = -<a href=
4479 "actions-file.html#CRUNCH-INCOMING-COOKIES">crunch-incoming-cookies</a> -<a href="actions-file.html#CRUNCH-OUTGOING-COOKIES">crunch-outgoing-cookies</a>
4480  +block-as-image      = +block{Blocked image.} +handle-as-image
4481  mercy-for-cookies   = -crunch-all-cookies -<a href=
4482 "actions-file.html#SESSION-COOKIES-ONLY">session-cookies-only</a> -<a href=
4483 "actions-file.html#FILTER-CONTENT-COOKIES">filter{content-cookies}</a>
4484
4485  # These aliases define combinations of actions
4486  # that are useful for certain types of sites:
4487  #
4488  fragile     = -<a href="actions-file.html#BLOCK">block</a> -<a href=
4489 "actions-file.html#FILTER">filter</a> -crunch-all-cookies -<a href=
4490 "actions-file.html#FAST-REDIRECTS">fast-redirects</a> -<a href=
4491 "actions-file.html#HIDE-REFERER">hide-referrer</a>
4492  shop        = -crunch-all-cookies -<a href=
4493 "actions-file.html#FILTER-ALL-POPUPS">filter{all-popups}</a>
4494 </pre>
4495             </td>
4496           </tr>
4497         </table>
4498
4499         <p>The first of our specialized sections is concerned with
4500         <span class="QUOTE">"fragile"</span> sites, i.e. sites that require
4501         minimum interference, because they are either very complex or very
4502         keen on tracking you (and have mechanisms in place that make them
4503         unusable for people who avoid being tracked). We will simply use our
4504         pre-defined <tt class="LITERAL">fragile</tt> alias instead of stating
4505         the list of actions explicitly:</p>
4506
4507         <table border="0" bgcolor="#E0E0E0" width="100%">
4508           <tr>
4509             <td>
4510               <pre class="SCREEN">
4511 ##########################################################################
4512 # Exceptions for sites that'll break under the default action set:
4513 ##########################################################################
4514
4515 # "Fragile" Use a minimum set of actions for these sites (see alias above):
4516 #
4517 { fragile }
4518 .office.microsoft.com           # surprise, surprise!
4519 .windowsupdate.microsoft.com
4520 mail.google.com
4521 </pre>
4522             </td>
4523           </tr>
4524         </table>
4525
4526         <p>Shopping sites are not as fragile, but they typically require
4527         cookies to log in, and pop-up windows for shopping carts or item
4528         details. Again, we'll use a pre-defined alias:</p>
4529
4530         <table border="0" bgcolor="#E0E0E0" width="100%">
4531           <tr>
4532             <td>
4533               <pre class="SCREEN">
4534 # Shopping sites:
4535 #
4536 { shop }
4537 .quietpc.com
4538 .worldpay.com   # for quietpc.com
4539 .jungle.com
4540 .scan.co.uk
4541 </pre>
4542             </td>
4543           </tr>
4544         </table>
4545
4546         <p>The <tt class="LITERAL"><a href=
4547         "actions-file.html#FAST-REDIRECTS">fast-redirects</a></tt> action,
4548         which may have been enabled in <tt class=
4549         "FILENAME">match-all.action</tt>, breaks some sites. So disable it
4550         for popular sites where we know it misbehaves:</p>
4551
4552         <table border="0" bgcolor="#E0E0E0" width="100%">
4553           <tr>
4554             <td>
4555               <pre class="SCREEN">
4556 { -<a href="actions-file.html#FAST-REDIRECTS">fast-redirects</a> }
4557 login.yahoo.com
4558 edit.*.yahoo.com
4559 .google.com
4560 .altavista.com/.*(like|url|link):http
4561 .altavista.com/trans.*urltext=http
4562 .nytimes.com
4563 </pre>
4564             </td>
4565           </tr>
4566         </table>
4567
4568         <p>It is important that <span class="APPLICATION">Privoxy</span>
4569         knows which URLs belong to images, so that <span class=
4570         "emphasis"><i class="EMPHASIS">if</i></span> they are to be blocked,
4571         a substitute image can be sent, rather than an HTML page. Contacting
4572         the remote site to find out is not an option, since it would destroy
4573         the loading time advantage of banner blocking, and it would feed the
4574         advertisers information about you. We can mark any URL as an image
4575         with the <tt class="LITERAL"><a href=
4576         "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt> action,
4577         and marking all URLs that end in a known image file extension is a
4578         good start:</p>
4579
4580         <table border="0" bgcolor="#E0E0E0" width="100%">
4581           <tr>
4582             <td>
4583               <pre class="SCREEN">
4584 ##########################################################################
4585 # Images:
4586 ##########################################################################
4587
4588 # Define which file types will be treated as images, in case they get
4589 # blocked further down this file:
4590 #
4591 { +<a href="actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a> }
4592 /.*\.(gif|jpe?g|png|bmp|ico)$
4593 </pre>
4594             </td>
4595           </tr>
4596         </table>
4597
4598         <p>And then there are known banner sources. They often use scripts to
4599         generate the banners, so it won't be visible from the URL that the
4600         request is for an image. Hence we block them <span class=
4601         "emphasis"><i class="EMPHASIS">and</i></span> mark them as images in
4602         one go, with the help of our <tt class="LITERAL">+block-as-image</tt>
4603         alias defined above. (We could of course just as well use <tt class=
4604         "LITERAL">+<a href="actions-file.html#BLOCK">block</a> +<a href=
4605         "actions-file.html#HANDLE-AS-IMAGE">handle-as-image</a></tt> here.)
4606         Remember that the type of the replacement image is chosen by the
4607         <tt class="LITERAL"><a href=
4608         "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a></tt>
4609         action. Since all URLs have matched the default section with its
4610         <tt class="LITERAL">+<a href=
4611         "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker</a>{pattern}</tt>
4612         action before, it still applies and needn't be repeated:</p>
4613
4614         <table border="0" bgcolor="#E0E0E0" width="100%">
4615           <tr>
4616             <td>
4617               <pre class="SCREEN">
4618 # Known ad generators:
4619 #
4620 { +block-as-image }
4621 ar.atwola.com
4622 .ad.doubleclick.net
4623 .ad.*.doubleclick.net
4624 .a.yimg.com/(?:(?!/i/).)*$
4625 .a[0-9].yimg.com/(?:(?!/i/).)*$
4626 bs*.gsanet.com
4627 .qkimg.net
4628 </pre>
4629             </td>
4630           </tr>
4631         </table>
4632
4633         <p>One of the most important jobs of <span class=
4634         "APPLICATION">Privoxy</span> is to block banners. Many of these can
4635         be <span class="QUOTE">"blocked"</span> by the <tt class=
4636         "LITERAL"><a href=
4637         "actions-file.html#FILTER">filter</a>{banners-by-size}</tt> action,
4638         which we enabled above, and which deletes the references to banner
4639         images from the pages while they are loaded, so the browser doesn't
4640         request them anymore, and hence they don't need to be blocked here.
4641         But this naturally doesn't catch all banners, and some people choose
4642         not to use filters, so we need a comprehensive list of patterns for
4643         banner URLs here, and apply the <tt class="LITERAL"><a href=
4644         "actions-file.html#BLOCK">block</a></tt> action to them.</p>
4645
4646         <p>First comes many generic patterns, which do most of the work, by
4647         matching typical domain and path name components of banners. Then
4648         comes a list of individual patterns for specific sites, which is
4649         omitted here to keep the example short:</p>
4650
4651         <table border="0" bgcolor="#E0E0E0" width="100%">
4652           <tr>
4653             <td>
4654               <pre class="SCREEN">
4655 ##########################################################################
4656 # Block these fine banners:
4657 ##########################################################################
4658 { <a href="actions-file.html#BLOCK">+block{Banner ads.}</a> }
4659
4660 # Generic patterns:
4661 #
4662 ad*.
4663 .*ads.
4664 banner?.
4665 count*.
4666 /.*count(er)?\.(pl|cgi|exe|dll|asp|php[34]?)
4667 /(?:.*/)?(publicite|werbung|rekla(ma|me|am)|annonse|maino(kset|nta|s)?)/
4668
4669 # Site-specific patterns (abbreviated):
4670 #
4671 .hitbox.com
4672 </pre>
4673             </td>
4674           </tr>
4675         </table>
4676
4677         <p>It's quite remarkable how many advertisers actually call their
4678         banner servers ads.<tt class="REPLACEABLE"><i>company</i></tt>.com,
4679         or call the directory in which the banners are stored simply
4680         <span class="QUOTE">"banners"</span>. So the above generic patterns
4681         are surprisingly effective.</p>
4682
4683         <p>But being very generic, they necessarily also catch URLs that we
4684         don't want to block. The pattern <tt class="LITERAL">.*ads.</tt> e.g.
4685         catches <span class="QUOTE">"nasty-<span class="emphasis"><i class=
4686         "EMPHASIS">ads</i></span>.nasty-corp.com"</span> as intended, but
4687         also <span class="QUOTE">"downlo<span class="emphasis"><i class=
4688         "EMPHASIS">ads</i></span>.sourcefroge.net"</span> or <span class=
4689         "QUOTE">"<span class="emphasis"><i class=
4690         "EMPHASIS">ads</i></span>l.some-provider.net."</span> So here come
4691         some well-known exceptions to the <tt class="LITERAL">+<a href=
4692         "actions-file.html#BLOCK">block</a></tt> section above.</p>
4693
4694         <p>Note that these are exceptions to exceptions from the default!
4695         Consider the URL <span class=
4696         "QUOTE">"downloads.sourcefroge.net"</span>: Initially, all actions
4697         are deactivated, so it wouldn't get blocked. Then comes the defaults
4698         section, which matches the URL, but just deactivates the <tt class=
4699         "LITERAL"><a href="actions-file.html#BLOCK">block</a></tt> action
4700         once again. Then it matches <tt class="LITERAL">.*ads.</tt>, an
4701         exception to the general non-blocking policy, and suddenly <tt class=
4702         "LITERAL"><a href="actions-file.html#BLOCK">+block</a></tt> applies.
4703         And now, it'll match <tt class="LITERAL">.*loads.</tt>, where
4704         <tt class="LITERAL"><a href="actions-file.html#BLOCK">-block</a></tt>
4705         applies, so (unless it matches <span class="emphasis"><i class=
4706         "EMPHASIS">again</i></span> further down) it ends up with no
4707         <tt class="LITERAL"><a href="actions-file.html#BLOCK">block</a></tt>
4708         action applying.</p>
4709
4710         <table border="0" bgcolor="#E0E0E0" width="100%">
4711           <tr>
4712             <td>
4713               <pre class="SCREEN">
4714 ##########################################################################
4715 # Save some innocent victims of the above generic block patterns:
4716 ##########################################################################
4717
4718 # By domain:
4719 #
4720 { -<a href="actions-file.html#BLOCK">block</a> }
4721 adv[io]*.  # (for advogato.org and advice.*)
4722 adsl.      # (has nothing to do with ads)
4723 adobe.     # (has nothing to do with ads either)
4724 ad[ud]*.   # (adult.* and add.*)
4725 .edu       # (universities don't host banners (yet!))
4726 .*loads.   # (downloads, uploads etc)
4727
4728 # By path:
4729 #
4730 /.*loads/
4731
4732 # Site-specific:
4733 #
4734 www.globalintersec.com/adv # (adv = advanced)
4735 www.ugu.com/sui/ugu/adv
4736 </pre>
4737             </td>
4738           </tr>
4739         </table>
4740
4741         <p>Filtering source code can have nasty side effects, so make an
4742         exception for our friends at sourceforge.net, and all paths with
4743         <span class="QUOTE">"cvs"</span> in them. Note that <tt class=
4744         "LITERAL">-<a href="actions-file.html#FILTER">filter</a></tt>
4745         disables <span class="emphasis"><i class="EMPHASIS">all</i></span>
4746         filters in one fell swoop!</p>
4747
4748         <table border="0" bgcolor="#E0E0E0" width="100%">
4749           <tr>
4750             <td>
4751               <pre class="SCREEN">
4752 # Don't filter code!
4753 #
4754 { -<a href="actions-file.html#FILTER">filter</a> }
4755 /(.*/)?cvs
4756 bugzilla.
4757 developer.
4758 wiki.
4759 .sourceforge.net
4760 </pre>
4761             </td>
4762           </tr>
4763         </table>
4764
4765         <p>The actual <tt class="FILENAME">default.action</tt> is of course
4766         much more comprehensive, but we hope this example made clear how it
4767         works.</p>
4768       </div>
4769
4770       <div class="SECT3">
4771         <h3 class="SECT3"><a name="AEN4905" id="AEN4905">8.7.3.
4772         user.action</a></h3>
4773
4774         <p>So far we are painting with a broad brush by setting general
4775         policies, which would be a reasonable starting point for many people.
4776         Now, you might want to be more specific and have customized rules
4777         that are more suitable to your personal habits and preferences. These
4778         would be for narrowly defined situations like your ISP or your bank,
4779         and should be placed in <tt class="FILENAME">user.action</tt>, which
4780         is parsed after all other actions files and hence has the last word,
4781         over-riding any previously defined actions. <tt class=
4782         "FILENAME">user.action</tt> is also a <span class=
4783         "emphasis"><i class="EMPHASIS">safe</i></span> place for your
4784         personal settings, since <tt class="FILENAME">default.action</tt> is
4785         actively maintained by the <span class="APPLICATION">Privoxy</span>
4786         developers and you'll probably want to install updated versions from
4787         time to time.</p>
4788
4789         <p>So let's look at a few examples of things that one might typically
4790         do in <tt class="FILENAME">user.action</tt>:</p>
4791
4792         <table border="0" bgcolor="#E0E0E0" width="100%">
4793           <tr>
4794             <td>
4795               <pre class="SCREEN">
4796 # My user.action file. &lt;fred@example.com&gt;
4797 </pre>
4798             </td>
4799           </tr>
4800         </table>
4801
4802         <p>As <a href="actions-file.html#ALIASES">aliases</a> are local to
4803         the actions file that they are defined in, you can't use the ones
4804         from <tt class="FILENAME">default.action</tt>, unless you repeat them
4805         here:</p>
4806
4807         <table border="0" bgcolor="#E0E0E0" width="100%">
4808           <tr>
4809             <td>
4810               <pre class="SCREEN">
4811 # Aliases are local to the file they are defined in.
4812 # (Re-)define aliases for this file:
4813 #
4814 {{alias}}
4815 #
4816 # These aliases just save typing later, and the alias names should
4817 # be self explanatory.
4818 #
4819 +crunch-all-cookies = +crunch-incoming-cookies +crunch-outgoing-cookies
4820 -crunch-all-cookies = -crunch-incoming-cookies -crunch-outgoing-cookies
4821  allow-all-cookies  = -crunch-all-cookies -session-cookies-only
4822  allow-popups       = -filter{all-popups}
4823 +block-as-image     = +block{Blocked as image.} +handle-as-image
4824 -block-as-image     = -block
4825
4826 # These aliases define combinations of actions that are useful for
4827 # certain types of sites:
4828 #
4829 fragile     = -block -crunch-all-cookies -filter -fast-redirects -hide-referrer
4830 shop        = -crunch-all-cookies allow-popups
4831
4832 # Allow ads for selected useful free sites:
4833 #
4834 allow-ads   = -block -filter{banners-by-size} -filter{banners-by-link}
4835
4836 # Alias for specific file types that are text, but might have conflicting
4837 # MIME types. We want the browser to force these to be text documents.
4838 handle-as-text = -<a href="actions-file.html#FILTER">filter</a> +-<a href=
4839 "actions-file.html#CONTENT-TYPE-OVERWRITE">content-type-overwrite{text/plain}</a> +-<a href="actions-file.html#FORCE-TEXT-MODE">force-text-mode</a> -<a href="actions-file.html#HIDE-CONTENT-DISPOSITION">hide-content-disposition</a>
4840 </pre>
4841             </td>
4842           </tr>
4843         </table>
4844
4845         <p>Say you have accounts on some sites that you visit regularly, and
4846         you don't want to have to log in manually each time. So you'd like to
4847         allow persistent cookies for these sites. The <tt class=
4848         "LITERAL">allow-all-cookies</tt> alias defined above does exactly
4849         that, i.e. it disables crunching of cookies in any direction, and the
4850         processing of cookies to make them only temporary.</p>
4851
4852         <table border="0" bgcolor="#E0E0E0" width="100%">
4853           <tr>
4854             <td>
4855               <pre class="SCREEN">
4856 { allow-all-cookies }
4857  sourceforge.net
4858  .yahoo.com
4859  .msdn.microsoft.com
4860  .redhat.com
4861 </pre>
4862             </td>
4863           </tr>
4864         </table>
4865
4866         <p>Your bank is allergic to some filter, but you don't know which, so
4867         you disable them all:</p>
4868
4869         <table border="0" bgcolor="#E0E0E0" width="100%">
4870           <tr>
4871             <td>
4872               <pre class="SCREEN">
4873 { -<a href="actions-file.html#FILTER">filter</a> }
4874  .your-home-banking-site.com
4875 </pre>
4876             </td>
4877           </tr>
4878         </table>
4879
4880         <p>Some file types you may not want to filter for various
4881         reasons:</p>
4882
4883         <table border="0" bgcolor="#E0E0E0" width="100%">
4884           <tr>
4885             <td>
4886               <pre class="SCREEN">
4887 # Technical documentation is likely to contain strings that might
4888 # erroneously get altered by the JavaScript-oriented filters:
4889 #
4890 .tldp.org
4891 /(.*/)?selfhtml/
4892
4893 # And this stupid host sends streaming video with a wrong MIME type,
4894 # so that Privoxy thinks it is getting HTML and starts filtering:
4895 #
4896 stupid-server.example.com/
4897 </pre>
4898             </td>
4899           </tr>
4900         </table>
4901
4902         <p>Example of a simple <a href="actions-file.html#BLOCK">block</a>
4903         action. Say you've seen an ad on your favourite page on example.com
4904         that you want to get rid of. You have right-clicked the image,
4905         selected <span class="QUOTE">"copy image location"</span> and pasted
4906         the URL below while removing the leading http://, into a <tt class=
4907         "LITERAL">{ +block{} }</tt> section. Note that <tt class="LITERAL">{
4908         +handle-as-image }</tt> need not be specified, since all URLs ending
4909         in <tt class="LITERAL">.gif</tt> will be tagged as images by the
4910         general rules as set in default.action anyway:</p>
4911
4912         <table border="0" bgcolor="#E0E0E0" width="100%">
4913           <tr>
4914             <td>
4915               <pre class="SCREEN">
4916 { +<a href="actions-file.html#BLOCK">block</a>{Nasty ads.} }
4917  www.example.com/nasty-ads/sponsor\.gif
4918  another.example.net/more/junk/here/
4919 </pre>
4920             </td>
4921           </tr>
4922         </table>
4923
4924         <p>The URLs of dynamically generated banners, especially from large
4925         banner farms, often don't use the well-known image file name
4926         extensions, which makes it impossible for <span class=
4927         "APPLICATION">Privoxy</span> to guess the file type just by looking
4928         at the URL. You can use the <tt class="LITERAL">+block-as-image</tt>
4929         alias defined above for these cases. Note that objects which match
4930         this rule but then turn out NOT to be an image are typically rendered
4931         as a <span class="QUOTE">"broken image"</span> icon by the browser.
4932         Use cautiously.</p>
4933
4934         <table border="0" bgcolor="#E0E0E0" width="100%">
4935           <tr>
4936             <td>
4937               <pre class="SCREEN">
4938 { +block-as-image }
4939  .doubleclick.net
4940  .fastclick.net
4941  /Realmedia/ads/
4942  ar.atwola.com/
4943 </pre>
4944             </td>
4945           </tr>
4946         </table>
4947
4948         <p>Now you noticed that the default configuration breaks Forbes
4949         Magazine, but you were too lazy to find out which action is the
4950         culprit, and you were again too lazy to give <a href=
4951         "contact.html">feedback</a>, so you just used the <tt class=
4952         "LITERAL">fragile</tt> alias on the site, and -- <span class=
4953         "emphasis"><i class="EMPHASIS">whoa!</i></span> -- it worked. The
4954         <tt class="LITERAL">fragile</tt> aliases disables those actions that
4955         are most likely to break a site. Also, good for testing purposes to
4956         see if it is <span class="APPLICATION">Privoxy</span> that is causing
4957         the problem or not. We later find other regular sites that misbehave,
4958         and add those to our personalized list of troublemakers:</p>
4959
4960         <table border="0" bgcolor="#E0E0E0" width="100%">
4961           <tr>
4962             <td>
4963               <pre class="SCREEN">
4964 { fragile }
4965  .forbes.com
4966  webmail.example.com
4967  .mybank.com
4968 </pre>
4969             </td>
4970           </tr>
4971         </table>
4972
4973         <p>You like the <span class="QUOTE">"fun"</span> text replacements in
4974         <tt class="FILENAME">default.filter</tt>, but it is disabled in the
4975         distributed actions file. So you'd like to turn it on in your
4976         private, update-safe config, once and for all:</p>
4977
4978         <table border="0" bgcolor="#E0E0E0" width="100%">
4979           <tr>
4980             <td>
4981               <pre class="SCREEN">
4982 { +<a href="actions-file.html#FILTER-FUN">filter{fun}</a> }
4983  / # For ALL sites!
4984 </pre>
4985             </td>
4986           </tr>
4987         </table>
4988
4989         <p>Note that the above is not really a good idea: There are
4990         exceptions to the filters in <tt class="FILENAME">default.action</tt>
4991         for things that really shouldn't be filtered, like code on
4992         CVS-&gt;Web interfaces. Since <tt class="FILENAME">user.action</tt>
4993         has the last word, these exceptions won't be valid for the
4994         <span class="QUOTE">"fun"</span> filtering specified here.</p>
4995
4996         <p>You might also worry about how your favourite free websites are
4997         funded, and find that they rely on displaying banner advertisements
4998         to survive. So you might want to specifically allow banners for those
4999         sites that you feel provide value to you:</p>
5000
5001         <table border="0" bgcolor="#E0E0E0" width="100%">
5002           <tr>
5003             <td>
5004               <pre class="SCREEN">
5005 { allow-ads }
5006  .sourceforge.net
5007  .slashdot.org
5008  .osdn.net
5009 </pre>
5010             </td>
5011           </tr>
5012         </table>
5013
5014         <p>Note that <tt class="LITERAL">allow-ads</tt> has been aliased to
5015         <tt class="LITERAL">-<a href=
5016         "actions-file.html#BLOCK">block</a></tt>, <tt class=
5017         "LITERAL">-<a href=
5018         "actions-file.html#FILTER-BANNERS-BY-SIZE">filter{banners-by-size}</a></tt>,
5019         and <tt class="LITERAL">-<a href=
5020         "actions-file.html#FILTER-BANNERS-BY-LINK">filter{banners-by-link}</a></tt>
5021         above.</p>
5022
5023         <p>Invoke another alias here to force an over-ride of the MIME type
5024         <tt class="LITERAL">application/x-sh</tt> which typically would open
5025         a download type dialog. In my case, I want to look at the shell
5026         script, and then I can save it should I choose to.</p>
5027
5028         <table border="0" bgcolor="#E0E0E0" width="100%">
5029           <tr>
5030             <td>
5031               <pre class="SCREEN">
5032 { handle-as-text }
5033  /.*\.sh$
5034 </pre>
5035             </td>
5036           </tr>
5037         </table>
5038
5039         <p><tt class="FILENAME">user.action</tt> is generally the best place
5040         to define exceptions and additions to the default policies of
5041         <tt class="FILENAME">default.action</tt>. Some actions are safe to
5042         have their default policies set here though. So let's set a default
5043         policy to have a <span class="QUOTE">"blank"</span> image as opposed
5044         to the checkerboard pattern for <span class="emphasis"><i class=
5045         "EMPHASIS">ALL</i></span> sites. <span class="QUOTE">"/"</span> of
5046         course matches all URL paths and patterns:</p>
5047
5048         <table border="0" bgcolor="#E0E0E0" width="100%">
5049           <tr>
5050             <td>
5051               <pre class="SCREEN">
5052 { +<a href=
5053 "actions-file.html#SET-IMAGE-BLOCKER">set-image-blocker{blank}</a> }
5054 / # ALL sites
5055 </pre>
5056             </td>
5057           </tr>
5058         </table>
5059       </div>
5060     </div>
5061   </div>
5062
5063   <div class="NAVFOOTER">
5064     <hr align="left" width="100%">
5065
5066     <table summary="Footer navigation table" width="100%" border="0"
5067     cellpadding="0" cellspacing="0">
5068       <tr>
5069         <td width="33%" align="left" valign="top"><a href="config.html"
5070         accesskey="P">Prev</a></td>
5071
5072         <td width="34%" align="center" valign="top"><a href="index.html"
5073         accesskey="H">Home</a></td>
5074
5075         <td width="33%" align="right" valign="top"><a href="filter-file.html"
5076         accesskey="N">Next</a></td>
5077       </tr>
5078
5079       <tr>
5080         <td width="33%" align="left" valign="top">The Main Configuration
5081         File</td>
5082
5083         <td width="34%" align="center" valign="top">&nbsp;</td>
5084
5085         <td width="33%" align="right" valign="top">Filter Files</td>
5086       </tr>
5087     </table>
5088   </div>
5089 </body>
5090 </html>