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