d706d0e96f96cb63daf15e1850f67406e18a3fb1
[privoxy.git] / doc / webserver / user-manual / appendix.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2 <HTML
3 ><HEAD
4 ><TITLE
5 >Appendix</TITLE
6 ><META
7 NAME="GENERATOR"
8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9 REL="HOME"
10 TITLE="Privoxy 3.0.9 User Manual"
11 HREF="index.html"><LINK
12 REL="PREVIOUS"
13 TITLE="See Also"
14 HREF="seealso.html"><LINK
15 REL="STYLESHEET"
16 TYPE="text/css"
17 HREF="../p_doc.css"><META
18 HTTP-EQUIV="Content-Type"
19 CONTENT="text/html;
20 charset=ISO-8859-1">
21 <LINK REL="STYLESHEET" TYPE="text/css" HREF="p_doc.css">
22 </head
23 ><BODY
24 CLASS="SECT1"
25 BGCOLOR="#EEEEEE"
26 TEXT="#000000"
27 LINK="#0000FF"
28 VLINK="#840084"
29 ALINK="#0000FF"
30 ><DIV
31 CLASS="NAVHEADER"
32 ><TABLE
33 SUMMARY="Header navigation table"
34 WIDTH="100%"
35 BORDER="0"
36 CELLPADDING="0"
37 CELLSPACING="0"
38 ><TR
39 ><TH
40 COLSPAN="3"
41 ALIGN="center"
42 >Privoxy 3.0.9 User Manual</TH
43 ></TR
44 ><TR
45 ><TD
46 WIDTH="10%"
47 ALIGN="left"
48 VALIGN="bottom"
49 ><A
50 HREF="seealso.html"
51 ACCESSKEY="P"
52 >Prev</A
53 ></TD
54 ><TD
55 WIDTH="80%"
56 ALIGN="center"
57 VALIGN="bottom"
58 ></TD
59 ><TD
60 WIDTH="10%"
61 ALIGN="right"
62 VALIGN="bottom"
63 >&nbsp;</TD
64 ></TR
65 ></TABLE
66 ><HR
67 ALIGN="LEFT"
68 WIDTH="100%"></DIV
69 ><DIV
70 CLASS="SECT1"
71 ><H1
72 CLASS="SECT1"
73 ><A
74 NAME="APPENDIX"
75 >14. Appendix</A
76 ></H1
77 ><DIV
78 CLASS="SECT2"
79 ><H2
80 CLASS="SECT2"
81 ><A
82 NAME="REGEX"
83 >14.1. Regular Expressions</A
84 ></H2
85 ><P
86 > <SPAN
87 CLASS="APPLICATION"
88 >Privoxy</SPAN
89 > uses Perl-style <SPAN
90 CLASS="QUOTE"
91 >"regular
92  expressions"</SPAN
93 > in its <A
94 HREF="actions-file.html"
95 >actions
96  files</A
97 > and <A
98 HREF="filter-file.html"
99 >filter file</A
100 >,
101  through the <A
102 HREF="http://www.pcre.org/"
103 TARGET="_top"
104 >PCRE</A
105 > and
106  <SPAN
107 CLASS="APPLICATION"
108 >PCRS</SPAN
109 > libraries.</P
110 ><P
111 > If you are reading this, you probably don't understand what <SPAN
112 CLASS="QUOTE"
113 >"regular
114  expressions"</SPAN
115 > are, or what they can do. So this will be a very brief
116  introduction only. A full explanation would require a <A
117 HREF="http://www.oreilly.com/catalog/regex/"
118 TARGET="_top"
119 >book</A
120 > ;-)</P
121 ><P
122 > Regular expressions provide a language to describe patterns that can be
123  run against strings of characters (letter, numbers, etc), to see if they
124  match the string or not. The  patterns are themselves (sometimes complex)
125  strings of literal characters, combined with  wild-cards, and other special
126  characters, called meta-characters. The <SPAN
127 CLASS="QUOTE"
128 >"meta-characters"</SPAN
129 > have
130  special meanings and are used to build complex patterns to be matched against.
131  Perl Compatible Regular Expressions are an especially convenient
132  <SPAN
133 CLASS="QUOTE"
134 >"dialect"</SPAN
135 > of the regular expression language.</P
136 ><P
137 > To make a simple analogy, we do something similar when we use wild-card
138  characters when listing files with the <B
139 CLASS="COMMAND"
140 >dir</B
141 > command in DOS. 
142  <TT
143 CLASS="LITERAL"
144 >*.*</TT
145 > matches all filenames. The <SPAN
146 CLASS="QUOTE"
147 >"special"</SPAN
148 >
149  character here is the asterisk which matches any and all characters. We can be
150  more specific and use <TT
151 CLASS="LITERAL"
152 >?</TT
153 > to match just individual
154  characters. So <SPAN
155 CLASS="QUOTE"
156 >"dir file?.text"</SPAN
157 > would match
158  <SPAN
159 CLASS="QUOTE"
160 >"file1.txt"</SPAN
161 >, <SPAN
162 CLASS="QUOTE"
163 >"file2.txt"</SPAN
164 >, etc. We are pattern
165  matching, using a similar technique to <SPAN
166 CLASS="QUOTE"
167 >"regular expressions"</SPAN
168 >!</P
169 ><P
170 > Regular expressions do essentially the same thing, but are much, much more
171  powerful. There are many more <SPAN
172 CLASS="QUOTE"
173 >"special characters"</SPAN
174 > and ways of 
175  building complex patterns however. Let's look at a few of the common ones,
176  and then some examples:</P
177 ><P
178 ><P
179 ></P
180 ><TABLE
181 BORDER="0"
182 ><TBODY
183 ><TR
184 ><TD
185 >  <SPAN
186 CLASS="emphasis"
187 ><I
188 CLASS="EMPHASIS"
189 >.</I
190 ></SPAN
191 > - Matches any single character, e.g. <SPAN
192 CLASS="QUOTE"
193 >"a"</SPAN
194 >,
195   <SPAN
196 CLASS="QUOTE"
197 >"A"</SPAN
198 >, <SPAN
199 CLASS="QUOTE"
200 >"4"</SPAN
201 >, <SPAN
202 CLASS="QUOTE"
203 >":"</SPAN
204 >, or <SPAN
205 CLASS="QUOTE"
206 >"@"</SPAN
207 >.
208  </TD
209 ></TR
210 ></TBODY
211 ></TABLE
212 ><P
213 ></P
214 ></P
215 ><P
216 ><P
217 ></P
218 ><TABLE
219 BORDER="0"
220 ><TBODY
221 ><TR
222 ><TD
223 >  <SPAN
224 CLASS="emphasis"
225 ><I
226 CLASS="EMPHASIS"
227 >?</I
228 ></SPAN
229 > - The preceding character or expression is matched ZERO or ONE
230   times. Either/or.
231  </TD
232 ></TR
233 ></TBODY
234 ></TABLE
235 ><P
236 ></P
237 ></P
238 ><P
239 ><P
240 ></P
241 ><TABLE
242 BORDER="0"
243 ><TBODY
244 ><TR
245 ><TD
246 >  <SPAN
247 CLASS="emphasis"
248 ><I
249 CLASS="EMPHASIS"
250 >+</I
251 ></SPAN
252 > - The preceding character or expression is matched ONE or MORE
253   times.
254  </TD
255 ></TR
256 ></TBODY
257 ></TABLE
258 ><P
259 ></P
260 ></P
261 ><P
262 ><P
263 ></P
264 ><TABLE
265 BORDER="0"
266 ><TBODY
267 ><TR
268 ><TD
269 >  <SPAN
270 CLASS="emphasis"
271 ><I
272 CLASS="EMPHASIS"
273 >*</I
274 ></SPAN
275 > - The preceding character or expression is matched ZERO or MORE
276   times.
277  </TD
278 ></TR
279 ></TBODY
280 ></TABLE
281 ><P
282 ></P
283 ></P
284 ><P
285 ><P
286 ></P
287 ><TABLE
288 BORDER="0"
289 ><TBODY
290 ><TR
291 ><TD
292 >  <SPAN
293 CLASS="emphasis"
294 ><I
295 CLASS="EMPHASIS"
296 >\</I
297 ></SPAN
298 > - The <SPAN
299 CLASS="QUOTE"
300 >"escape"</SPAN
301 > character denotes that
302   the following character should be taken literally. This is used where one of the 
303   special characters (e.g. <SPAN
304 CLASS="QUOTE"
305 >"."</SPAN
306 >) needs to be taken literally and
307   not as a special meta-character. Example: <SPAN
308 CLASS="QUOTE"
309 >"example\.com"</SPAN
310 >, makes 
311   sure the period is recognized only as a period (and not expanded to its 
312   meta-character meaning of any single character).
313  </TD
314 ></TR
315 ></TBODY
316 ></TABLE
317 ><P
318 ></P
319 ></P
320 ><P
321 ><P
322 ></P
323 ><TABLE
324 BORDER="0"
325 ><TBODY
326 ><TR
327 ><TD
328 >  <SPAN
329 CLASS="emphasis"
330 ><I
331 CLASS="EMPHASIS"
332 >[ ]</I
333 ></SPAN
334 > - Characters enclosed in brackets will be matched if
335   any of the enclosed characters are encountered. For instance, <SPAN
336 CLASS="QUOTE"
337 >"[0-9]"</SPAN
338 >
339   matches any numeric digit (zero through nine). As an example, we can combine 
340   this with <SPAN
341 CLASS="QUOTE"
342 >"+"</SPAN
343 > to match any digit one of more times: <SPAN
344 CLASS="QUOTE"
345 >"[0-9]+"</SPAN
346 >.
347  </TD
348 ></TR
349 ></TBODY
350 ></TABLE
351 ><P
352 ></P
353 ></P
354 ><P
355 ><P
356 ></P
357 ><TABLE
358 BORDER="0"
359 ><TBODY
360 ><TR
361 ><TD
362 >  <SPAN
363 CLASS="emphasis"
364 ><I
365 CLASS="EMPHASIS"
366 >( )</I
367 ></SPAN
368 > - parentheses are used to group a sub-expression,
369   or multiple sub-expressions.
370  </TD
371 ></TR
372 ></TBODY
373 ></TABLE
374 ><P
375 ></P
376 ></P
377 ><P
378 ><P
379 ></P
380 ><TABLE
381 BORDER="0"
382 ><TBODY
383 ><TR
384 ><TD
385 >  <SPAN
386 CLASS="emphasis"
387 ><I
388 CLASS="EMPHASIS"
389 >|</I
390 ></SPAN
391 > - The <SPAN
392 CLASS="QUOTE"
393 >"bar"</SPAN
394 > character works like an
395   <SPAN
396 CLASS="QUOTE"
397 >"or"</SPAN
398 > conditional statement. A match is successful if the
399   sub-expression on either side of <SPAN
400 CLASS="QUOTE"
401 >"|"</SPAN
402 > matches. As an example:
403   <SPAN
404 CLASS="QUOTE"
405 >"/(this|that) example/"</SPAN
406 > uses grouping and the bar character 
407   and would match either <SPAN
408 CLASS="QUOTE"
409 >"this example"</SPAN
410 > or <SPAN
411 CLASS="QUOTE"
412 >"that
413   example"</SPAN
414 >, and nothing else.
415  </TD
416 ></TR
417 ></TBODY
418 ></TABLE
419 ><P
420 ></P
421 ></P
422 ><P
423 > These are just some of the ones you are likely to use when matching URLs with 
424  <SPAN
425 CLASS="APPLICATION"
426 >Privoxy</SPAN
427 >, and is a long way from a definitive
428  list. This is enough to get us started with a few simple examples which may
429  be more illuminating:</P
430 ><P
431 > <SPAN
432 CLASS="emphasis"
433 ><I
434 CLASS="EMPHASIS"
435 ><TT
436 CLASS="LITERAL"
437 >/.*/banners/.*</TT
438 ></I
439 ></SPAN
440 > - A  simple example
441  that uses the common combination of <SPAN
442 CLASS="QUOTE"
443 >"."</SPAN
444 > and <SPAN
445 CLASS="QUOTE"
446 >"*"</SPAN
447 > to 
448  denote any character, zero or more times. In other words, any string at all.
449  So we start with a literal forward slash, then our regular expression pattern 
450  (<SPAN
451 CLASS="QUOTE"
452 >".*"</SPAN
453 >) another literal forward slash, the string
454  <SPAN
455 CLASS="QUOTE"
456 >"banners"</SPAN
457 >, another forward slash, and lastly another
458  <SPAN
459 CLASS="QUOTE"
460 >".*"</SPAN
461 >. We are building 
462  a directory path here. This will match any file with the path that has a
463  directory named <SPAN
464 CLASS="QUOTE"
465 >"banners"</SPAN
466 > in it. The <SPAN
467 CLASS="QUOTE"
468 >".*"</SPAN
469 > matches
470  any characters, and this could conceivably be more forward slashes, so it
471  might expand into a much longer looking path. For example, this could match:
472  <SPAN
473 CLASS="QUOTE"
474 >"/eye/hate/spammers/banners/annoy_me_please.gif"</SPAN
475 >, or just
476  <SPAN
477 CLASS="QUOTE"
478 >"/banners/annoying.html"</SPAN
479 >, or almost an infinite number of other
480  possible combinations, just so it has <SPAN
481 CLASS="QUOTE"
482 >"banners"</SPAN
483 > in the path
484  somewhere.</P
485 ><P
486 > And now something a little more complex:</P
487 ><P
488 > <SPAN
489 CLASS="emphasis"
490 ><I
491 CLASS="EMPHASIS"
492 ><TT
493 CLASS="LITERAL"
494 >/.*/adv((er)?ts?|ertis(ing|ements?))?/</TT
495 ></I
496 ></SPAN
497 > - 
498  We have several literal forward slashes again (<SPAN
499 CLASS="QUOTE"
500 >"/"</SPAN
501 >), so we are
502  building another expression that is a file path statement. We have another 
503  <SPAN
504 CLASS="QUOTE"
505 >".*"</SPAN
506 >, so we are matching against any conceivable sub-path, just so
507  it matches our expression. The only true literal that <SPAN
508 CLASS="emphasis"
509 ><I
510 CLASS="EMPHASIS"
511 >must
512  match</I
513 ></SPAN
514 > our pattern is <SPAN
515 CLASS="APPLICATION"
516 >adv</SPAN
517 >, together with
518  the forward slashes. What comes after the <SPAN
519 CLASS="QUOTE"
520 >"adv"</SPAN
521 > string is the
522  interesting part. </P
523 ><P
524 > Remember the <SPAN
525 CLASS="QUOTE"
526 >"?"</SPAN
527 > means the preceding expression (either a
528  literal character or anything grouped with <SPAN
529 CLASS="QUOTE"
530 >"(...)"</SPAN
531 > in this case)
532  can exist or not, since this means either zero or one match. So
533  <SPAN
534 CLASS="QUOTE"
535 >"((er)?ts?|ertis(ing|ements?))"</SPAN
536 > is optional, as are the
537  individual sub-expressions: <SPAN
538 CLASS="QUOTE"
539 >"(er)"</SPAN
540 >,
541  <SPAN
542 CLASS="QUOTE"
543 >"(ing|ements?)"</SPAN
544 >, and the <SPAN
545 CLASS="QUOTE"
546 >"s"</SPAN
547 >. The <SPAN
548 CLASS="QUOTE"
549 >"|"</SPAN
550 >
551  means <SPAN
552 CLASS="QUOTE"
553 >"or"</SPAN
554 >. We have two of those. For instance, 
555  <SPAN
556 CLASS="QUOTE"
557 >"(ing|ements?)"</SPAN
558 >, can expand to match either <SPAN
559 CLASS="QUOTE"
560 >"ing"</SPAN
561
562  <SPAN
563 CLASS="emphasis"
564 ><I
565 CLASS="EMPHASIS"
566 >OR</I
567 ></SPAN
568 > <SPAN
569 CLASS="QUOTE"
570 >"ements?"</SPAN
571 >. What is being done here, is an
572  attempt at matching as many variations of <SPAN
573 CLASS="QUOTE"
574 >"advertisement"</SPAN
575 >, and 
576  similar, as possible. So this would expand to match just <SPAN
577 CLASS="QUOTE"
578 >"adv"</SPAN
579 >,
580  or <SPAN
581 CLASS="QUOTE"
582 >"advert"</SPAN
583 >, or <SPAN
584 CLASS="QUOTE"
585 >"adverts"</SPAN
586 >, or
587  <SPAN
588 CLASS="QUOTE"
589 >"advertising"</SPAN
590 >, or <SPAN
591 CLASS="QUOTE"
592 >"advertisement"</SPAN
593 >, or
594  <SPAN
595 CLASS="QUOTE"
596 >"advertisements"</SPAN
597 >. You get the idea. But it would not match 
598  <SPAN
599 CLASS="QUOTE"
600 >"advertizements"</SPAN
601 > (with a <SPAN
602 CLASS="QUOTE"
603 >"z"</SPAN
604 >). We could fix that by
605  changing our regular expression to: 
606  <SPAN
607 CLASS="QUOTE"
608 >"/.*/adv((er)?ts?|erti(s|z)(ing|ements?))?/"</SPAN
609 >, which would then match
610  either spelling.</P
611 ><P
612 > <SPAN
613 CLASS="emphasis"
614 ><I
615 CLASS="EMPHASIS"
616 ><TT
617 CLASS="LITERAL"
618 >/.*/advert[0-9]+\.(gif|jpe?g)</TT
619 ></I
620 ></SPAN
621 > - Again 
622  another path statement with forward slashes. Anything in the square brackets 
623  <SPAN
624 CLASS="QUOTE"
625 >"[ ]"</SPAN
626 > can be matched. This is using <SPAN
627 CLASS="QUOTE"
628 >"0-9"</SPAN
629 > as a
630  shorthand expression to mean any digit one through nine. It is the same as
631  saying <SPAN
632 CLASS="QUOTE"
633 >"0123456789"</SPAN
634 >. So any digit matches. The <SPAN
635 CLASS="QUOTE"
636 >"+"</SPAN
637 >
638  means one or more of the preceding expression must be included. The preceding 
639  expression here is what is in the square brackets -- in this case, any digit 
640  one through nine. Then, at the end, we have a grouping: <SPAN
641 CLASS="QUOTE"
642 >"(gif|jpe?g)"</SPAN
643 >. 
644  This includes a <SPAN
645 CLASS="QUOTE"
646 >"|"</SPAN
647 >, so this needs to match the expression on
648  either side of that bar character also. A simple <SPAN
649 CLASS="QUOTE"
650 >"gif"</SPAN
651 > on one side, and the other
652  side will in turn match either <SPAN
653 CLASS="QUOTE"
654 >"jpeg"</SPAN
655 > or <SPAN
656 CLASS="QUOTE"
657 >"jpg"</SPAN
658 >,
659  since the <SPAN
660 CLASS="QUOTE"
661 >"?"</SPAN
662 > means the letter <SPAN
663 CLASS="QUOTE"
664 >"e"</SPAN
665 > is optional and
666  can be matched once or not at all. So we are building an expression here to
667  match image GIF or JPEG type image file. It must include the literal
668  string <SPAN
669 CLASS="QUOTE"
670 >"advert"</SPAN
671 >, then one or more digits, and a <SPAN
672 CLASS="QUOTE"
673 >"."</SPAN
674 >
675  (which is now a literal, and not a special character, since it is escaped
676  with <SPAN
677 CLASS="QUOTE"
678 >"\"</SPAN
679 >), and lastly either <SPAN
680 CLASS="QUOTE"
681 >"gif"</SPAN
682 >, or
683  <SPAN
684 CLASS="QUOTE"
685 >"jpeg"</SPAN
686 >, or <SPAN
687 CLASS="QUOTE"
688 >"jpg"</SPAN
689 >. Some possible matches would
690  include: <SPAN
691 CLASS="QUOTE"
692 >"//advert1.jpg"</SPAN
693 >,
694  <SPAN
695 CLASS="QUOTE"
696 >"/nasty/ads/advert1234.gif"</SPAN
697 >,
698  <SPAN
699 CLASS="QUOTE"
700 >"/banners/from/hell/advert99.jpg"</SPAN
701 >. It would not match
702  <SPAN
703 CLASS="QUOTE"
704 >"advert1.gif"</SPAN
705 > (no leading slash), or
706  <SPAN
707 CLASS="QUOTE"
708 >"/adverts232.jpg"</SPAN
709 > (the expression does not include an
710  <SPAN
711 CLASS="QUOTE"
712 >"s"</SPAN
713 >), or <SPAN
714 CLASS="QUOTE"
715 >"/advert1.jsp"</SPAN
716 > (<SPAN
717 CLASS="QUOTE"
718 >"jsp"</SPAN
719 > is not
720  in the expression anywhere).</P
721 ><P
722 > We are barely scratching the surface of regular expressions here so that you
723  can understand the default <SPAN
724 CLASS="APPLICATION"
725 >Privoxy</SPAN
726 >
727  configuration files, and maybe use this knowledge to customize your own
728  installation. There is much, much more that can be done with regular
729  expressions. Now that you know enough to get started, you can learn more on
730  your own :/</P
731 ><P
732 > More reading on Perl Compatible Regular expressions: 
733  <A
734 HREF="http://perldoc.perl.org/perlre.html"
735 TARGET="_top"
736 >http://perldoc.perl.org/perlre.html</A
737 ></P
738 ><P
739 > For information on regular expression based substitutions and their applications
740  in filters, please see the <A
741 HREF="filter-file.html"
742 >filter file tutorial</A
743 >
744  in this manual.</P
745 ></DIV
746 ><DIV
747 CLASS="SECT2"
748 ><H2
749 CLASS="SECT2"
750 ><A
751 NAME="AEN5349"
752 >14.2. Privoxy's Internal Pages</A
753 ></H2
754 ><P
755 > Since <SPAN
756 CLASS="APPLICATION"
757 >Privoxy</SPAN
758 > proxies each requested 
759  web page, it is easy for <SPAN
760 CLASS="APPLICATION"
761 >Privoxy</SPAN
762 > to 
763  trap certain special URLs. In this way, we can talk directly to
764  <SPAN
765 CLASS="APPLICATION"
766 >Privoxy</SPAN
767 >, and see how it is 
768  configured, see how our rules are being applied, change these 
769  rules and other configuration options, and even turn
770  <SPAN
771 CLASS="APPLICATION"
772 >Privoxy's</SPAN
773 > filtering off, all with 
774  a web browser.&#13;</P
775 ><P
776 > The URLs listed below are the special ones that allow direct access 
777  to <SPAN
778 CLASS="APPLICATION"
779 >Privoxy</SPAN
780 >. Of course,
781  <SPAN
782 CLASS="APPLICATION"
783 >Privoxy</SPAN
784 > must be running to access these. If 
785  not, you will get a friendly error message. Internet access is not 
786  necessary either.</P
787 ><P
788 > <P
789 ></P
790 ><UL
791 ><LI
792 ><P
793 >  
794    Privoxy main page: 
795   </P
796 ><A
797 NAME="AEN5363"
798 ></A
799 ><BLOCKQUOTE
800 CLASS="BLOCKQUOTE"
801 ><P
802
803      <A
804 HREF="http://config.privoxy.org/"
805 TARGET="_top"
806 >http://config.privoxy.org/</A
807 >
808    </P
809 ></BLOCKQUOTE
810 ><P
811 >   There is a shortcut: <A
812 HREF="http://p.p/"
813 TARGET="_top"
814 >http://p.p/</A
815 > (But it
816    doesn't provide a fall-back to a real page, in case the request is not
817    sent through <SPAN
818 CLASS="APPLICATION"
819 >Privoxy</SPAN
820 >)
821   </P
822 ></LI
823 ><LI
824 ><P
825 >  
826     Show information about the current configuration, including viewing and 
827     editing of actions files:
828   </P
829 ><A
830 NAME="AEN5371"
831 ></A
832 ><BLOCKQUOTE
833 CLASS="BLOCKQUOTE"
834 ><P
835
836     <A
837 HREF="http://config.privoxy.org/show-status"
838 TARGET="_top"
839 >http://config.privoxy.org/show-status</A
840 >
841    </P
842 ></BLOCKQUOTE
843 ></LI
844 ><LI
845 ><P
846 >  
847     Show the source code version numbers:
848   </P
849 ><A
850 NAME="AEN5376"
851 ></A
852 ><BLOCKQUOTE
853 CLASS="BLOCKQUOTE"
854 ><P
855
856     <A
857 HREF="http://config.privoxy.org/show-version"
858 TARGET="_top"
859 >http://config.privoxy.org/show-version</A
860 >
861    </P
862 ></BLOCKQUOTE
863 ></LI
864 ><LI
865 ><P
866 >  
867    Show the browser's request headers:
868   </P
869 ><A
870 NAME="AEN5381"
871 ></A
872 ><BLOCKQUOTE
873 CLASS="BLOCKQUOTE"
874 ><P
875
876     <A
877 HREF="http://config.privoxy.org/show-request"
878 TARGET="_top"
879 >http://config.privoxy.org/show-request</A
880 >
881    </P
882 ></BLOCKQUOTE
883 ></LI
884 ><LI
885 ><P
886 >  
887    Show which actions apply to a URL and why:
888   </P
889 ><A
890 NAME="AEN5386"
891 ></A
892 ><BLOCKQUOTE
893 CLASS="BLOCKQUOTE"
894 ><P
895
896     <A
897 HREF="http://config.privoxy.org/show-url-info"
898 TARGET="_top"
899 >http://config.privoxy.org/show-url-info</A
900 >
901    </P
902 ></BLOCKQUOTE
903 ></LI
904 ><LI
905 ><P
906 >  
907    Toggle Privoxy on or off. This feature can be turned off/on in the main 
908    <TT
909 CLASS="FILENAME"
910 >config</TT
911 > file. When toggled <SPAN
912 CLASS="QUOTE"
913 >"off"</SPAN
914 >, <SPAN
915 CLASS="QUOTE"
916 >"Privoxy"</SPAN
917 >
918    continues to run, but only as a pass-through proxy, with no actions taking
919    place:
920   </P
921 ><A
922 NAME="AEN5394"
923 ></A
924 ><BLOCKQUOTE
925 CLASS="BLOCKQUOTE"
926 ><P
927
928     <A
929 HREF="http://config.privoxy.org/toggle"
930 TARGET="_top"
931 >http://config.privoxy.org/toggle</A
932 >
933    </P
934 ></BLOCKQUOTE
935 ><P
936 >   Short cuts. Turn off, then on: 
937   </P
938 ><A
939 NAME="AEN5398"
940 ></A
941 ><BLOCKQUOTE
942 CLASS="BLOCKQUOTE"
943 ><P
944
945      <A
946 HREF="http://config.privoxy.org/toggle?set=disable"
947 TARGET="_top"
948 >http://config.privoxy.org/toggle?set=disable</A
949 >
950    </P
951 ></BLOCKQUOTE
952 ><A
953 NAME="AEN5401"
954 ></A
955 ><BLOCKQUOTE
956 CLASS="BLOCKQUOTE"
957 ><P
958
959      <A
960 HREF="http://config.privoxy.org/toggle?set=enable"
961 TARGET="_top"
962 >http://config.privoxy.org/toggle?set=enable</A
963 >
964    </P
965 ></BLOCKQUOTE
966 ></LI
967 ></UL
968 ></P
969 ><P
970 > These may be bookmarked for quick reference. See next.&#13;</P
971 ><DIV
972 CLASS="SECT3"
973 ><H3
974 CLASS="SECT3"
975 ><A
976 NAME="BOOKMARKLETS"
977 >14.2.1. Bookmarklets</A
978 ></H3
979 ><P
980 > Below are some <SPAN
981 CLASS="QUOTE"
982 >"bookmarklets"</SPAN
983 > to allow you to easily access a
984  <SPAN
985 CLASS="QUOTE"
986 >"mini"</SPAN
987 > version of some of <SPAN
988 CLASS="APPLICATION"
989 >Privoxy's</SPAN
990 >
991  special pages. They are designed for MS Internet Explorer, but should work
992  equally well in Netscape, Mozilla, and other browsers which support
993  JavaScript. They are designed to run directly from your bookmarks - not by
994  clicking the links below (although that should work for testing).</P
995 ><P
996 > To save them, right-click the link and choose <SPAN
997 CLASS="QUOTE"
998 >"Add to Favorites"</SPAN
999 >
1000  (IE) or <SPAN
1001 CLASS="QUOTE"
1002 >"Add Bookmark"</SPAN
1003 > (Netscape). You will get a warning that
1004  the bookmark <SPAN
1005 CLASS="QUOTE"
1006 >"may not be safe"</SPAN
1007 > - just click OK. Then you can run the
1008  Bookmarklet directly from your favorites/bookmarks. For even faster access,
1009  you can put them on the <SPAN
1010 CLASS="QUOTE"
1011 >"Links"</SPAN
1012 > bar (IE) or the <SPAN
1013 CLASS="QUOTE"
1014 >"Personal
1015  Toolbar"</SPAN
1016 > (Netscape), and run them with a single click. </P
1017 ><P
1018 > <P
1019 ></P
1020 ><UL
1021 ><LI
1022 ><P
1023 >    <A
1024 HREF="javascript:void(window.open('http://config.privoxy.org/toggle?mini=y&set=enabled','ijbstatus','width=250,height=100,resizable=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());"
1025 TARGET="_top"
1026 >Privoxy - Enable</A
1027 >
1028    </P
1029 ></LI
1030 ><LI
1031 ><P
1032 >    <A
1033 HREF="javascript:void(window.open('http://config.privoxy.org/toggle?mini=y&set=disabled','ijbstatus','width=250,height=100,resizable=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());"
1034 TARGET="_top"
1035 >Privoxy - Disable</A
1036 >
1037    </P
1038 ></LI
1039 ><LI
1040 ><P
1041 >    <A
1042 HREF="javascript:void(window.open('http://config.privoxy.org/toggle?mini=y&set=toggle','ijbstatus','width=250,height=100,resizable=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());"
1043 TARGET="_top"
1044 >Privoxy - Toggle Privoxy</A
1045 > (Toggles between enabled and disabled)
1046    </P
1047 ></LI
1048 ><LI
1049 ><P
1050 >    <A
1051 HREF="javascript:void(window.open('http://config.privoxy.org/toggle?mini=y','ijbstatus','width=250,height=2,resizable=yes,scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no').focus());"
1052 TARGET="_top"
1053 >Privoxy- View Status</A
1054 >
1055    </P
1056 ></LI
1057 ><LI
1058 ><P
1059 >    <A
1060 HREF="javascript:void(window.open('http://config.privoxy.org/show-url-info?url='+escape(location.href),'Why').focus());"
1061 TARGET="_top"
1062 >Privoxy - Why?</A
1063 >
1064    </P
1065 ></LI
1066 ></UL
1067 ></P
1068 ><P
1069 > Credit: The site which gave us the general idea for these bookmarklets is
1070  <A
1071 HREF="http://www.bookmarklets.com/"
1072 TARGET="_top"
1073 >www.bookmarklets.com</A
1074 >. They
1075  have more information about bookmarklets. </P
1076 ></DIV
1077 ></DIV
1078 ><DIV
1079 CLASS="SECT2"
1080 ><H2
1081 CLASS="SECT2"
1082 ><A
1083 NAME="CHAIN"
1084 >14.3. Chain of Events</A
1085 ></H2
1086 ><P
1087 > Let's take a quick look at how some of <SPAN
1088 CLASS="APPLICATION"
1089 >Privoxy's</SPAN
1090
1091  core features are triggered, and the ensuing sequence of events when a web
1092  page is requested by your browser:</P
1093 ><P
1094 > <P
1095 ></P
1096 ><UL
1097 ><LI
1098 ><P
1099 >   First, your web browser requests a web page. The browser knows to send 
1100    the request to <SPAN
1101 CLASS="APPLICATION"
1102 >Privoxy</SPAN
1103 >, which will in turn, 
1104    relay the request to the remote web server after passing the following 
1105    tests: 
1106   </P
1107 ></LI
1108 ><LI
1109 ><P
1110 >   <SPAN
1111 CLASS="APPLICATION"
1112 >Privoxy</SPAN
1113 > traps any request for its own internal CGI 
1114    pages (e.g <A
1115 HREF="http://p.p/"
1116 TARGET="_top"
1117 >http://p.p/</A
1118 >) and sends the CGI page back to the browser.
1119   </P
1120 ></LI
1121 ><LI
1122 ><P
1123 >   Next, <SPAN
1124 CLASS="APPLICATION"
1125 >Privoxy</SPAN
1126 > checks to see if the URL 
1127    matches any <A
1128 HREF="actions-file.html#BLOCK"
1129 ><SPAN
1130 CLASS="QUOTE"
1131 >"+block"</SPAN
1132 ></A
1133 > patterns. If
1134    so, the URL is then blocked, and the remote web server will not be contacted.
1135    <A
1136 HREF="actions-file.html#HANDLE-AS-IMAGE"
1137 ><SPAN
1138 CLASS="QUOTE"
1139 >"+handle-as-image"</SPAN
1140 ></A
1141
1142    and 
1143    <A
1144 HREF="actions-file.html#HANDLE-AS-EMPTY-DOCUMENT"
1145 ><SPAN
1146 CLASS="QUOTE"
1147 >"+handle-as-empty-document"</SPAN
1148 ></A
1149 >
1150    are then checked, and if there is no match, an 
1151    HTML <SPAN
1152 CLASS="QUOTE"
1153 >"BLOCKED"</SPAN
1154 > page is sent back to the browser. Otherwise, if
1155    it does match, an image is returned for the former, and an empty text
1156    document for the latter. The type of image would depend on the setting of
1157    <A
1158 HREF="actions-file.html#SET-IMAGE-BLOCKER"
1159 ><SPAN
1160 CLASS="QUOTE"
1161 >"+set-image-blocker"</SPAN
1162 ></A
1163 >
1164    (blank, checkerboard pattern, or an HTTP redirect to an image elsewhere).
1165   </P
1166 ></LI
1167 ><LI
1168 ><P
1169 >   Untrusted URLs are blocked. If URLs are being added to the
1170    <TT
1171 CLASS="FILENAME"
1172 >trust</TT
1173 > file, then that is done.
1174   </P
1175 ></LI
1176 ><LI
1177 ><P
1178 >   If the URL pattern matches the <A
1179 HREF="actions-file.html#FAST-REDIRECTS"
1180 ><SPAN
1181 CLASS="QUOTE"
1182 >"+fast-redirects"</SPAN
1183 ></A
1184 > action,
1185    it is then processed. Unwanted parts of the requested URL are stripped.
1186   </P
1187 ></LI
1188 ><LI
1189 ><P
1190 >   Now the rest of the client browser's request headers are processed. If any
1191    of these match any of the relevant actions (e.g. <A
1192 HREF="actions-file.html#HIDE-USER-AGENT"
1193 ><SPAN
1194 CLASS="QUOTE"
1195 >"+hide-user-agent"</SPAN
1196 ></A
1197 >,
1198    etc.), headers are suppressed or forged as determined by these actions and
1199    their parameters.
1200   </P
1201 ></LI
1202 ><LI
1203 ><P
1204 >   Now the web server starts sending its response back (i.e. typically a web
1205    page).
1206   </P
1207 ></LI
1208 ><LI
1209 ><P
1210 >   First, the server headers are read and processed to determine, among other
1211    things, the MIME type (document type) and encoding. The headers are then
1212    filtered as determined by the 
1213    <A
1214 HREF="actions-file.html#CRUNCH-INCOMING-COOKIES"
1215 ><SPAN
1216 CLASS="QUOTE"
1217 >"+crunch-incoming-cookies"</SPAN
1218 ></A
1219 >,
1220    <A
1221 HREF="actions-file.html#SESSION-COOKIES-ONLY"
1222 ><SPAN
1223 CLASS="QUOTE"
1224 >"+session-cookies-only"</SPAN
1225 ></A
1226 >,
1227    and <A
1228 HREF="actions-file.html#DOWNGRADE-HTTP-VERSION"
1229 ><SPAN
1230 CLASS="QUOTE"
1231 >"+downgrade-http-version"</SPAN
1232 ></A
1233 >
1234    actions.
1235   </P
1236 ></LI
1237 ><LI
1238 ><P
1239 >   If the <A
1240 HREF="actions-file.html#KILL-POPUPS"
1241 ><SPAN
1242 CLASS="QUOTE"
1243 >"+kill-popups"</SPAN
1244 ></A
1245 >
1246    action applies, and it is an HTML or JavaScript document, the popup-code in the
1247    response is filtered on-the-fly as it is received.
1248   </P
1249 ></LI
1250 ><LI
1251 ><P
1252 >   If any <A
1253 HREF="actions-file.html#FILTER"
1254 ><SPAN
1255 CLASS="QUOTE"
1256 >"+filter"</SPAN
1257 ></A
1258 > action
1259    or <A
1260 HREF="actions-file.html#DEANIMATE-GIFS"
1261 ><SPAN
1262 CLASS="QUOTE"
1263 >"+deanimate-gifs"</SPAN
1264 ></A
1265 >
1266    action applies (and the document type fits the action), the rest of the page is
1267    read into memory (up to a configurable limit). Then the filter rules (from
1268    <TT
1269 CLASS="FILENAME"
1270 >default.filter</TT
1271 > and any other filter files) are
1272    processed against the buffered content. Filters are applied in the order
1273    they are specified in one of the filter files. Animated GIFs, if present,
1274    are reduced to either the first or last frame, depending on the action
1275    setting.The entire page, which is now filtered, is then sent by
1276    <SPAN
1277 CLASS="APPLICATION"
1278 >Privoxy</SPAN
1279 > back to your browser. 
1280   </P
1281 ><P
1282 >   If neither a <A
1283 HREF="actions-file.html#FILTER"
1284 ><SPAN
1285 CLASS="QUOTE"
1286 >"+filter"</SPAN
1287 ></A
1288 > action
1289    or <A
1290 HREF="actions-file.html#DEANIMATE-GIFS"
1291 ><SPAN
1292 CLASS="QUOTE"
1293 >"+deanimate-gifs"</SPAN
1294 ></A
1295 >
1296    matches, then <SPAN
1297 CLASS="APPLICATION"
1298 >Privoxy</SPAN
1299 > passes the raw data through 
1300    to the client browser as it becomes available.
1301   </P
1302 ></LI
1303 ><LI
1304 ><P
1305 >   As the browser receives the now (possibly filtered) page content, it 
1306    reads and then requests any URLs that may be embedded within the page
1307    source, e.g. ad images, stylesheets, JavaScript, other HTML documents (e.g.
1308    frames), sounds, etc. For each of these objects, the browser issues a
1309    separate request (this is easily viewable in <SPAN
1310 CLASS="APPLICATION"
1311 >Privoxy's</SPAN
1312 >
1313    logs). And each such request is in turn processed just as above. Note that a
1314    complex web page will have many, many such embedded URLs. If these 
1315    secondary requests are to a different server, then quite possibly a very 
1316    differing set of actions is triggered.
1317   </P
1318 ></LI
1319 ></UL
1320 ></P
1321 ><P
1322 > NOTE: This is somewhat of a simplistic overview of what happens with each URL
1323  request. For the sake of brevity and simplicity, we have focused on 
1324  <SPAN
1325 CLASS="APPLICATION"
1326 >Privoxy's</SPAN
1327 > core features only.</P
1328 ></DIV
1329 ><DIV
1330 CLASS="SECT2"
1331 ><H2
1332 CLASS="SECT2"
1333 ><A
1334 NAME="ACTIONSANAT"
1335 >14.4. Troubleshooting: Anatomy of an Action</A
1336 ></H2
1337 ><P
1338 > The way <SPAN
1339 CLASS="APPLICATION"
1340 >Privoxy</SPAN
1341 > applies 
1342  <A
1343 HREF="actions-file.html#ACTIONS"
1344 >actions</A
1345 > and <A
1346 HREF="actions-file.html#FILTER"
1347 >filters</A
1348 >
1349  to any given URL can be complex, and not always so
1350  easy to understand what is happening. And sometimes we need to be able to
1351  <SPAN
1352 CLASS="emphasis"
1353 ><I
1354 CLASS="EMPHASIS"
1355 >see</I
1356 ></SPAN
1357 > just what <SPAN
1358 CLASS="APPLICATION"
1359 >Privoxy</SPAN
1360 > is
1361  doing. Especially, if something <SPAN
1362 CLASS="APPLICATION"
1363 >Privoxy</SPAN
1364 > is doing
1365  is causing us a problem inadvertently. It can be a little daunting to look at
1366  the actions and filters files themselves, since they tend to be filled with
1367  <A
1368 HREF="appendix.html#REGEX"
1369 >regular expressions</A
1370 > whose consequences are not
1371  always so obvious. </P
1372 ><P
1373 > One quick test to see if <SPAN
1374 CLASS="APPLICATION"
1375 >Privoxy</SPAN
1376 > is causing a problem 
1377  or not, is to disable it temporarily. This should be the first troubleshooting 
1378  step. See <A
1379 HREF="appendix.html#BOOKMARKLETS"
1380 >the Bookmarklets</A
1381 > section on a quick 
1382  and easy way to do this (be sure to flush caches afterward!). Looking at the 
1383  logs is a good idea too. (Note that both the toggle feature and logging are 
1384  enabled via <TT
1385 CLASS="FILENAME"
1386 >config</TT
1387 > file settings, and may need to be 
1388  turned <SPAN
1389 CLASS="QUOTE"
1390 >"on"</SPAN
1391 >.)</P
1392 ><P
1393 > Another easy troubleshooting step to try is if you have done any
1394  customization of your installation, revert back to the installed
1395  defaults and see if that helps. There are times the developers get complaints
1396  about one thing or another, and the problem is more related to a customized
1397  configuration issue.</P
1398 ><P
1399 > <SPAN
1400 CLASS="APPLICATION"
1401 >Privoxy</SPAN
1402 > also provides the 
1403  <A
1404 HREF="http://config.privoxy.org/show-url-info"
1405 TARGET="_top"
1406 >http://config.privoxy.org/show-url-info</A
1407 >
1408  page that can show us very specifically how <SPAN
1409 CLASS="APPLICATION"
1410 >actions</SPAN
1411 >
1412  are being applied to any given URL. This is a big help for troubleshooting.</P
1413 ><P
1414 > First, enter one URL (or partial URL) at the prompt, and then
1415  <SPAN
1416 CLASS="APPLICATION"
1417 >Privoxy</SPAN
1418 > will tell us 
1419  how the current configuration will handle it. This will not
1420  help with filtering effects (i.e. the <A
1421 HREF="actions-file.html#FILTER"
1422 ><SPAN
1423 CLASS="QUOTE"
1424 >"+filter"</SPAN
1425 ></A
1426 > action) from
1427  one of the filter files since this is handled very
1428  differently and not so easy to trap! It also will not tell you about any other
1429  URLs that may be embedded within the URL you are testing. For instance, images
1430  such as ads are expressed as URLs within the raw page source of HTML pages. So
1431  you will only get info for the actual URL that is pasted into the prompt area
1432  -- not any sub-URLs. If you want to know about embedded URLs like ads, you
1433  will have to dig those out of the HTML source. Use your browser's <SPAN
1434 CLASS="QUOTE"
1435 >"View
1436  Page Source"</SPAN
1437 > option for this. Or right click on the ad, and grab the
1438  URL.</P
1439 ><P
1440 > Let's try an example, <A
1441 HREF="http://google.com"
1442 TARGET="_top"
1443 >google.com</A
1444 >, 
1445  and look at it one section at a time in a sample configuration (your real 
1446  configuration may vary):</P
1447 ><P
1448 > <TABLE
1449 BORDER="0"
1450 BGCOLOR="#E0E0E0"
1451 WIDTH="100%"
1452 ><TR
1453 ><TD
1454 ><PRE
1455 CLASS="SCREEN"
1456 > Matches for http://www.google.com:
1457
1458  In file: default.action <SPAN
1459 CLASS="GUIBUTTON"
1460 >[ View ]</SPAN
1461 > <SPAN
1462 CLASS="GUIBUTTON"
1463 >[ Edit ]</SPAN
1464 >
1465
1466  {+deanimate-gifs {last}
1467  +fast-redirects {check-decoded-url}
1468  +filter {refresh-tags}
1469  +filter {img-reorder}
1470  +filter {banners-by-size}
1471  +filter {webbugs}
1472  +filter {jumping-windows}
1473  +filter {ie-exploits}
1474  +hide-forwarded-for-headers
1475  +hide-from-header {block}
1476  +hide-referrer {forge}
1477  +session-cookies-only
1478  +set-image-blocker {pattern}
1479 /
1480  
1481  { -session-cookies-only }
1482  .google.com
1483
1484  { -fast-redirects }
1485  .google.com
1486
1487 In file: user.action <SPAN
1488 CLASS="GUIBUTTON"
1489 >[ View ]</SPAN
1490 > <SPAN
1491 CLASS="GUIBUTTON"
1492 >[ Edit ]</SPAN
1493 >
1494 (no matches in this file)  </PRE
1495 ></TD
1496 ></TR
1497 ></TABLE
1498 ></P
1499 ><P
1500 > This is telling us how we have defined our 
1501  <A
1502 HREF="actions-file.html#ACTIONS"
1503 ><SPAN
1504 CLASS="QUOTE"
1505 >"actions"</SPAN
1506 ></A
1507 >, and
1508  which ones match for our test case, <SPAN
1509 CLASS="QUOTE"
1510 >"google.com"</SPAN
1511 >. 
1512  Displayed is all the actions that are available to us. Remember,
1513  the <TT
1514 CLASS="LITERAL"
1515 >+</TT
1516 > sign denotes <SPAN
1517 CLASS="QUOTE"
1518 >"on"</SPAN
1519 >. <TT
1520 CLASS="LITERAL"
1521 >-</TT
1522 >
1523  denotes <SPAN
1524 CLASS="QUOTE"
1525 >"off"</SPAN
1526 >. So some are <SPAN
1527 CLASS="QUOTE"
1528 >"on"</SPAN
1529 > here, but many 
1530  are <SPAN
1531 CLASS="QUOTE"
1532 >"off"</SPAN
1533 >. Each example we try may provide a slightly different
1534  end result, depending on our configuration directives.</P
1535 ><P
1536 > The first listing
1537   is for our <TT
1538 CLASS="FILENAME"
1539 >default.action</TT
1540 > file. The large, multi-line
1541   listing, is how the actions are set to match for all URLs, i.e. our default
1542   settings. If you look at your <SPAN
1543 CLASS="QUOTE"
1544 >"actions"</SPAN
1545 > file, this would be the
1546   section just below the <SPAN
1547 CLASS="QUOTE"
1548 >"aliases"</SPAN
1549 > section near the top. This
1550   will apply to all URLs as signified by the single forward slash at the end
1551   of the listing -- <SPAN
1552 CLASS="QUOTE"
1553 >" / "</SPAN
1554 >.</P
1555 ><P
1556 > But we have defined additional actions that would be exceptions to these general
1557  rules, and then we list specific URLs (or patterns) that these exceptions
1558  would apply to. Last match wins. Just below this then are two explicit
1559  matches for <SPAN
1560 CLASS="QUOTE"
1561 >".google.com"</SPAN
1562 >. The first is negating our previous
1563  cookie setting, which was for <A
1564 HREF="actions-file.html#SESSION-COOKIES-ONLY"
1565 ><SPAN
1566 CLASS="QUOTE"
1567 >"+session-cookies-only"</SPAN
1568 ></A
1569 >
1570  (i.e. not persistent). So we will allow persistent cookies for google, at
1571  least that is how it is in this example. The second turns
1572  <SPAN
1573 CLASS="emphasis"
1574 ><I
1575 CLASS="EMPHASIS"
1576 >off</I
1577 ></SPAN
1578 > any <A
1579 HREF="actions-file.html#FAST-REDIRECTS"
1580 ><SPAN
1581 CLASS="QUOTE"
1582 >"+fast-redirects"</SPAN
1583 ></A
1584 >
1585  action, allowing this to take place unmolested. Note that there is a leading
1586  dot here -- <SPAN
1587 CLASS="QUOTE"
1588 >".google.com"</SPAN
1589 >. This will match any hosts and
1590  sub-domains, in the google.com domain also, such as
1591  <SPAN
1592 CLASS="QUOTE"
1593 >"www.google.com"</SPAN
1594 > or <SPAN
1595 CLASS="QUOTE"
1596 >"mail.google.com"</SPAN
1597 >. But it would not 
1598  match <SPAN
1599 CLASS="QUOTE"
1600 >"www.google.de"</SPAN
1601 >! So, apparently, we have these two actions
1602  defined as exceptions to the general rules at the top somewhere in the lower
1603  part of our <TT
1604 CLASS="FILENAME"
1605 >default.action</TT
1606 > file, and
1607  <SPAN
1608 CLASS="QUOTE"
1609 >"google.com"</SPAN
1610 > is referenced somewhere in these latter sections.</P
1611 ><P
1612 > Then, for our <TT
1613 CLASS="FILENAME"
1614 >user.action</TT
1615 > file, we again have no hits.
1616  So there is nothing google-specific that we might have added to our own, local
1617  configuration. If there was, those actions would over-rule any actions from 
1618  previously processed files, such as <TT
1619 CLASS="FILENAME"
1620 >default.action</TT
1621 >.
1622  <TT
1623 CLASS="FILENAME"
1624 >user.action</TT
1625 > typically has the last word. This is the
1626  best place to put hard and fast exceptions,</P
1627 ><P
1628 > And finally we pull it all together in the bottom section and summarize how
1629  <SPAN
1630 CLASS="APPLICATION"
1631 >Privoxy</SPAN
1632 > is applying all its <SPAN
1633 CLASS="QUOTE"
1634 >"actions"</SPAN
1635
1636  to <SPAN
1637 CLASS="QUOTE"
1638 >"google.com"</SPAN
1639 >:&#13;</P
1640 ><P
1641 > <TABLE
1642 BORDER="0"
1643 BGCOLOR="#E0E0E0"
1644 WIDTH="100%"
1645 ><TR
1646 ><TD
1647 ><PRE
1648 CLASS="SCREEN"
1649 >&#13; Final results:
1650  
1651  -add-header
1652  -block
1653  -client-header-filter{hide-tor-exit-notation}
1654  -content-type-overwrite
1655  -crunch-client-header
1656  -crunch-if-none-match
1657  -crunch-incoming-cookies
1658  -crunch-outgoing-cookies
1659  -crunch-server-header
1660  +deanimate-gifs {last}
1661  -downgrade-http-version
1662  -fast-redirects
1663  -filter {js-events}
1664  -filter {content-cookies}
1665  -filter {all-popups}
1666  -filter {banners-by-link}
1667  -filter {tiny-textforms}
1668  -filter {frameset-borders}
1669  -filter {demoronizer}
1670  -filter {shockwave-flash}
1671  -filter {quicktime-kioskmode}
1672  -filter {fun}
1673  -filter {crude-parental}
1674  -filter {site-specifics}
1675  -filter {js-annoyances}
1676  -filter {html-annoyances}
1677  +filter {refresh-tags}
1678  -filter {unsolicited-popups}
1679  +filter {img-reorder}
1680  +filter {banners-by-size}
1681  +filter {webbugs}
1682  +filter {jumping-windows}
1683  +filter {ie-exploits}
1684  -filter {google}
1685  -filter {yahoo}
1686  -filter {msn}
1687  -filter {blogspot}
1688  -filter {no-ping}
1689  -force-text-mode
1690  -handle-as-empty-document
1691  -handle-as-image
1692  -hide-accept-language
1693  -hide-content-disposition
1694  +hide-forwarded-for-headers
1695  +hide-from-header {block}
1696  -hide-if-modified-since
1697  +hide-referrer {forge}
1698  -hide-user-agent
1699  -inspect-jpegs
1700  -kill-popups
1701  -limit-connect
1702  -overwrite-last-modified
1703  -prevent-compression
1704  -redirect
1705  -send-vanilla-wafer
1706  -send-wafer
1707  -server-header-filter{xml-to-html}
1708  -server-header-filter{html-to-xml} 
1709  -session-cookies-only
1710  +set-image-blocker {pattern}
1711  -treat-forbidden-connects-like-blocks </PRE
1712 ></TD
1713 ></TR
1714 ></TABLE
1715 ></P
1716 ><P
1717 > Notice the only difference here to the previous listing, is to 
1718  <SPAN
1719 CLASS="QUOTE"
1720 >"fast-redirects"</SPAN
1721 > and <SPAN
1722 CLASS="QUOTE"
1723 >"session-cookies-only"</SPAN
1724 >,
1725  which are activated specifically for this site in our configuration, 
1726  and thus show in the <SPAN
1727 CLASS="QUOTE"
1728 >"Final Results"</SPAN
1729 >.</P
1730 ><P
1731 > Now another example, <SPAN
1732 CLASS="QUOTE"
1733 >"ad.doubleclick.net"</SPAN
1734 >:</P
1735 ><P
1736 > <TABLE
1737 BORDER="0"
1738 BGCOLOR="#E0E0E0"
1739 WIDTH="100%"
1740 ><TR
1741 ><TD
1742 ><PRE
1743 CLASS="SCREEN"
1744 >&#13; { +block }
1745   ad*.
1746
1747  { +block }
1748   .ad.
1749
1750  { +block +handle-as-image }
1751   .[a-vx-z]*.doubleclick.net</PRE
1752 ></TD
1753 ></TR
1754 ></TABLE
1755 ></P
1756 ><P
1757 > We'll just show the interesting part here - the explicit matches. It is 
1758  matched three different times. Two <SPAN
1759 CLASS="QUOTE"
1760 >"+block"</SPAN
1761 > sections, 
1762  and a <SPAN
1763 CLASS="QUOTE"
1764 >"+block +handle-as-image"</SPAN
1765 >,
1766  which is the expanded form of one of our aliases that had been defined as: 
1767  <SPAN
1768 CLASS="QUOTE"
1769 >"+block-as-image"</SPAN
1770 >. (<A
1771 HREF="actions-file.html#ALIASES"
1772 ><SPAN
1773 CLASS="QUOTE"
1774 >"Aliases"</SPAN
1775 ></A
1776 > are defined in
1777  the first section of the actions file and typically used to combine more 
1778  than one action.)</P
1779 ><P
1780 > Any one of these would have done the trick and blocked this as an unwanted 
1781  image. This is unnecessarily redundant since the last case effectively 
1782  would also cover the first. No point in taking chances with these guys 
1783  though ;-) Note that if you want an ad or obnoxious 
1784  URL to be invisible, it should be defined as <SPAN
1785 CLASS="QUOTE"
1786 >"ad.doubleclick.net"</SPAN
1787 >
1788  is done here -- as both a <A
1789 HREF="actions-file.html#BLOCK"
1790 ><SPAN
1791 CLASS="QUOTE"
1792 >"+block"</SPAN
1793 ></A
1794 >
1795  <SPAN
1796 CLASS="emphasis"
1797 ><I
1798 CLASS="EMPHASIS"
1799 >and</I
1800 ></SPAN
1801 > an 
1802  <A
1803 HREF="actions-file.html#HANDLE-AS-IMAGE"
1804 ><SPAN
1805 CLASS="QUOTE"
1806 >"+handle-as-image"</SPAN
1807 ></A
1808 >.
1809  The custom alias <SPAN
1810 CLASS="QUOTE"
1811 >"<TT
1812 CLASS="LITERAL"
1813 >+block-as-image</TT
1814 >"</SPAN
1815 > just
1816  simplifies the process and make it more readable.</P
1817 ><P
1818 > One last example. Let's try <SPAN
1819 CLASS="QUOTE"
1820 >"http://www.example.net/adsl/HOWTO/"</SPAN
1821 >.
1822  This one is giving us problems. We are getting a blank page. Hmmm ...</P
1823 ><P
1824 > <TABLE
1825 BORDER="0"
1826 BGCOLOR="#E0E0E0"
1827 WIDTH="100%"
1828 ><TR
1829 ><TD
1830 ><PRE
1831 CLASS="SCREEN"
1832 >&#13; Matches for http://www.example.net/adsl/HOWTO/:
1833
1834  In file: default.action <SPAN
1835 CLASS="GUIBUTTON"
1836 >[ View ]</SPAN
1837 > <SPAN
1838 CLASS="GUIBUTTON"
1839 >[ Edit ]</SPAN
1840 >
1841
1842  {-add-header 
1843   -block
1844   -client-header-filter{hide-tor-exit-notation}
1845   -content-type-overwrite
1846   -crunch-client-header
1847   -crunch-if-none-match
1848   -crunch-incoming-cookies
1849   -crunch-outgoing-cookies
1850   -crunch-server-header
1851   +deanimate-gifs 
1852   -downgrade-http-version 
1853   +fast-redirects {check-decoded-url}
1854   -filter {js-events}
1855   -filter {content-cookies}
1856   -filter {all-popups}
1857   -filter {banners-by-link}
1858   -filter {tiny-textforms}
1859   -filter {frameset-borders}
1860   -filter {demoronizer}
1861   -filter {shockwave-flash}
1862   -filter {quicktime-kioskmode}
1863   -filter {fun}
1864   -filter {crude-parental}
1865   -filter {site-specifics}
1866   -filter {js-annoyances}
1867   -filter {html-annoyances}
1868   +filter {refresh-tags}
1869   -filter {unsolicited-popups}
1870   +filter {img-reorder}
1871   +filter {banners-by-size}
1872   +filter {webbugs}
1873   +filter {jumping-windows}
1874   +filter {ie-exploits}
1875   -filter {google}
1876   -filter {yahoo}
1877   -filter {msn}
1878   -filter {blogspot}
1879   -filter {no-ping}
1880   -force-text-mode
1881   -handle-as-empty-document
1882   -handle-as-image 
1883   -hide-accept-language
1884   -hide-content-disposition  
1885   +hide-forwarded-for-headers 
1886   +hide-from-header{block} 
1887   +hide-referer{forge} 
1888   -hide-user-agent 
1889   -inspect-jpegs
1890   -kill-popups 
1891   -overwrite-last-modified
1892   +prevent-compression 
1893   -redirect
1894   -send-vanilla-wafer 
1895   -send-wafer
1896   -server-header-filter{xml-to-html}
1897   -server-header-filter{html-to-xml} 
1898   +session-cookies-only 
1899   +set-image-blocker{blank} 
1900   -treat-forbidden-connects-like-blocks }
1901    /
1902
1903  { +block +handle-as-image }
1904   /ads</PRE
1905 ></TD
1906 ></TR
1907 ></TABLE
1908 ></P
1909 ><P
1910 > Ooops, the <SPAN
1911 CLASS="QUOTE"
1912 >"/adsl/"</SPAN
1913 > is matching <SPAN
1914 CLASS="QUOTE"
1915 >"/ads"</SPAN
1916 > in our 
1917  configuration! But we did not want this at all! Now we see why we get the
1918  blank page. It is actually triggering two different actions here, and 
1919  the effects are aggregated so that the URL is blocked, and <SPAN
1920 CLASS="APPLICATION"
1921 >Privoxy</SPAN
1922 > is told 
1923  to treat the block as if it were an image. But this is, of course, all wrong.
1924   We could now add a new action below this (or better in our own
1925   <TT
1926 CLASS="FILENAME"
1927 >user.action</TT
1928 > file) that explicitly
1929   <SPAN
1930 CLASS="emphasis"
1931 ><I
1932 CLASS="EMPHASIS"
1933 >un</I
1934 ></SPAN
1935 > blocks (
1936   <A
1937 HREF="actions-file.html#BLOCK"
1938 ><SPAN
1939 CLASS="QUOTE"
1940 >"{-block}"</SPAN
1941 ></A
1942 >) paths with
1943   <SPAN
1944 CLASS="QUOTE"
1945 >"adsl"</SPAN
1946 > in them (remember, last match in the configuration
1947   wins). There are various ways to handle such exceptions. Example:</P
1948 ><P
1949 > <TABLE
1950 BORDER="0"
1951 BGCOLOR="#E0E0E0"
1952 WIDTH="100%"
1953 ><TR
1954 ><TD
1955 ><PRE
1956 CLASS="SCREEN"
1957 >&#13; { -block }
1958   /adsl</PRE
1959 ></TD
1960 ></TR
1961 ></TABLE
1962 ></P
1963 ><P
1964 > Now the page displays ;-) 
1965  Remember to flush your browser's caches when making these kinds of changes to
1966  your configuration to insure that you get a freshly delivered page! Or, try
1967  using <TT
1968 CLASS="LITERAL"
1969 >Shift+Reload</TT
1970 >.</P
1971 ><P
1972 > But now what about a situation where we get no explicit matches like 
1973  we did with:</P
1974 ><P
1975 > <TABLE
1976 BORDER="0"
1977 BGCOLOR="#E0E0E0"
1978 WIDTH="100%"
1979 ><TR
1980 ><TD
1981 ><PRE
1982 CLASS="SCREEN"
1983 >&#13; { +block +handle-as-image }
1984  /ads</PRE
1985 ></TD
1986 ></TR
1987 ></TABLE
1988 ></P
1989 ><P
1990 > That actually was very helpful and pointed us quickly to where the problem
1991  was. If you don't get this kind of match, then it means one of the default 
1992  rules in the first section of <TT
1993 CLASS="FILENAME"
1994 >default.action</TT
1995 > is causing
1996  the problem. This would require some guesswork, and maybe a little trial and
1997  error to isolate the offending rule. One likely cause would be one of the
1998  <A
1999 HREF="actions-file.html#FILTER"
2000 ><SPAN
2001 CLASS="QUOTE"
2002 >"+filter"</SPAN
2003 ></A
2004 > actions.
2005  These tend to be harder to troubleshoot.
2006  Try adding the URL for the site to one of aliases that turn off
2007  <A
2008 HREF="actions-file.html#FILTER"
2009 ><SPAN
2010 CLASS="QUOTE"
2011 >"+filter"</SPAN
2012 ></A
2013 >:</P
2014 ><P
2015 > <TABLE
2016 BORDER="0"
2017 BGCOLOR="#E0E0E0"
2018 WIDTH="100%"
2019 ><TR
2020 ><TD
2021 ><PRE
2022 CLASS="SCREEN"
2023 >&#13; { shop }
2024  .quietpc.com
2025  .worldpay.com   # for quietpc.com
2026  .jungle.com
2027  .scan.co.uk
2028  .forbes.com</PRE
2029 ></TD
2030 ></TR
2031 ></TABLE
2032 ></P
2033 ><P
2034 > <SPAN
2035 CLASS="QUOTE"
2036 >"<TT
2037 CLASS="LITERAL"
2038 >{ shop }</TT
2039 >"</SPAN
2040 > is an <SPAN
2041 CLASS="QUOTE"
2042 >"alias"</SPAN
2043 > that expands to 
2044  <SPAN
2045 CLASS="QUOTE"
2046 >"<TT
2047 CLASS="LITERAL"
2048 >{ -filter -session-cookies-only }</TT
2049 >"</SPAN
2050 >.
2051  Or you could do your own exception to negate filtering:&#13;</P
2052 ><P
2053 > <TABLE
2054 BORDER="0"
2055 BGCOLOR="#E0E0E0"
2056 WIDTH="100%"
2057 ><TR
2058 ><TD
2059 ><PRE
2060 CLASS="SCREEN"
2061 >&#13; { -filter }
2062  # Disable ALL filter actions for sites in this section
2063  .forbes.com
2064  developer.ibm.com
2065  localhost</PRE
2066 ></TD
2067 ></TR
2068 ></TABLE
2069 ></P
2070 ><P
2071 > This would turn off all filtering for these sites. This is best
2072  put in <TT
2073 CLASS="FILENAME"
2074 >user.action</TT
2075 >, for local site
2076  exceptions. Note that when a simple domain pattern is used by itself (without
2077  the subsequent path portion), all sub-pages within that domain are included 
2078  automatically in the scope of the action.</P
2079 ><P
2080 > Images that are inexplicably being blocked, may well be hitting the 
2081 <A
2082 HREF="actions-file.html#FILTER-BANNERS-BY-SIZE"
2083 ><SPAN
2084 CLASS="QUOTE"
2085 >"+filter{banners-by-size}"</SPAN
2086 ></A
2087 >
2088  rule, which assumes 
2089  that images of certain sizes are ad banners (works well 
2090  <SPAN
2091 CLASS="emphasis"
2092 ><I
2093 CLASS="EMPHASIS"
2094 >most of the time</I
2095 ></SPAN
2096 >  since these tend to be standardized).</P
2097 ><P
2098 > <SPAN
2099 CLASS="QUOTE"
2100 >"<TT
2101 CLASS="LITERAL"
2102 >{ fragile }</TT
2103 >"</SPAN
2104 > is an alias that disables most
2105  actions that are the most likely to cause trouble. This can be used as a
2106  last resort for problem sites. </P
2107 ><P
2108 > <TABLE
2109 BORDER="0"
2110 BGCOLOR="#E0E0E0"
2111 WIDTH="100%"
2112 ><TR
2113 ><TD
2114 ><PRE
2115 CLASS="SCREEN"
2116 >&#13; { fragile }
2117  # Handle with care: easy to break
2118  mail.google.
2119  mybank.example.com</PRE
2120 ></TD
2121 ></TR
2122 ></TABLE
2123 ></P
2124 ><P
2125 > <SPAN
2126 CLASS="emphasis"
2127 ><I
2128 CLASS="EMPHASIS"
2129 >Remember to flush caches!</I
2130 ></SPAN
2131 > Note that the 
2132  <TT
2133 CLASS="LITERAL"
2134 >mail.google</TT
2135 > reference lacks the TLD portion (e.g. 
2136  <SPAN
2137 CLASS="QUOTE"
2138 >".com"</SPAN
2139 >). This will effectively match any TLD with 
2140  <TT
2141 CLASS="LITERAL"
2142 >google</TT
2143 > in it, such as <TT
2144 CLASS="LITERAL"
2145 >mail.google.de.</TT
2146 >, 
2147  just as an example.</P
2148 ><P
2149
2150  If this still does not work, you will have to go through the remaining
2151  actions one by one to find which one(s) is causing the problem.</P
2152 ></DIV
2153 ></DIV
2154 ><DIV
2155 CLASS="NAVFOOTER"
2156 ><HR
2157 ALIGN="LEFT"
2158 WIDTH="100%"><TABLE
2159 SUMMARY="Footer navigation table"
2160 WIDTH="100%"
2161 BORDER="0"
2162 CELLPADDING="0"
2163 CELLSPACING="0"
2164 ><TR
2165 ><TD
2166 WIDTH="33%"
2167 ALIGN="left"
2168 VALIGN="top"
2169 ><A
2170 HREF="seealso.html"
2171 ACCESSKEY="P"
2172 >Prev</A
2173 ></TD
2174 ><TD
2175 WIDTH="34%"
2176 ALIGN="center"
2177 VALIGN="top"
2178 ><A
2179 HREF="index.html"
2180 ACCESSKEY="H"
2181 >Home</A
2182 ></TD
2183 ><TD
2184 WIDTH="33%"
2185 ALIGN="right"
2186 VALIGN="top"
2187 >&nbsp;</TD
2188 ></TR
2189 ><TR
2190 ><TD
2191 WIDTH="33%"
2192 ALIGN="left"
2193 VALIGN="top"
2194 >See Also</TD
2195 ><TD
2196 WIDTH="34%"
2197 ALIGN="center"
2198 VALIGN="top"
2199 >&nbsp;</TD
2200 ><TD
2201 WIDTH="33%"
2202 ALIGN="right"
2203 VALIGN="top"
2204 >&nbsp;</TD
2205 ></TR
2206 ></TABLE
2207 ></DIV
2208 ></BODY
2209 ></HTML
2210 >