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