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