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