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