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