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