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