8480b63562ce3b4ff6d1aa68970f86bb980d043c
[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="AEN3218"
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="AEN3233"
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="AEN3241"
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="AEN3246"
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="AEN3251"
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="AEN3256"
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="AEN3262"
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="AEN3266"
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="AEN3269"
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 --- File standard ---
1367 (no matches in this file)
1368
1369 --- File default ---
1370
1371 { -add-header -block +deanimate-gifs{last} -downgrade-http-version +fast-redirects 
1372  -filter{popups} -filter{fun} -filter{shockwave-flash} -filter{crude-parental} 
1373  +filter{html-annoyances} +filter{js-annoyances} +filter{content-cookies} 
1374  +filter{webbugs} +filter{refresh-tags} +filter{nimda} +filter{banners-by-size} 
1375  +hide-forwarded-for-headers +hide-from-header{block} +hide-referer{forge} 
1376  -hide-user-agent -handle-as-image +set-image-blocker{pattern} -limit-connect 
1377  +prevent-compression +session-cookies-only -crunch-outgoing-cookies 
1378  -crunch-incoming-cookies -kill-popups -send-vanilla-wafer -send-wafer }
1379 /
1380
1381  { -session-cookies-only }
1382  .google.com
1383
1384  { -fast-redirects }
1385  .google.com
1386
1387 --- File user ---
1388 (no matches in this file)  </PRE
1389 ></TD
1390 ></TR
1391 ></TABLE
1392 ></P
1393 ><P
1394 > This tells us how we have defined our 
1395  <A
1396 HREF="actions-file.html#ACTIONS"
1397 ><SPAN
1398 CLASS="QUOTE"
1399 >"actions"</SPAN
1400 ></A
1401 >, and
1402  which ones match for our example, <SPAN
1403 CLASS="QUOTE"
1404 >"google.com"</SPAN
1405 >. The first listing
1406  is any matches for the <TT
1407 CLASS="FILENAME"
1408 >standard.action</TT
1409 > file. No hits at
1410  all here on <SPAN
1411 CLASS="QUOTE"
1412 >"standard"</SPAN
1413 >. Then next is <SPAN
1414 CLASS="QUOTE"
1415 >"default"</SPAN
1416 >, or
1417  our <TT
1418 CLASS="FILENAME"
1419 >default.action</TT
1420 > file. The large, multi-line listing,
1421  is how the actions are set to match for all URLs, i.e. our default settings.
1422  If you look at your <SPAN
1423 CLASS="QUOTE"
1424 >"actions"</SPAN
1425 > file, this would be the section
1426  just below the <SPAN
1427 CLASS="QUOTE"
1428 >"aliases"</SPAN
1429 > section near the top. This will apply to
1430  all URLs as signified by the single forward slash at the end of the listing
1431  -- <SPAN
1432 CLASS="QUOTE"
1433 >"/"</SPAN
1434 >.</P
1435 ><P
1436 > But we can define additional actions that would be exceptions to these general
1437  rules, and then list specific URLs (or patterns) that these exceptions would
1438  apply to. Last match wins. Just below this then are two explicit matches for
1439  <SPAN
1440 CLASS="QUOTE"
1441 >".google.com"</SPAN
1442 >. The first is negating our previous cookie setting, 
1443  which was for <A
1444 HREF="actions-file.html#SESSION-COOKIES-ONLY"
1445 ><SPAN
1446 CLASS="QUOTE"
1447 >"+session-cookies-only"</SPAN
1448 ></A
1449 >
1450  (i.e. not persistent). So we will allow persistent cookies for google. The
1451  second turns <I
1452 CLASS="EMPHASIS"
1453 >off</I
1454 > any 
1455  <A
1456 HREF="actions-file.html#FAST-REDIRECTS"
1457 ><SPAN
1458 CLASS="QUOTE"
1459 >"+fast-redirects"</SPAN
1460 ></A
1461 >
1462  action, allowing this to take place unmolested. Note that there is a leading
1463  dot here -- <SPAN
1464 CLASS="QUOTE"
1465 >".google.com"</SPAN
1466 >. This will match any hosts and
1467  sub-domains, in the google.com domain also, such as
1468  <SPAN
1469 CLASS="QUOTE"
1470 >"www.google.com"</SPAN
1471 >. So, apparently, we have these two actions
1472  defined somewhere in the lower part of our <TT
1473 CLASS="FILENAME"
1474 >default.action</TT
1475 >
1476  file, and <SPAN
1477 CLASS="QUOTE"
1478 >"google.com"</SPAN
1479 > is referenced somewhere in these latter
1480  sections.</P
1481 ><P
1482 > Then, for our <TT
1483 CLASS="FILENAME"
1484 >user.action</TT
1485 > file, we again have no hits.</P
1486 ><P
1487 > And finally we pull it all together in the bottom section and summarize how
1488  <SPAN
1489 CLASS="APPLICATION"
1490 >Privoxy</SPAN
1491 > is applying all its <SPAN
1492 CLASS="QUOTE"
1493 >"actions"</SPAN
1494
1495  to <SPAN
1496 CLASS="QUOTE"
1497 >"google.com"</SPAN
1498 >:&#13;</P
1499 ><P
1500 > <TABLE
1501 BORDER="0"
1502 BGCOLOR="#E0E0E0"
1503 WIDTH="100%"
1504 ><TR
1505 ><TD
1506 ><PRE
1507 CLASS="SCREEN"
1508 >&#13; Final results:
1509  -add-header -block +deanimate-gifs{last} -downgrade-http-version -fast-redirects 
1510  -filter{popups} -filter{fun} -filter{shockwave-flash} -filter{crude-parental} 
1511  +filter{html-annoyances} +filter{js-annoyances} +filter{content-cookies} 
1512  +filter{webbugs} +filter{refresh-tags} +filter{nimda} +filter{banners-by-size} 
1513  +hide-forwarded-for-headers +hide-from-header{block} +hide-referer{forge} 
1514  -hide-user-agent -handle-as-image +set-image-blocker{pattern} -limit-connect 
1515  +prevent-compression -session-cookies-only -crunch-outgoing-cookies 
1516  -crunch-incoming-cookies -kill-popups -send-vanilla-wafer -send-wafer</PRE
1517 ></TD
1518 ></TR
1519 ></TABLE
1520 ></P
1521 ><P
1522 > Notice the only difference here to the previous listing, is to 
1523  <SPAN
1524 CLASS="QUOTE"
1525 >"fast-redirects"</SPAN
1526 > and <SPAN
1527 CLASS="QUOTE"
1528 >"session-cookies-only"</SPAN
1529 >.</P
1530 ><P
1531 > Now another example, <SPAN
1532 CLASS="QUOTE"
1533 >"ad.doubleclick.net"</SPAN
1534 >:</P
1535 ><P
1536 > <TABLE
1537 BORDER="0"
1538 BGCOLOR="#E0E0E0"
1539 WIDTH="100%"
1540 ><TR
1541 ><TD
1542 ><PRE
1543 CLASS="SCREEN"
1544 >&#13; { +block +handle-as-image }
1545   .ad.doubleclick.net
1546
1547  { +block +handle-as-image }
1548   ad*.
1549
1550  { +block +handle-as-image }
1551   .doubleclick.net</PRE
1552 ></TD
1553 ></TR
1554 ></TABLE
1555 ></P
1556 ><P
1557 > We'll just show the interesting part here, the explicit matches. It is 
1558  matched three different times. Each as an <SPAN
1559 CLASS="QUOTE"
1560 >"+block +handle-as-image"</SPAN
1561 >,
1562  which is the expanded form of one of our aliases that had been defined as: 
1563  <SPAN
1564 CLASS="QUOTE"
1565 >"+imageblock"</SPAN
1566 >. (<A
1567 HREF="actions-file.html#ALIASES"
1568 ><SPAN
1569 CLASS="QUOTE"
1570 >"Aliases"</SPAN
1571 ></A
1572 > are defined in
1573  the first section of the actions file and typically used to combine more 
1574  than one action.)</P
1575 ><P
1576 > Any one of these would have done the trick and blocked this as an unwanted 
1577  image. This is unnecessarily redundant since the last case effectively 
1578  would also cover the first. No point in taking chances with these guys 
1579  though ;-) Note that if you want an ad or obnoxious 
1580  URL to be invisible, it should be defined as <SPAN
1581 CLASS="QUOTE"
1582 >"ad.doubleclick.net"</SPAN
1583 >
1584  is done here -- as both a <A
1585 HREF="actions-file.html#BLOCK"
1586 ><SPAN
1587 CLASS="QUOTE"
1588 >"+block"</SPAN
1589 ></A
1590 >
1591  <I
1592 CLASS="EMPHASIS"
1593 >and</I
1594 > an 
1595  <A
1596 HREF="actions-file.html#HANDLE-AS-IMAGE"
1597 ><SPAN
1598 CLASS="QUOTE"
1599 >"+handle-as-image"</SPAN
1600 ></A
1601 >.
1602  The custom alias <SPAN
1603 CLASS="QUOTE"
1604 >"+imageblock"</SPAN
1605 > just simplifies the process and make 
1606  it more readable.</P
1607 ><P
1608 > One last example. Let's try <SPAN
1609 CLASS="QUOTE"
1610 >"http://www.rhapsodyk.net/adsl/HOWTO/"</SPAN
1611 >.
1612  This one is giving us problems. We are getting a blank page. Hmmm...</P
1613 ><P
1614 > <TABLE
1615 BORDER="0"
1616 BGCOLOR="#E0E0E0"
1617 WIDTH="100%"
1618 ><TR
1619 ><TD
1620 ><PRE
1621 CLASS="SCREEN"
1622 >&#13; Matches for http://www.rhapsodyk.net/adsl/HOWTO/:
1623
1624  { -add-header -block +deanimate-gifs -downgrade-http-version +fast-redirects 
1625    +filter{html-annoyances} +filter{js-annoyances} +filter{kill-popups} 
1626    +filter{webbugs} +filter{nimda} +filter{banners-by-size} +filter{hal} 
1627    +filter{fun} +hide-forwarded-for-headers +hide-from-header{block} 
1628    +hide-referer{forge} -hide-user-agent -handle-as-image +set-image-blocker{blank} 
1629    +prevent-compression +session-cookies-only -crunch-incoming-cookies 
1630    -crunch-outgoing-cookies +kill-popups -send-vanilla-wafer -send-wafer }
1631    /
1632
1633  { +block +handle-as-image }
1634   /ads</PRE
1635 ></TD
1636 ></TR
1637 ></TABLE
1638 ></P
1639 ><P
1640 > Ooops, the <SPAN
1641 CLASS="QUOTE"
1642 >"/adsl/"</SPAN
1643 > is matching <SPAN
1644 CLASS="QUOTE"
1645 >"/ads"</SPAN
1646 >! But 
1647  we did not want this at all! Now we see why we get the blank page. We could
1648  now add a new action below this that explicitly does <I
1649 CLASS="EMPHASIS"
1650 >not</I
1651 >
1652  block (<SPAN
1653 CLASS="QUOTE"
1654 >"{-block}"</SPAN
1655 >) paths with <SPAN
1656 CLASS="QUOTE"
1657 >"adsl"</SPAN
1658 >. There are
1659  various ways to handle such exceptions. Example:</P
1660 ><P
1661 > <TABLE
1662 BORDER="0"
1663 BGCOLOR="#E0E0E0"
1664 WIDTH="100%"
1665 ><TR
1666 ><TD
1667 ><PRE
1668 CLASS="SCREEN"
1669 >&#13; { -block }
1670   /adsl</PRE
1671 ></TD
1672 ></TR
1673 ></TABLE
1674 ></P
1675 ><P
1676 > Now the page displays ;-) Be sure to flush your browser's caches when 
1677  making such changes. Or, try using <TT
1678 CLASS="LITERAL"
1679 >Shift+Reload</TT
1680 >.</P
1681 ><P
1682 > But now what about a situation where we get no explicit matches like 
1683  we did with:</P
1684 ><P
1685 > <TABLE
1686 BORDER="0"
1687 BGCOLOR="#E0E0E0"
1688 WIDTH="100%"
1689 ><TR
1690 ><TD
1691 ><PRE
1692 CLASS="SCREEN"
1693 >&#13; { +block +handle-as-image }
1694  /ads</PRE
1695 ></TD
1696 ></TR
1697 ></TABLE
1698 ></P
1699 ><P
1700 > That actually was very telling and pointed us quickly to where the problem
1701  was. If you don't get this kind of match, then it means one of the default 
1702  rules in the first section is causing the problem. This would require some 
1703  guesswork, and maybe a little trial and error to isolate the offending rule.
1704  One likely cause would be one of the <SPAN
1705 CLASS="QUOTE"
1706 >"{+filter}"</SPAN
1707 > actions. Try 
1708  adding the URL for the site to one of aliases that turn off <SPAN
1709 CLASS="QUOTE"
1710 >"+filter"</SPAN
1711 >:</P
1712 ><P
1713 > <TABLE
1714 BORDER="0"
1715 BGCOLOR="#E0E0E0"
1716 WIDTH="100%"
1717 ><TR
1718 ><TD
1719 ><PRE
1720 CLASS="SCREEN"
1721 >&#13; {shop}
1722  .quietpc.com
1723  .worldpay.com   # for quietpc.com
1724  .jungle.com
1725  .scan.co.uk
1726  .forbes.com</PRE
1727 ></TD
1728 ></TR
1729 ></TABLE
1730 ></P
1731 ><P
1732 > <SPAN
1733 CLASS="QUOTE"
1734 >"{shop}"</SPAN
1735 > is an <SPAN
1736 CLASS="QUOTE"
1737 >"alias"</SPAN
1738 > that expands to 
1739  <SPAN
1740 CLASS="QUOTE"
1741 >"{ -filter -session-cookies-only }"</SPAN
1742 >.
1743  Or you could do your own exception to negate filtering:&#13;</P
1744 ><P
1745 > <TABLE
1746 BORDER="0"
1747 BGCOLOR="#E0E0E0"
1748 WIDTH="100%"
1749 ><TR
1750 ><TD
1751 ><PRE
1752 CLASS="SCREEN"
1753 >&#13; {-filter}
1754  .forbes.com</PRE
1755 ></TD
1756 ></TR
1757 ></TABLE
1758 ></P
1759 ><P
1760 > This would probably be most appropriately put in <TT
1761 CLASS="FILENAME"
1762 >user.action</TT
1763 >, 
1764  for local site exceptions.</P
1765 ><P
1766 > <SPAN
1767 CLASS="QUOTE"
1768 >"{fragile}"</SPAN
1769 > is an alias that disables most actions. This can be 
1770  used as a last resort for problem sites. Remember to flush caches! If this 
1771  still does not work, you will have to go through the remaining actions one by
1772  one to find which one(s) is causing the problem.</P
1773 ></DIV
1774 ></DIV
1775 ><DIV
1776 CLASS="NAVFOOTER"
1777 ><HR
1778 ALIGN="LEFT"
1779 WIDTH="100%"><TABLE
1780 WIDTH="100%"
1781 BORDER="0"
1782 CELLPADDING="0"
1783 CELLSPACING="0"
1784 ><TR
1785 ><TD
1786 WIDTH="33%"
1787 ALIGN="left"
1788 VALIGN="top"
1789 ><A
1790 HREF="seealso.html"
1791 >Prev</A
1792 ></TD
1793 ><TD
1794 WIDTH="34%"
1795 ALIGN="center"
1796 VALIGN="top"
1797 ><A
1798 HREF="index.html"
1799 >Home</A
1800 ></TD
1801 ><TD
1802 WIDTH="33%"
1803 ALIGN="right"
1804 VALIGN="top"
1805 >&nbsp;</TD
1806 ></TR
1807 ><TR
1808 ><TD
1809 WIDTH="33%"
1810 ALIGN="left"
1811 VALIGN="top"
1812 >See Also</TD
1813 ><TD
1814 WIDTH="34%"
1815 ALIGN="center"
1816 VALIGN="top"
1817 >&nbsp;</TD
1818 ><TD
1819 WIDTH="33%"
1820 ALIGN="right"
1821 VALIGN="top"
1822 >&nbsp;</TD
1823 ></TR
1824 ></TABLE
1825 ></DIV
1826 ></BODY
1827 ></HTML
1828 >