+NAME="CHAIN"
+>14.3. Chain of Events</A
+></H2
+><P
+> Let's take a quick look at the basic sequence of events when a web page is
+ requested by your browser and <SPAN
+CLASS="APPLICATION"
+>Privoxy</SPAN
+> is on duty:</P
+><P
+> <P
+></P
+><UL
+><LI
+><P
+> First, your web browser requests a web page. The browser knows to send
+ the request to <SPAN
+CLASS="APPLICATION"
+>Privoxy</SPAN
+>, which will in turn,
+ relay the request to the remote web server after passing the following
+ tests:
+ </P
+></LI
+><LI
+><P
+> <SPAN
+CLASS="APPLICATION"
+>Privoxy</SPAN
+> traps any request for its own internal CGI
+ pages (e.g http://p.p/) and sends the CGI page back to the browser.
+ </P
+></LI
+><LI
+><P
+> Next, <SPAN
+CLASS="APPLICATION"
+>Privoxy</SPAN
+> checks to see if the URL
+ matches any <A
+HREF="actions-file.html#BLOCK"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+block"</SPAN
+></A
+> patterns. If
+ so, the URL is then blocked, and the remote web server will not be contacted.
+ <A
+HREF="actions-file.html#HANDLE-AS-IMAGE"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+handle-as-image"</SPAN
+></A
+>
+ is then checked and if it does not match, an
+ HTML <SPAN
+CLASS="QUOTE"
+>"BLOCKED"</SPAN
+> page is sent back. Otherwise, if it does match,
+ an image is returned. The type of image depends on the setting of <A
+HREF="actions-file.html#SET-IMAGE-BLOCKER"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+set-image-blocker"</SPAN
+></A
+>
+ (blank, checkerboard pattern, or an HTTP redirect to an image elsewhere).
+ </P
+></LI
+><LI
+><P
+> Untrusted URLs are blocked. If URLs are being added to the
+ <TT
+CLASS="FILENAME"
+>trust</TT
+> file, then that is done.
+ </P
+></LI
+><LI
+><P
+> If the URL pattern matches the <A
+HREF="actions-file.html#FAST-REDIRECTS"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+fast-redirects"</SPAN
+></A
+> action,
+ it is then processed. Unwanted parts of the requested URL are stripped.
+ </P
+></LI
+><LI
+><P
+> Now the rest of the client browser's request headers are processed. If any
+ of these match any of the relevant actions (e.g. <A
+HREF="actions-file.html#HIDE-USER-AGENT"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+hide-user-agent"</SPAN
+></A
+>,
+ etc.), headers are suppressed or forged as determined by these actions and
+ their parameters.
+ </P
+></LI
+><LI
+><P
+> Now the web server starts sending its response back (i.e. typically a web page and related
+ data).
+ </P
+></LI
+><LI
+><P
+> First, the server headers are read and processed to determine, among other
+ things, the MIME type (document type) and encoding. The headers are then
+ filtered as deterimed by the
+ <A
+HREF="actions-file.html#PREVENT-SETTING-COOKIES"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+prevent-setting-cookies"</SPAN
+></A
+>,
+ <A
+HREF="actions-file.html#SESSION-COOKIES-ONLY"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+session-cookies-only"</SPAN
+></A
+>,
+ and <A
+HREF="actions-file.html#DOWNGRADE-HTTP-VERSION"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+downgrade-http-version"</SPAN
+></A
+>
+ actions.
+ </P
+></LI
+><LI
+><P
+> If the <A
+HREF="actions-file.html#KILL-POPUPS"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+kill-popups"</SPAN
+></A
+>
+ action applies, and it is an HTML or JavaScript document, the popup-code in the
+ response is filtered on-the-fly as it is received.
+ </P
+></LI
+><LI
+><P
+> If a <A
+HREF="actions-file.html#FILTER"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+filter"</SPAN
+></A
+>
+ or <A
+HREF="actions-file.html#DEANIMATE-GIFS"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+deanimate-gifs"</SPAN
+></A
+>
+ action applies (and the document type fits the action), the rest of the page is
+ read into memory (up to a configurable limit). Then the filter rules (from
+ <TT
+CLASS="FILENAME"
+>default.filter</TT
+>) are processed against the buffered
+ content. Filters are applied in the order they are specified in the
+ <TT
+CLASS="FILENAME"
+>default.filter</TT
+> file. Animated GIFs, if present, are
+ reduced to either the first or last frame, depending on the action
+ setting.The entire page, which is now filtered, is then sent by
+ <SPAN
+CLASS="APPLICATION"
+>Privoxy</SPAN
+> back to your browser.
+ </P
+><P
+> If neither <A
+HREF="actions-file.html#FILTER"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+filter"</SPAN
+></A
+>
+ or <A
+HREF="actions-file.html#DEANIMATE-GIFS"
+TARGET="_top"
+><SPAN
+CLASS="QUOTE"
+>"+deanimate-gifs"</SPAN
+></A
+>
+ matches, then <SPAN
+CLASS="APPLICATION"
+>Privoxy</SPAN
+> passes the raw data through
+ to the client browser as it becomes available.
+ </P
+></LI
+><LI
+><P
+> As the browser receives the now (probably filtered) page content, it
+ reads and then requests any URLs that may be embedded within the page
+ source, e.g. ad images, stylesheets, JavaScript, other HTML documents (e.g.
+ frames), sounds, etc. For each of these objects, the browser issues a new
+ request. And each such request is in turn processed as above. Note that a
+ complex web page may have many such embedded URLs.
+ </P
+></LI
+></UL
+></P
+></DIV
+><DIV
+CLASS="SECT2"
+><H2
+CLASS="SECT2"
+><A