1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
6 <title>Appendix</title>
7 <meta name="GENERATOR" content=
8 "Modular DocBook HTML Stylesheet Version 1.79">
9 <link rel="HOME" title="Privoxy 3.0.25 User Manual" href="index.html">
10 <link rel="PREVIOUS" title="See Also" href="seealso.html">
11 <link rel="STYLESHEET" type="text/css" href="../p_doc.css">
12 <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
13 <link rel="STYLESHEET" type="text/css" href="p_doc.css">
16 <body class="SECT1" bgcolor="#EEEEEE" text="#000000" link="#0000FF" vlink=
17 "#840084" alink="#0000FF">
18 <div class="NAVHEADER">
19 <table summary="Header navigation table" width="100%" border="0"
20 cellpadding="0" cellspacing="0">
22 <th colspan="3" align="center">Privoxy 3.0.25 User Manual</th>
26 <td width="10%" align="left" valign="bottom"><a href="seealso.html"
27 accesskey="P">Prev</a></td>
29 <td width="80%" align="center" valign="bottom"></td>
31 <td width="10%" align="right" valign="bottom"> </td>
34 <hr align="left" width="100%">
38 <h1 class="SECT1"><a name="APPENDIX" id="APPENDIX">14. Appendix</a></h1>
41 <h2 class="SECT2"><a name="REGEX" id="REGEX">14.1. Regular
44 <p><span class="APPLICATION">Privoxy</span> uses Perl-style
45 <span class="QUOTE">"regular expressions"</span> in its <a href=
46 "actions-file.html">actions files</a> and <a href=
47 "filter-file.html">filter file</a>, through the <a href=
48 "http://www.pcre.org/" target="_top">PCRE</a> and <span class=
49 "APPLICATION">PCRS</span> libraries.</p>
51 <p>If you are reading this, you probably don't understand what
52 <span class="QUOTE">"regular expressions"</span> are, or what they can
53 do. So this will be a very brief introduction only. A full explanation
54 would require a <a href="http://www.oreilly.com/catalog/regex/" target=
55 "_top">book</a> ;-)</p>
57 <p>Regular expressions provide a language to describe patterns that can
58 be run against strings of characters (letter, numbers, etc), to see if
59 they match the string or not. The patterns are themselves (sometimes
60 complex) strings of literal characters, combined with wild-cards, and
61 other special characters, called meta-characters. The <span class=
62 "QUOTE">"meta-characters"</span> have special meanings and are used to
63 build complex patterns to be matched against. Perl Compatible Regular
64 Expressions are an especially convenient <span class=
65 "QUOTE">"dialect"</span> of the regular expression language.</p>
67 <p>To make a simple analogy, we do something similar when we use
68 wild-card characters when listing files with the <b class=
69 "COMMAND">dir</b> command in DOS. <tt class="LITERAL">*.*</tt> matches
70 all filenames. The <span class="QUOTE">"special"</span> character here
71 is the asterisk which matches any and all characters. We can be more
72 specific and use <tt class="LITERAL">?</tt> to match just individual
73 characters. So <span class="QUOTE">"dir file?.text"</span> would match
74 <span class="QUOTE">"file1.txt"</span>, <span class=
75 "QUOTE">"file2.txt"</span>, etc. We are pattern matching, using a
76 similar technique to <span class="QUOTE">"regular
77 expressions"</span>!</p>
79 <p>Regular expressions do essentially the same thing, but are much,
80 much more powerful. There are many more <span class="QUOTE">"special
81 characters"</span> and ways of building complex patterns however. Let's
82 look at a few of the common ones, and then some examples:</p>
87 <td><span class="emphasis"><i class="EMPHASIS">.</i></span> -
88 Matches any single character, e.g. <span class=
89 "QUOTE">"a"</span>, <span class="QUOTE">"A"</span>, <span class=
90 "QUOTE">"4"</span>, <span class="QUOTE">":"</span>, or
91 <span class="QUOTE">"@"</span>.</td>
99 <td><span class="emphasis"><i class="EMPHASIS">?</i></span> - The
100 preceding character or expression is matched ZERO or ONE times.
109 <td><span class="emphasis"><i class="EMPHASIS">+</i></span> - The
110 preceding character or expression is matched ONE or MORE
119 <td><span class="emphasis"><i class="EMPHASIS">*</i></span> - The
120 preceding character or expression is matched ZERO or MORE
129 <td><span class="emphasis"><i class="EMPHASIS">\</i></span> - The
130 <span class="QUOTE">"escape"</span> character denotes that the
131 following character should be taken literally. This is used where
132 one of the special characters (e.g. <span class=
133 "QUOTE">"."</span>) needs to be taken literally and not as a
134 special meta-character. Example: <span class=
135 "QUOTE">"example\.com"</span>, makes sure the period is
136 recognized only as a period (and not expanded to its
137 meta-character meaning of any single character).</td>
145 <td><span class="emphasis"><i class="EMPHASIS">[ ]</i></span> -
146 Characters enclosed in brackets will be matched if any of the
147 enclosed characters are encountered. For instance, <span class=
148 "QUOTE">"[0-9]"</span> matches any numeric digit (zero through
149 nine). As an example, we can combine this with <span class=
150 "QUOTE">"+"</span> to match any digit one of more times:
151 <span class="QUOTE">"[0-9]+"</span>.</td>
159 <td><span class="emphasis"><i class="EMPHASIS">( )</i></span> -
160 parentheses are used to group a sub-expression, or multiple
161 sub-expressions.</td>
169 <td><span class="emphasis"><i class="EMPHASIS">|</i></span> - The
170 <span class="QUOTE">"bar"</span> character works like an
171 <span class="QUOTE">"or"</span> conditional statement. A match is
172 successful if the sub-expression on either side of <span class=
173 "QUOTE">"|"</span> matches. As an example: <span class=
174 "QUOTE">"/(this|that) example/"</span> uses grouping and the bar
175 character and would match either <span class="QUOTE">"this
176 example"</span> or <span class="QUOTE">"that example"</span>, and
182 <p>These are just some of the ones you are likely to use when matching
183 URLs with <span class="APPLICATION">Privoxy</span>, and is a long way
184 from a definitive list. This is enough to get us started with a few
185 simple examples which may be more illuminating:</p>
187 <p><span class="emphasis"><i class="EMPHASIS"><tt class=
188 "LITERAL">/.*/banners/.*</tt></i></span> - A simple example that uses
189 the common combination of <span class="QUOTE">"."</span> and
190 <span class="QUOTE">"*"</span> to denote any character, zero or more
191 times. In other words, any string at all. So we start with a literal
192 forward slash, then our regular expression pattern (<span class=
193 "QUOTE">".*"</span>) another literal forward slash, the string
194 <span class="QUOTE">"banners"</span>, another forward slash, and lastly
195 another <span class="QUOTE">".*"</span>. We are building a directory
196 path here. This will match any file with the path that has a directory
197 named <span class="QUOTE">"banners"</span> in it. The <span class=
198 "QUOTE">".*"</span> matches any characters, and this could conceivably
199 be more forward slashes, so it might expand into a much longer looking
200 path. For example, this could match: <span class=
201 "QUOTE">"/eye/hate/spammers/banners/annoy_me_please.gif"</span>, or
202 just <span class="QUOTE">"/banners/annoying.html"</span>, or almost an
203 infinite number of other possible combinations, just so it has
204 <span class="QUOTE">"banners"</span> in the path somewhere.</p>
206 <p>And now something a little more complex:</p>
208 <p><span class="emphasis"><i class="EMPHASIS"><tt class=
209 "LITERAL">/.*/adv((er)?ts?|ertis(ing|ements?))?/</tt></i></span> - We
210 have several literal forward slashes again (<span class=
211 "QUOTE">"/"</span>), so we are building another expression that is a
212 file path statement. We have another <span class="QUOTE">".*"</span>,
213 so we are matching against any conceivable sub-path, just so it matches
214 our expression. The only true literal that <span class=
215 "emphasis"><i class="EMPHASIS">must match</i></span> our pattern is
216 <span class="APPLICATION">adv</span>, together with the forward
217 slashes. What comes after the <span class="QUOTE">"adv"</span> string
218 is the interesting part.</p>
220 <p>Remember the <span class="QUOTE">"?"</span> means the preceding
221 expression (either a literal character or anything grouped with
222 <span class="QUOTE">"(...)"</span> in this case) can exist or not,
223 since this means either zero or one match. So <span class=
224 "QUOTE">"((er)?ts?|ertis(ing|ements?))"</span> is optional, as are the
225 individual sub-expressions: <span class="QUOTE">"(er)"</span>,
226 <span class="QUOTE">"(ing|ements?)"</span>, and the <span class=
227 "QUOTE">"s"</span>. The <span class="QUOTE">"|"</span> means
228 <span class="QUOTE">"or"</span>. We have two of those. For instance,
229 <span class="QUOTE">"(ing|ements?)"</span>, can expand to match either
230 <span class="QUOTE">"ing"</span> <span class="emphasis"><i class=
231 "EMPHASIS">OR</i></span> <span class="QUOTE">"ements?"</span>. What is
232 being done here, is an attempt at matching as many variations of
233 <span class="QUOTE">"advertisement"</span>, and similar, as possible.
234 So this would expand to match just <span class="QUOTE">"adv"</span>, or
235 <span class="QUOTE">"advert"</span>, or <span class=
236 "QUOTE">"adverts"</span>, or <span class="QUOTE">"advertising"</span>,
237 or <span class="QUOTE">"advertisement"</span>, or <span class=
238 "QUOTE">"advertisements"</span>. You get the idea. But it would not
239 match <span class="QUOTE">"advertizements"</span> (with a <span class=
240 "QUOTE">"z"</span>). We could fix that by changing our regular
241 expression to: <span class=
242 "QUOTE">"/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/"</span>, which
243 would then match either spelling.</p>
245 <p><span class="emphasis"><i class="EMPHASIS"><tt class=
246 "LITERAL">/.*/advert[0-9]+\.(gif|jpe?g)</tt></i></span> - Again another
247 path statement with forward slashes. Anything in the square brackets
248 <span class="QUOTE">"[ ]"</span> can be matched. This is using
249 <span class="QUOTE">"0-9"</span> as a shorthand expression to mean any
250 digit one through nine. It is the same as saying <span class=
251 "QUOTE">"0123456789"</span>. So any digit matches. The <span class=
252 "QUOTE">"+"</span> means one or more of the preceding expression must
253 be included. The preceding expression here is what is in the square
254 brackets -- in this case, any digit one through nine. Then, at the end,
255 we have a grouping: <span class="QUOTE">"(gif|jpe?g)"</span>. This
256 includes a <span class="QUOTE">"|"</span>, so this needs to match the
257 expression on either side of that bar character also. A simple
258 <span class="QUOTE">"gif"</span> on one side, and the other side will
259 in turn match either <span class="QUOTE">"jpeg"</span> or <span class=
260 "QUOTE">"jpg"</span>, since the <span class="QUOTE">"?"</span> means
261 the letter <span class="QUOTE">"e"</span> is optional and can be
262 matched once or not at all. So we are building an expression here to
263 match image GIF or JPEG type image file. It must include the literal
264 string <span class="QUOTE">"advert"</span>, then one or more digits,
265 and a <span class="QUOTE">"."</span> (which is now a literal, and not a
266 special character, since it is escaped with <span class=
267 "QUOTE">"\"</span>), and lastly either <span class=
268 "QUOTE">"gif"</span>, or <span class="QUOTE">"jpeg"</span>, or
269 <span class="QUOTE">"jpg"</span>. Some possible matches would include:
270 <span class="QUOTE">"//advert1.jpg"</span>, <span class=
271 "QUOTE">"/nasty/ads/advert1234.gif"</span>, <span class=
272 "QUOTE">"/banners/from/hell/advert99.jpg"</span>. It would not match
273 <span class="QUOTE">"advert1.gif"</span> (no leading slash), or
274 <span class="QUOTE">"/adverts232.jpg"</span> (the expression does not
275 include an <span class="QUOTE">"s"</span>), or <span class=
276 "QUOTE">"/advert1.jsp"</span> (<span class="QUOTE">"jsp"</span> is not
277 in the expression anywhere).</p>
279 <p>We are barely scratching the surface of regular expressions here so
280 that you can understand the default <span class=
281 "APPLICATION">Privoxy</span> configuration files, and maybe use this
282 knowledge to customize your own installation. There is much, much more
283 that can be done with regular expressions. Now that you know enough to
284 get started, you can learn more on your own :/</p>
286 <p>More reading on Perl Compatible Regular expressions: <a href=
287 "http://perldoc.perl.org/perlre.html" target=
288 "_top">http://perldoc.perl.org/perlre.html</a></p>
290 <p>For information on regular expression based substitutions and their
291 applications in filters, please see the <a href=
292 "filter-file.html">filter file tutorial</a> in this manual.</p>
296 <h2 class="SECT2"><a name="INTERNAL-PAGES" id="INTERNAL-PAGES">14.2.
297 Privoxy's Internal Pages</a></h2>
299 <p>Since <span class="APPLICATION">Privoxy</span> proxies each
300 requested web page, it is easy for <span class=
301 "APPLICATION">Privoxy</span> to trap certain special URLs. In this way,
302 we can talk directly to <span class="APPLICATION">Privoxy</span>, and
303 see how it is configured, see how our rules are being applied, change
304 these rules and other configuration options, and even turn <span class=
305 "APPLICATION">Privoxy's</span> filtering off, all with a web
308 <p>The URLs listed below are the special ones that allow direct access
309 to <span class="APPLICATION">Privoxy</span>. Of course, <span class=
310 "APPLICATION">Privoxy</span> must be running to access these. If not,
311 you will get a friendly error message. Internet access is not necessary
316 <p>Privoxy main page:</p><a name="AEN5885" id="AEN5885"></a>
318 <blockquote class="BLOCKQUOTE">
319 <p><a href="http://config.privoxy.org/" target=
320 "_top">http://config.privoxy.org/</a></p>
323 <p>There is a shortcut: <a href="http://p.p/" target=
324 "_top">http://p.p/</a> (But it doesn't provide a fall-back to a
325 real page, in case the request is not sent through <span class=
326 "APPLICATION">Privoxy</span>)</p>
330 <p>Show information about the current configuration, including
331 viewing and editing of actions files:</p><a name="AEN5893" id=
334 <blockquote class="BLOCKQUOTE">
335 <p><a href="http://config.privoxy.org/show-status" target=
336 "_top">http://config.privoxy.org/show-status</a></p>
341 <p>Show the source code version numbers:</p><a name="AEN5898" id=
344 <blockquote class="BLOCKQUOTE">
345 <p><a href="http://config.privoxy.org/show-version" target=
346 "_top">http://config.privoxy.org/show-version</a></p>
351 <p>Show the browser's request headers:</p><a name="AEN5903" id=
354 <blockquote class="BLOCKQUOTE">
355 <p><a href="http://config.privoxy.org/show-request" target=
356 "_top">http://config.privoxy.org/show-request</a></p>
361 <p>Show which actions apply to a URL and why:</p><a name="AEN5908"
364 <blockquote class="BLOCKQUOTE">
365 <p><a href="http://config.privoxy.org/show-url-info" target=
366 "_top">http://config.privoxy.org/show-url-info</a></p>
371 <p>Toggle Privoxy on or off. This feature can be turned off/on in
372 the main <tt class="FILENAME">config</tt> file. When toggled
373 <span class="QUOTE">"off"</span>, <span class=
374 "QUOTE">"Privoxy"</span> continues to run, but only as a
375 pass-through proxy, with no actions taking place:</p><a name=
376 "AEN5916" id="AEN5916"></a>
378 <blockquote class="BLOCKQUOTE">
379 <p><a href="http://config.privoxy.org/toggle" target=
380 "_top">http://config.privoxy.org/toggle</a></p>
383 <p>Short cuts. Turn off, then on:</p><a name="AEN5920" id=
386 <blockquote class="BLOCKQUOTE">
387 <p><a href="http://config.privoxy.org/toggle?set=disable" target=
388 "_top">http://config.privoxy.org/toggle?set=disable</a></p>
389 </blockquote><a name="AEN5923" id="AEN5923"></a>
391 <blockquote class="BLOCKQUOTE">
392 <p><a href="http://config.privoxy.org/toggle?set=enable" target=
393 "_top">http://config.privoxy.org/toggle?set=enable</a></p>
400 <h2 class="SECT2"><a name="CHAIN" id="CHAIN">14.3. Chain of
403 <p>Let's take a quick look at how some of <span class=
404 "APPLICATION">Privoxy's</span> core features are triggered, and the
405 ensuing sequence of events when a web page is requested by your
410 <p>First, your web browser requests a web page. The browser knows
411 to send the request to <span class="APPLICATION">Privoxy</span>,
412 which will in turn, relay the request to the remote web server
413 after passing the following tests:</p>
417 <p><span class="APPLICATION">Privoxy</span> traps any request for
418 its own internal CGI pages (e.g <a href="http://p.p/" target=
419 "_top">http://p.p/</a>) and sends the CGI page back to the
424 <p>Next, <span class="APPLICATION">Privoxy</span> checks to see if
425 the URL matches any <a href="actions-file.html#BLOCK"><span class=
426 "QUOTE">"+block"</span></a> patterns. If so, the URL is then
427 blocked, and the remote web server will not be contacted. <a href=
428 "actions-file.html#HANDLE-AS-IMAGE"><span class=
429 "QUOTE">"+handle-as-image"</span></a> and <a href=
430 "actions-file.html#HANDLE-AS-EMPTY-DOCUMENT"><span class=
431 "QUOTE">"+handle-as-empty-document"</span></a> are then checked,
432 and if there is no match, an HTML <span class=
433 "QUOTE">"BLOCKED"</span> page is sent back to the browser.
434 Otherwise, if it does match, an image is returned for the former,
435 and an empty text document for the latter. The type of image would
436 depend on the setting of <a href=
437 "actions-file.html#SET-IMAGE-BLOCKER"><span class=
438 "QUOTE">"+set-image-blocker"</span></a> (blank, checkerboard
439 pattern, or an HTTP redirect to an image elsewhere).</p>
443 <p>Untrusted URLs are blocked. If URLs are being added to the
444 <tt class="FILENAME">trust</tt> file, then that is done.</p>
448 <p>If the URL pattern matches the <a href=
449 "actions-file.html#FAST-REDIRECTS"><span class=
450 "QUOTE">"+fast-redirects"</span></a> action, it is then processed.
451 Unwanted parts of the requested URL are stripped.</p>
455 <p>Now the rest of the client browser's request headers are
456 processed. If any of these match any of the relevant actions (e.g.
457 <a href="actions-file.html#HIDE-USER-AGENT"><span class=
458 "QUOTE">"+hide-user-agent"</span></a>, etc.), headers are
459 suppressed or forged as determined by these actions and their
464 <p>Now the web server starts sending its response back (i.e.
465 typically a web page).</p>
469 <p>First, the server headers are read and processed to determine,
470 among other things, the MIME type (document type) and encoding. The
471 headers are then filtered as determined by the <a href=
472 "actions-file.html#CRUNCH-INCOMING-COOKIES"><span class=
473 "QUOTE">"+crunch-incoming-cookies"</span></a>, <a href=
474 "actions-file.html#SESSION-COOKIES-ONLY"><span class=
475 "QUOTE">"+session-cookies-only"</span></a>, and <a href=
476 "actions-file.html#DOWNGRADE-HTTP-VERSION"><span class=
477 "QUOTE">"+downgrade-http-version"</span></a> actions.</p>
481 <p>If any <a href="actions-file.html#FILTER"><span class=
482 "QUOTE">"+filter"</span></a> action or <a href=
483 "actions-file.html#DEANIMATE-GIFS"><span class=
484 "QUOTE">"+deanimate-gifs"</span></a> action applies (and the
485 document type fits the action), the rest of the page is read into
486 memory (up to a configurable limit). Then the filter rules (from
487 <tt class="FILENAME">default.filter</tt> and any other filter
488 files) are processed against the buffered content. Filters are
489 applied in the order they are specified in one of the filter files.
490 Animated GIFs, if present, are reduced to either the first or last
491 frame, depending on the action setting.The entire page, which is
492 now filtered, is then sent by <span class=
493 "APPLICATION">Privoxy</span> back to your browser.</p>
495 <p>If neither a <a href="actions-file.html#FILTER"><span class=
496 "QUOTE">"+filter"</span></a> action or <a href=
497 "actions-file.html#DEANIMATE-GIFS"><span class=
498 "QUOTE">"+deanimate-gifs"</span></a> matches, then <span class=
499 "APPLICATION">Privoxy</span> passes the raw data through to the
500 client browser as it becomes available.</p>
504 <p>As the browser receives the now (possibly filtered) page
505 content, it reads and then requests any URLs that may be embedded
506 within the page source, e.g. ad images, stylesheets, JavaScript,
507 other HTML documents (e.g. frames), sounds, etc. For each of these
508 objects, the browser issues a separate request (this is easily
509 viewable in <span class="APPLICATION">Privoxy's</span> logs). And
510 each such request is in turn processed just as above. Note that a
511 complex web page will have many, many such embedded URLs. If these
512 secondary requests are to a different server, then quite possibly a
513 very differing set of actions is triggered.</p>
517 <p>NOTE: This is somewhat of a simplistic overview of what happens with
518 each URL request. For the sake of brevity and simplicity, we have
519 focused on <span class="APPLICATION">Privoxy's</span> core features
524 <h2 class="SECT2"><a name="ACTIONSANAT" id="ACTIONSANAT">14.4.
525 Troubleshooting: Anatomy of an Action</a></h2>
527 <p>The way <span class="APPLICATION">Privoxy</span> applies <a href=
528 "actions-file.html#ACTIONS">actions</a> and <a href=
529 "actions-file.html#FILTER">filters</a> to any given URL can be complex,
530 and not always so easy to understand what is happening. And sometimes
531 we need to be able to <span class="emphasis"><i class=
532 "EMPHASIS">see</i></span> just what <span class=
533 "APPLICATION">Privoxy</span> is doing. Especially, if something
534 <span class="APPLICATION">Privoxy</span> is doing is causing us a
535 problem inadvertently. It can be a little daunting to look at the
536 actions and filters files themselves, since they tend to be filled with
537 <a href="appendix.html#REGEX">regular expressions</a> whose
538 consequences are not always so obvious.</p>
540 <p>One quick test to see if <span class="APPLICATION">Privoxy</span> is
541 causing a problem or not, is to disable it temporarily. This should be
542 the first troubleshooting step (be sure to flush caches afterward!).
543 Looking at the logs is a good idea too. (Note that both the toggle
544 feature and logging are enabled via <tt class="FILENAME">config</tt>
545 file settings, and may need to be turned <span class=
546 "QUOTE">"on"</span>.)</p>
548 <p>Another easy troubleshooting step to try is if you have done any
549 customization of your installation, revert back to the installed
550 defaults and see if that helps. There are times the developers get
551 complaints about one thing or another, and the problem is more related
552 to a customized configuration issue.</p>
554 <p><span class="APPLICATION">Privoxy</span> also provides the <a href=
555 "http://config.privoxy.org/show-url-info" target=
556 "_top">http://config.privoxy.org/show-url-info</a> page that can show
557 us very specifically how <span class="APPLICATION">actions</span> are
558 being applied to any given URL. This is a big help for
561 <p>First, enter one URL (or partial URL) at the prompt, and then
562 <span class="APPLICATION">Privoxy</span> will tell us how the current
563 configuration will handle it. This will not help with filtering effects
564 (i.e. the <a href="actions-file.html#FILTER"><span class=
565 "QUOTE">"+filter"</span></a> action) from one of the filter files since
566 this is handled very differently and not so easy to trap! It also will
567 not tell you about any other URLs that may be embedded within the URL
568 you are testing. For instance, images such as ads are expressed as URLs
569 within the raw page source of HTML pages. So you will only get info for
570 the actual URL that is pasted into the prompt area -- not any sub-URLs.
571 If you want to know about embedded URLs like ads, you will have to dig
572 those out of the HTML source. Use your browser's <span class=
573 "QUOTE">"View Page Source"</span> option for this. Or right click on
574 the ad, and grab the URL.</p>
576 <p>Let's try an example, <a href="http://google.com" target=
577 "_top">google.com</a>, and look at it one section at a time in a sample
578 configuration (your real configuration may vary):</p>
580 <table border="0" bgcolor="#E0E0E0" width="100%">
584 Matches for http://www.google.com:
586 In file: default.action <span class="GUIBUTTON">[ View ]</span> <span class=
587 "GUIBUTTON">[ Edit ]</span>
589 {+change-x-forwarded-for{block}
590 +deanimate-gifs {last}
591 +fast-redirects {check-decoded-url}
592 +filter {refresh-tags}
593 +filter {img-reorder}
594 +filter {banners-by-size}
596 +filter {jumping-windows}
597 +filter {ie-exploits}
598 +hide-from-header {block}
599 +hide-referrer {forge}
600 +session-cookies-only
601 +set-image-blocker {pattern}
604 { -session-cookies-only }
610 In file: user.action <span class="GUIBUTTON">[ View ]</span> <span class=
611 "GUIBUTTON">[ Edit ]</span>
612 (no matches in this file)
618 <p>This is telling us how we have defined our <a href=
619 "actions-file.html#ACTIONS"><span class="QUOTE">"actions"</span></a>,
620 and which ones match for our test case, <span class=
621 "QUOTE">"google.com"</span>. Displayed is all the actions that are
622 available to us. Remember, the <tt class="LITERAL">+</tt> sign denotes
623 <span class="QUOTE">"on"</span>. <tt class="LITERAL">-</tt> denotes
624 <span class="QUOTE">"off"</span>. So some are <span class=
625 "QUOTE">"on"</span> here, but many are <span class=
626 "QUOTE">"off"</span>. Each example we try may provide a slightly
627 different end result, depending on our configuration directives.</p>
629 <p>The first listing is for our <tt class=
630 "FILENAME">default.action</tt> file. The large, multi-line listing, is
631 how the actions are set to match for all URLs, i.e. our default
632 settings. If you look at your <span class="QUOTE">"actions"</span>
633 file, this would be the section just below the <span class=
634 "QUOTE">"aliases"</span> section near the top. This will apply to all
635 URLs as signified by the single forward slash at the end of the listing
636 -- <span class="QUOTE">" / "</span>.</p>
638 <p>But we have defined additional actions that would be exceptions to
639 these general rules, and then we list specific URLs (or patterns) that
640 these exceptions would apply to. Last match wins. Just below this then
641 are two explicit matches for <span class="QUOTE">".google.com"</span>.
642 The first is negating our previous cookie setting, which was for
643 <a href="actions-file.html#SESSION-COOKIES-ONLY"><span class=
644 "QUOTE">"+session-cookies-only"</span></a> (i.e. not persistent). So we
645 will allow persistent cookies for google, at least that is how it is in
646 this example. The second turns <span class="emphasis"><i class=
647 "EMPHASIS">off</i></span> any <a href=
648 "actions-file.html#FAST-REDIRECTS"><span class=
649 "QUOTE">"+fast-redirects"</span></a> action, allowing this to take
650 place unmolested. Note that there is a leading dot here -- <span class=
651 "QUOTE">".google.com"</span>. This will match any hosts and
652 sub-domains, in the google.com domain also, such as <span class=
653 "QUOTE">"www.google.com"</span> or <span class=
654 "QUOTE">"mail.google.com"</span>. But it would not match <span class=
655 "QUOTE">"www.google.de"</span>! So, apparently, we have these two
656 actions defined as exceptions to the general rules at the top somewhere
657 in the lower part of our <tt class="FILENAME">default.action</tt> file,
658 and <span class="QUOTE">"google.com"</span> is referenced somewhere in
659 these latter sections.</p>
661 <p>Then, for our <tt class="FILENAME">user.action</tt> file, we again
662 have no hits. So there is nothing google-specific that we might have
663 added to our own, local configuration. If there was, those actions
664 would over-rule any actions from previously processed files, such as
665 <tt class="FILENAME">default.action</tt>. <tt class=
666 "FILENAME">user.action</tt> typically has the last word. This is the
667 best place to put hard and fast exceptions,</p>
669 <p>And finally we pull it all together in the bottom section and
670 summarize how <span class="APPLICATION">Privoxy</span> is applying all
671 its <span class="QUOTE">"actions"</span> to <span class=
672 "QUOTE">"google.com"</span>:</p>
674 <table border="0" bgcolor="#E0E0E0" width="100%">
682 +change-x-forwarded-for{block}
683 -client-header-filter{hide-tor-exit-notation}
684 -content-type-overwrite
685 -crunch-client-header
686 -crunch-if-none-match
687 -crunch-incoming-cookies
688 -crunch-outgoing-cookies
689 -crunch-server-header
690 +deanimate-gifs {last}
691 -downgrade-http-version
694 -filter {content-cookies}
696 -filter {banners-by-link}
697 -filter {tiny-textforms}
698 -filter {frameset-borders}
699 -filter {demoronizer}
700 -filter {shockwave-flash}
701 -filter {quicktime-kioskmode}
703 -filter {crude-parental}
704 -filter {site-specifics}
705 -filter {js-annoyances}
706 -filter {html-annoyances}
707 +filter {refresh-tags}
708 -filter {unsolicited-popups}
709 +filter {img-reorder}
710 +filter {banners-by-size}
712 +filter {jumping-windows}
713 +filter {ie-exploits}
720 -handle-as-empty-document
722 -hide-accept-language
723 -hide-content-disposition
724 +hide-from-header {block}
725 -hide-if-modified-since
726 +hide-referrer {forge}
729 -overwrite-last-modified
732 -server-header-filter{xml-to-html}
733 -server-header-filter{html-to-xml}
734 -session-cookies-only
735 +set-image-blocker {pattern}
741 <p>Notice the only difference here to the previous listing, is to
742 <span class="QUOTE">"fast-redirects"</span> and <span class=
743 "QUOTE">"session-cookies-only"</span>, which are activated specifically
744 for this site in our configuration, and thus show in the <span class=
745 "QUOTE">"Final Results"</span>.</p>
747 <p>Now another example, <span class=
748 "QUOTE">"ad.doubleclick.net"</span>:</p>
750 <table border="0" bgcolor="#E0E0E0" width="100%">
754 { +block{Domains starts with "ad"} }
757 { +block{Domain contains "ad"} }
760 { +block{Doubleclick banner server} +handle-as-image }
761 .[a-vx-z]*.doubleclick.net
767 <p>We'll just show the interesting part here - the explicit matches. It
768 is matched three different times. Two <span class=
769 "QUOTE">"+block{}"</span> sections, and a <span class="QUOTE">"+block{}
770 +handle-as-image"</span>, which is the expanded form of one of our
771 aliases that had been defined as: <span class=
772 "QUOTE">"+block-as-image"</span>. (<a href=
773 "actions-file.html#ALIASES"><span class="QUOTE">"Aliases"</span></a>
774 are defined in the first section of the actions file and typically used
775 to combine more than one action.)</p>
777 <p>Any one of these would have done the trick and blocked this as an
778 unwanted image. This is unnecessarily redundant since the last case
779 effectively would also cover the first. No point in taking chances with
780 these guys though ;-) Note that if you want an ad or obnoxious URL to
781 be invisible, it should be defined as <span class=
782 "QUOTE">"ad.doubleclick.net"</span> is done here -- as both a <a href=
783 "actions-file.html#BLOCK"><span class="QUOTE">"+block{}"</span></a>
784 <span class="emphasis"><i class="EMPHASIS">and</i></span> an <a href=
785 "actions-file.html#HANDLE-AS-IMAGE"><span class=
786 "QUOTE">"+handle-as-image"</span></a>. The custom alias <span class=
787 "QUOTE">"<tt class="LITERAL">+block-as-image</tt>"</span> just
788 simplifies the process and make it more readable.</p>
790 <p>One last example. Let's try <span class=
791 "QUOTE">"http://www.example.net/adsl/HOWTO/"</span>. This one is giving
792 us problems. We are getting a blank page. Hmmm ...</p>
794 <table border="0" bgcolor="#E0E0E0" width="100%">
798 Matches for http://www.example.net/adsl/HOWTO/:
800 In file: default.action <span class="GUIBUTTON">[ View ]</span> <span class=
801 "GUIBUTTON">[ Edit ]</span>
805 +change-x-forwarded-for{block}
806 -client-header-filter{hide-tor-exit-notation}
807 -content-type-overwrite
808 -crunch-client-header
809 -crunch-if-none-match
810 -crunch-incoming-cookies
811 -crunch-outgoing-cookies
812 -crunch-server-header
814 -downgrade-http-version
815 +fast-redirects {check-decoded-url}
817 -filter {content-cookies}
819 -filter {banners-by-link}
820 -filter {tiny-textforms}
821 -filter {frameset-borders}
822 -filter {demoronizer}
823 -filter {shockwave-flash}
824 -filter {quicktime-kioskmode}
826 -filter {crude-parental}
827 -filter {site-specifics}
828 -filter {js-annoyances}
829 -filter {html-annoyances}
830 +filter {refresh-tags}
831 -filter {unsolicited-popups}
832 +filter {img-reorder}
833 +filter {banners-by-size}
835 +filter {jumping-windows}
836 +filter {ie-exploits}
843 -handle-as-empty-document
845 -hide-accept-language
846 -hide-content-disposition
847 +hide-from-header{block}
850 -overwrite-last-modified
853 -server-header-filter{xml-to-html}
854 -server-header-filter{html-to-xml}
855 +session-cookies-only
856 +set-image-blocker{blank} }
859 { +block{Path contains "ads".} +handle-as-image }
866 <p>Ooops, the <span class="QUOTE">"/adsl/"</span> is matching
867 <span class="QUOTE">"/ads"</span> in our configuration! But we did not
868 want this at all! Now we see why we get the blank page. It is actually
869 triggering two different actions here, and the effects are aggregated
870 so that the URL is blocked, and <span class=
871 "APPLICATION">Privoxy</span> is told to treat the block as if it were
872 an image. But this is, of course, all wrong. We could now add a new
873 action below this (or better in our own <tt class=
874 "FILENAME">user.action</tt> file) that explicitly <span class=
875 "emphasis"><i class="EMPHASIS">un</i></span> blocks ( <a href=
876 "actions-file.html#BLOCK"><span class="QUOTE">"{-block}"</span></a>)
877 paths with <span class="QUOTE">"adsl"</span> in them (remember, last
878 match in the configuration wins). There are various ways to handle such
879 exceptions. Example:</p>
881 <table border="0" bgcolor="#E0E0E0" width="100%">
892 <p>Now the page displays ;-) Remember to flush your browser's caches
893 when making these kinds of changes to your configuration to insure that
894 you get a freshly delivered page! Or, try using <tt class=
895 "LITERAL">Shift+Reload</tt>.</p>
897 <p>But now what about a situation where we get no explicit matches like
900 <table border="0" bgcolor="#E0E0E0" width="100%">
904 { +block{Path starts with "ads".} +handle-as-image }
911 <p>That actually was very helpful and pointed us quickly to where the
912 problem was. If you don't get this kind of match, then it means one of
913 the default rules in the first section of <tt class=
914 "FILENAME">default.action</tt> is causing the problem. This would
915 require some guesswork, and maybe a little trial and error to isolate
916 the offending rule. One likely cause would be one of the <a href=
917 "actions-file.html#FILTER"><span class="QUOTE">"+filter"</span></a>
918 actions. These tend to be harder to troubleshoot. Try adding the URL
919 for the site to one of aliases that turn off <a href=
920 "actions-file.html#FILTER"><span class=
921 "QUOTE">"+filter"</span></a>:</p>
923 <table border="0" bgcolor="#E0E0E0" width="100%">
929 .worldpay.com # for quietpc.com
938 <p><span class="QUOTE">"<tt class="LITERAL">{ shop }</tt>"</span> is an
939 <span class="QUOTE">"alias"</span> that expands to <span class=
940 "QUOTE">"<tt class="LITERAL">{ -filter -session-cookies-only
941 }</tt>"</span>. Or you could do your own exception to negate
944 <table border="0" bgcolor="#E0E0E0" width="100%">
949 # Disable ALL filter actions for sites in this section
958 <p>This would turn off all filtering for these sites. This is best put
959 in <tt class="FILENAME">user.action</tt>, for local site exceptions.
960 Note that when a simple domain pattern is used by itself (without the
961 subsequent path portion), all sub-pages within that domain are included
962 automatically in the scope of the action.</p>
964 <p>Images that are inexplicably being blocked, may well be hitting the
965 <a href="actions-file.html#FILTER-BANNERS-BY-SIZE"><span class=
966 "QUOTE">"+filter{banners-by-size}"</span></a> rule, which assumes that
967 images of certain sizes are ad banners (works well <span class=
968 "emphasis"><i class="EMPHASIS">most of the time</i></span> since these
969 tend to be standardized).</p>
971 <p><span class="QUOTE">"<tt class="LITERAL">{ fragile }</tt>"</span> is
972 an alias that disables most actions that are the most likely to cause
973 trouble. This can be used as a last resort for problem sites.</p>
975 <table border="0" bgcolor="#E0E0E0" width="100%">
980 # Handle with care: easy to break
988 <p><span class="emphasis"><i class="EMPHASIS">Remember to flush
989 caches!</i></span> Note that the <tt class="LITERAL">mail.google</tt>
990 reference lacks the TLD portion (e.g. <span class=
991 "QUOTE">".com"</span>). This will effectively match any TLD with
992 <tt class="LITERAL">google</tt> in it, such as <tt class=
993 "LITERAL">mail.google.de.</tt>, just as an example.</p>
995 <p>If this still does not work, you will have to go through the
996 remaining actions one by one to find which one(s) is causing the
1001 <div class="NAVFOOTER">
1002 <hr align="left" width="100%">
1004 <table summary="Footer navigation table" width="100%" border="0"
1005 cellpadding="0" cellspacing="0">
1007 <td width="33%" align="left" valign="top"><a href="seealso.html"
1008 accesskey="P">Prev</a></td>
1010 <td width="34%" align="center" valign="top"><a href="index.html"
1011 accesskey="H">Home</a></td>
1013 <td width="33%" align="right" valign="top"> </td>
1017 <td width="33%" align="left" valign="top">See Also</td>
1019 <td width="34%" align="center" valign="top"> </td>
1021 <td width="33%" align="right" valign="top"> </td>