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