Syncing with recent sgml updates.
[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="AEN4640"
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="AEN4655"
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="AEN4663"
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="AEN4668"
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="AEN4673"
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="AEN4678"
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="AEN4684"
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="AEN4688"
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="AEN4691"
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 >) are processed against the buffered
1247    content. Filters are applied in the order they are specified in one of the
1248    filter files. Animated GIFs, if present, are
1249    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:</P
1394 ><P
1395 > <TABLE
1396 BORDER="0"
1397 BGCOLOR="#E0E0E0"
1398 WIDTH="100%"
1399 ><TR
1400 ><TD
1401 ><PRE
1402 CLASS="SCREEN"
1403 > Matches for http://google.com:
1404
1405  In file: default.action <SPAN
1406 CLASS="GUIBUTTON"
1407 >[ View ]</SPAN
1408 > <SPAN
1409 CLASS="GUIBUTTON"
1410 >[ Edit ]</SPAN
1411 >
1412
1413 {-add-header 
1414  -block 
1415  -crunch-outgoing-cookies 
1416  -crunch-incoming-cookies 
1417  +deanimate-gifs{last} 
1418  -downgrade-http-version 
1419  +fast-redirects 
1420  -filter{popups} 
1421  -filter{fun} 
1422  -filter{shockwave-flash} 
1423  -filter{crude-parental} 
1424  +filter{html-annoyances} 
1425  +filter{js-annoyances} 
1426  +filter{content-cookies} 
1427  +filter{webbugs} 
1428  +filter{refresh-tags} 
1429  +filter{nimda} 
1430  +filter{banners-by-size} 
1431  +hide-forwarded-for-headers 
1432  +hide-from-header{block} 
1433  +hide-referer{forge} 
1434  -hide-user-agent 
1435  -handle-as-image 
1436  -kill-popups 
1437  -limit-connect 
1438  +prevent-compression 
1439  -send-vanilla-wafer 
1440  -send-wafer 
1441  +session-cookies-only 
1442  +set-image-blocker{pattern} }
1443 /
1444
1445  { -session-cookies-only }
1446  .google.com
1447
1448  { -fast-redirects }
1449  .google.com
1450
1451 In file: user.action <SPAN
1452 CLASS="GUIBUTTON"
1453 >[ View ]</SPAN
1454 > <SPAN
1455 CLASS="GUIBUTTON"
1456 >[ Edit ]</SPAN
1457 >
1458 (no matches in this file)  </PRE
1459 ></TD
1460 ></TR
1461 ></TABLE
1462 ></P
1463 ><P
1464 > This tells us how we have defined our 
1465  <A
1466 HREF="actions-file.html#ACTIONS"
1467 ><SPAN
1468 CLASS="QUOTE"
1469 >"actions"</SPAN
1470 ></A
1471 >, and
1472  which ones match for our example, <SPAN
1473 CLASS="QUOTE"
1474 >"google.com"</SPAN
1475 >. The first listing
1476  is any matches for the <TT
1477 CLASS="FILENAME"
1478 >standard.action</TT
1479 > file. No hits at
1480  all here on <SPAN
1481 CLASS="QUOTE"
1482 >"standard"</SPAN
1483 >. Then next is <SPAN
1484 CLASS="QUOTE"
1485 >"default"</SPAN
1486 >, or
1487  our <TT
1488 CLASS="FILENAME"
1489 >default.action</TT
1490 > file. The large, multi-line listing,
1491  is how the actions are set to match for all URLs, i.e. our default settings.
1492  If you look at your <SPAN
1493 CLASS="QUOTE"
1494 >"actions"</SPAN
1495 > file, this would be the section
1496  just below the <SPAN
1497 CLASS="QUOTE"
1498 >"aliases"</SPAN
1499 > section near the top. This will apply to
1500  all URLs as signified by the single forward slash at the end of the listing
1501  -- <SPAN
1502 CLASS="QUOTE"
1503 >"/"</SPAN
1504 >.</P
1505 ><P
1506 > But we can define additional actions that would be exceptions to these general
1507  rules, and then list specific URLs (or patterns) that these exceptions would
1508  apply to. Last match wins. Just below this then are two explicit matches for
1509  <SPAN
1510 CLASS="QUOTE"
1511 >".google.com"</SPAN
1512 >. The first is negating our previous cookie setting, 
1513  which was for <A
1514 HREF="actions-file.html#SESSION-COOKIES-ONLY"
1515 ><SPAN
1516 CLASS="QUOTE"
1517 >"+session-cookies-only"</SPAN
1518 ></A
1519 >
1520  (i.e. not persistent). So we will allow persistent cookies for google. The
1521  second turns <SPAN
1522 CLASS="emphasis"
1523 ><I
1524 CLASS="EMPHASIS"
1525 >off</I
1526 ></SPAN
1527 > any 
1528  <A
1529 HREF="actions-file.html#FAST-REDIRECTS"
1530 ><SPAN
1531 CLASS="QUOTE"
1532 >"+fast-redirects"</SPAN
1533 ></A
1534 >
1535  action, allowing this to take place unmolested. Note that there is a leading
1536  dot here -- <SPAN
1537 CLASS="QUOTE"
1538 >".google.com"</SPAN
1539 >. This will match any hosts and
1540  sub-domains, in the google.com domain also, such as
1541  <SPAN
1542 CLASS="QUOTE"
1543 >"www.google.com"</SPAN
1544 >. So, apparently, we have these two actions
1545  defined somewhere in the lower part of our <TT
1546 CLASS="FILENAME"
1547 >default.action</TT
1548 >
1549  file, and <SPAN
1550 CLASS="QUOTE"
1551 >"google.com"</SPAN
1552 > is referenced somewhere in these latter
1553  sections.</P
1554 ><P
1555 > Then, for our <TT
1556 CLASS="FILENAME"
1557 >user.action</TT
1558 > file, we again have no hits.</P
1559 ><P
1560 > And finally we pull it all together in the bottom section and summarize how
1561  <SPAN
1562 CLASS="APPLICATION"
1563 >Privoxy</SPAN
1564 > is applying all its <SPAN
1565 CLASS="QUOTE"
1566 >"actions"</SPAN
1567
1568  to <SPAN
1569 CLASS="QUOTE"
1570 >"google.com"</SPAN
1571 >:&#13;</P
1572 ><P
1573 > <TABLE
1574 BORDER="0"
1575 BGCOLOR="#E0E0E0"
1576 WIDTH="100%"
1577 ><TR
1578 ><TD
1579 ><PRE
1580 CLASS="SCREEN"
1581 >&#13; Final results:
1582  
1583  -add-header 
1584  -block 
1585  -crunch-outgoing-cookies 
1586  -crunch-incoming-cookies 
1587  +deanimate-gifs{last} 
1588  -downgrade-http-version 
1589  -fast-redirects 
1590  -filter{popups} 
1591  -filter{fun} 
1592  -filter{shockwave-flash} 
1593  -filter{crude-parental} 
1594  +filter{html-annoyances} 
1595  +filter{js-annoyances} 
1596  +filter{content-cookies} 
1597  +filter{webbugs} 
1598  +filter{refresh-tags} 
1599  +filter{nimda} 
1600  +filter{banners-by-size} 
1601  +hide-forwarded-for-headers 
1602  +hide-from-header{block} 
1603  +hide-referer{forge} 
1604  -hide-user-agent 
1605  -handle-as-image 
1606  -kill-popups 
1607  -limit-connect 
1608  +prevent-compression 
1609  -send-vanilla-wafer 
1610  -send-wafer
1611  -session-cookies-only 
1612  +set-image-blocker{pattern} </PRE
1613 ></TD
1614 ></TR
1615 ></TABLE
1616 ></P
1617 ><P
1618 > Notice the only difference here to the previous listing, is to 
1619  <SPAN
1620 CLASS="QUOTE"
1621 >"fast-redirects"</SPAN
1622 > and <SPAN
1623 CLASS="QUOTE"
1624 >"session-cookies-only"</SPAN
1625 >,
1626  which are actived specifically for this site in our configuration.</P
1627 ><P
1628 > Now another example, <SPAN
1629 CLASS="QUOTE"
1630 >"ad.doubleclick.net"</SPAN
1631 >:</P
1632 ><P
1633 > <TABLE
1634 BORDER="0"
1635 BGCOLOR="#E0E0E0"
1636 WIDTH="100%"
1637 ><TR
1638 ><TD
1639 ><PRE
1640 CLASS="SCREEN"
1641 >&#13; { +block +handle-as-image }
1642   .ad.doubleclick.net
1643
1644  { +block +handle-as-image }
1645   ad*.
1646
1647  { +block +handle-as-image }
1648   .doubleclick.net</PRE
1649 ></TD
1650 ></TR
1651 ></TABLE
1652 ></P
1653 ><P
1654 > We'll just show the interesting part here, the explicit matches. It is 
1655  matched three different times. Each as an <SPAN
1656 CLASS="QUOTE"
1657 >"+block +handle-as-image"</SPAN
1658 >,
1659  which is the expanded form of one of our aliases that had been defined as: 
1660  <SPAN
1661 CLASS="QUOTE"
1662 >"+imageblock"</SPAN
1663 >. (<A
1664 HREF="actions-file.html#ALIASES"
1665 ><SPAN
1666 CLASS="QUOTE"
1667 >"Aliases"</SPAN
1668 ></A
1669 > are defined in
1670  the first section of the actions file and typically used to combine more 
1671  than one action.)</P
1672 ><P
1673 > Any one of these would have done the trick and blocked this as an unwanted 
1674  image. This is unnecessarily redundant since the last case effectively 
1675  would also cover the first. No point in taking chances with these guys 
1676  though ;-) Note that if you want an ad or obnoxious 
1677  URL to be invisible, it should be defined as <SPAN
1678 CLASS="QUOTE"
1679 >"ad.doubleclick.net"</SPAN
1680 >
1681  is done here -- as both a <A
1682 HREF="actions-file.html#BLOCK"
1683 ><SPAN
1684 CLASS="QUOTE"
1685 >"+block"</SPAN
1686 ></A
1687 >
1688  <SPAN
1689 CLASS="emphasis"
1690 ><I
1691 CLASS="EMPHASIS"
1692 >and</I
1693 ></SPAN
1694 > an 
1695  <A
1696 HREF="actions-file.html#HANDLE-AS-IMAGE"
1697 ><SPAN
1698 CLASS="QUOTE"
1699 >"+handle-as-image"</SPAN
1700 ></A
1701 >.
1702  The custom alias <SPAN
1703 CLASS="QUOTE"
1704 >"+imageblock"</SPAN
1705 > just simplifies the process and make 
1706  it more readable.</P
1707 ><P
1708 > One last example. Let's try <SPAN
1709 CLASS="QUOTE"
1710 >"http://www.rhapsodyk.net/adsl/HOWTO/"</SPAN
1711 >.
1712  This one is giving us problems. We are getting a blank page. Hmmm ...</P
1713 ><P
1714 > <TABLE
1715 BORDER="0"
1716 BGCOLOR="#E0E0E0"
1717 WIDTH="100%"
1718 ><TR
1719 ><TD
1720 ><PRE
1721 CLASS="SCREEN"
1722 >&#13; Matches for http://www.rhapsodyk.net/adsl/HOWTO/:
1723
1724  In file: default.action <SPAN
1725 CLASS="GUIBUTTON"
1726 >[ View ]</SPAN
1727 > <SPAN
1728 CLASS="GUIBUTTON"
1729 >[ Edit ]</SPAN
1730 >
1731
1732  {-add-header 
1733   -block 
1734   -crunch-incoming-cookies 
1735   -crunch-outgoing-cookies 
1736   +deanimate-gifs 
1737   -downgrade-http-version 
1738   +fast-redirects 
1739   +filter{html-annoyances} 
1740   +filter{js-annoyances} 
1741   +filter{kill-popups} 
1742   +filter{webbugs} 
1743   +filter{nimda} 
1744   +filter{banners-by-size} 
1745   +filter{hal} 
1746   +filter{fun} 
1747   +hide-forwarded-for-headers 
1748   +hide-from-header{block} 
1749   +hide-referer{forge} 
1750   -hide-user-agent 
1751   -handle-as-image 
1752   +kill-popups 
1753   +prevent-compression 
1754   -send-vanilla-wafer 
1755   -send-wafer 
1756   +session-cookies-only 
1757   +set-image-blocker{blank} }
1758    /
1759
1760  { +block +handle-as-image }
1761   /ads</PRE
1762 ></TD
1763 ></TR
1764 ></TABLE
1765 ></P
1766 ><P
1767 > Ooops, the <SPAN
1768 CLASS="QUOTE"
1769 >"/adsl/"</SPAN
1770 > is matching <SPAN
1771 CLASS="QUOTE"
1772 >"/ads"</SPAN
1773 >! But 
1774  we did not want this at all! Now we see why we get the blank page. We could
1775  now add a new action below this that explicitly does <SPAN
1776 CLASS="emphasis"
1777 ><I
1778 CLASS="EMPHASIS"
1779 >not</I
1780 ></SPAN
1781 >
1782  block (<SPAN
1783 CLASS="QUOTE"
1784 >"{-block}"</SPAN
1785 >) paths with <SPAN
1786 CLASS="QUOTE"
1787 >"adsl"</SPAN
1788 >. There are
1789  various ways to handle such exceptions. Example:</P
1790 ><P
1791 > <TABLE
1792 BORDER="0"
1793 BGCOLOR="#E0E0E0"
1794 WIDTH="100%"
1795 ><TR
1796 ><TD
1797 ><PRE
1798 CLASS="SCREEN"
1799 >&#13; { -block }
1800   /adsl</PRE
1801 ></TD
1802 ></TR
1803 ></TABLE
1804 ></P
1805 ><P
1806 > Now the page displays ;-) Be sure to flush your browser's caches when 
1807  making such changes. Or, try using <TT
1808 CLASS="LITERAL"
1809 >Shift+Reload</TT
1810 >.</P
1811 ><P
1812 > But now what about a situation where we get no explicit matches like 
1813  we did with:</P
1814 ><P
1815 > <TABLE
1816 BORDER="0"
1817 BGCOLOR="#E0E0E0"
1818 WIDTH="100%"
1819 ><TR
1820 ><TD
1821 ><PRE
1822 CLASS="SCREEN"
1823 >&#13; { +block +handle-as-image }
1824  /ads</PRE
1825 ></TD
1826 ></TR
1827 ></TABLE
1828 ></P
1829 ><P
1830 > That actually was very telling and pointed us quickly to where the problem
1831  was. If you don't get this kind of match, then it means one of the default 
1832  rules in the first section is causing the problem. This would require some 
1833  guesswork, and maybe a little trial and error to isolate the offending rule.
1834  One likely cause would be one of the <SPAN
1835 CLASS="QUOTE"
1836 >"{+filter}"</SPAN
1837 > actions. These 
1838  tend to be harder to troubleshoot. Try adding the URL for the site to one of
1839  aliases that turn off <SPAN
1840 CLASS="QUOTE"
1841 >"+filter"</SPAN
1842 >:</P
1843 ><P
1844 > <TABLE
1845 BORDER="0"
1846 BGCOLOR="#E0E0E0"
1847 WIDTH="100%"
1848 ><TR
1849 ><TD
1850 ><PRE
1851 CLASS="SCREEN"
1852 >&#13; {shop}
1853  .quietpc.com
1854  .worldpay.com   # for quietpc.com
1855  .jungle.com
1856  .scan.co.uk
1857  .forbes.com</PRE
1858 ></TD
1859 ></TR
1860 ></TABLE
1861 ></P
1862 ><P
1863 > <SPAN
1864 CLASS="QUOTE"
1865 >"{shop}"</SPAN
1866 > is an <SPAN
1867 CLASS="QUOTE"
1868 >"alias"</SPAN
1869 > that expands to 
1870  <SPAN
1871 CLASS="QUOTE"
1872 >"{ -filter -session-cookies-only }"</SPAN
1873 >.
1874  Or you could do your own exception to negate filtering:&#13;</P
1875 ><P
1876 > <TABLE
1877 BORDER="0"
1878 BGCOLOR="#E0E0E0"
1879 WIDTH="100%"
1880 ><TR
1881 ><TD
1882 ><PRE
1883 CLASS="SCREEN"
1884 >&#13; {-filter}
1885  .forbes.com</PRE
1886 ></TD
1887 ></TR
1888 ></TABLE
1889 ></P
1890 ><P
1891 > This would turn off all filtering for that site. This would probably be most
1892  appropriately put in <TT
1893 CLASS="FILENAME"
1894 >user.action</TT
1895 >, for local site
1896  exceptions.</P
1897 ><P
1898 > Images that are inexplicably being blocked, may well be hitting the 
1899  <SPAN
1900 CLASS="QUOTE"
1901 >"+filter{banners-by-size}"</SPAN
1902 > rule, which assumes 
1903  that images of certain sizes are ad banners (works well most of the time 
1904  since these tend to be standardized).</P
1905 ><P
1906 > <SPAN
1907 CLASS="QUOTE"
1908 >"{fragile}"</SPAN
1909 > is an alias that disables most actions. This can be 
1910  used as a last resort for problem sites. Remember to flush caches! If this 
1911  still does not work, you will have to go through the remaining actions one by
1912  one to find which one(s) is causing the problem.</P
1913 ></DIV
1914 ></DIV
1915 ><DIV
1916 CLASS="NAVFOOTER"
1917 ><HR
1918 ALIGN="LEFT"
1919 WIDTH="100%"><TABLE
1920 SUMMARY="Footer navigation table"
1921 WIDTH="100%"
1922 BORDER="0"
1923 CELLPADDING="0"
1924 CELLSPACING="0"
1925 ><TR
1926 ><TD
1927 WIDTH="33%"
1928 ALIGN="left"
1929 VALIGN="top"
1930 ><A
1931 HREF="seealso.html"
1932 ACCESSKEY="P"
1933 >Prev</A
1934 ></TD
1935 ><TD
1936 WIDTH="34%"
1937 ALIGN="center"
1938 VALIGN="top"
1939 ><A
1940 HREF="index.html"
1941 ACCESSKEY="H"
1942 >Home</A
1943 ></TD
1944 ><TD
1945 WIDTH="33%"
1946 ALIGN="right"
1947 VALIGN="top"
1948 >&nbsp;</TD
1949 ></TR
1950 ><TR
1951 ><TD
1952 WIDTH="33%"
1953 ALIGN="left"
1954 VALIGN="top"
1955 >See Also</TD
1956 ><TD
1957 WIDTH="34%"
1958 ALIGN="center"
1959 VALIGN="top"
1960 >&nbsp;</TD
1961 ><TD
1962 WIDTH="33%"
1963 ALIGN="right"
1964 VALIGN="top"
1965 >&nbsp;</TD
1966 ></TR
1967 ></TABLE
1968 ></DIV
1969 ></BODY
1970 ></HTML
1971 >