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