request.html.en revision b95ae799514ad86a15610ad75808d7065e9847c9
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<?xml version="1.0" encoding="ISO-8859-1"?>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend This file is generated from xml source: DO NOT EDIT
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend -->
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<title>Request Processing in Apache 2.0 - Apache HTTP Server</title>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<link href="/images/favicon.ico" rel="shortcut icon" /></head>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<body id="manual-page"><div id="page-header">
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<p class="apache">Apache HTTP Server Version 2.1</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<img alt="" src="/images/feather.gif" /></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<div id="path">
c82fca6d3f5608b946f18d37e8710b1d71e3478dnd<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="../">Version 2.1</a> &gt; <a href="./">Developer Documentation</a></div><div id="page-content"><div id="preamble"><h1>Request Processing in Apache 2.0</h1>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<div class="toplang">
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<p><span>Available Languages: </span><a href="/en/developer/request.html" title="English">&nbsp;en&nbsp;</a></p>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd</div>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <div class="warning"><h3>Warning</h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>Warning - this is a first (fast) draft that needs further
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend revision!</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend </div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>Several changes in Apache 2.0 affect the internal request
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend processing mechanics. Module authors need to be aware of these
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend changes so they may take advantage of the optimizations and
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend security enhancements.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>The first major change is to the subrequest and redirect
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend mechanisms. There were a number of different code paths in
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend Apache 1.3 to attempt to optimize subrequest or redirect
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend behavior. As patches were introduced to 2.0, these
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend optimizations (and the server behavior) were quickly broken due
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend to this duplication of code. All duplicate code has been folded
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend back into <code>ap_process_internal_request()</code> to prevent
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend the code from falling out of sync again.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>This means that much of the existing code was 'unoptimized'.
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend It is the Apache HTTP Project's first goal to create a robust
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend and correct implementation of the HTTP server RFC. Additional
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend goals include security, scalability and optimization. New
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend methods were sought to optimize the server (beyond the
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend performance of Apache 1.3) without introducing fragile or
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend insecure code.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend</div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<div id="quickview"><ul id="toc"><li><img alt="" src="/images/down.gif" /> <a href="#processing">The Request Processing Cycle</a></li>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<li><img alt="" src="/images/down.gif" /> <a href="#parsing">The Request Parsing Phase</a></li>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<li><img alt="" src="/images/down.gif" /> <a href="#security">The Security Phase</a></li>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<li><img alt="" src="/images/down.gif" /> <a href="#preparation">The Preparation Phase</a></li>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<li><img alt="" src="/images/down.gif" /> <a href="#handler">The Handler Phase</a></li>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend</ul></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<div class="section">
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<h2><a name="processing" id="processing">The Request Processing Cycle</a></h2>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>All requests pass through <code>ap_process_request_internal()</code>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend in <code>request.c</code>, including subrequests and redirects. If a module
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend doesn't pass generated requests through this code, the author is cautioned
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend that the module may be broken by future changes to request
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend processing.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>To streamline requests, the module author can take advantage
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend of the hooks offered to drop out of the request cycle early, or
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend to bypass core Apache hooks which are irrelevant (and costly in
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend terms of CPU.)</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<div class="section">
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<h2><a name="parsing" id="parsing">The Request Parsing Phase</a></h2>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="unescape" id="unescape">Unescapes the URL</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>The request's <code>parsed_uri</code> path is unescaped, once and only
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend once, at the beginning of internal request processing.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>This step is bypassed if the proxyreq flag is set, or the
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code>parsed_uri.path</code> element is unset. The module has no further
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend control of this one-time unescape operation, either failing to
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend unescape or multiply unescaping the URL leads to security
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend reprecussions.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="strip" id="strip">Strips Parent and This Elements from the
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend URI</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>All <code>/../</code> and <code>/./</code> elements are
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend removed by <code>ap_getparents()</code>. This helps to ensure
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend the path is (nearly) absolute before the request processing
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend continues.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>This step cannot be bypassed.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="inital-location-walk" id="inital-location-walk">Initial URI Location Walk</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>Every request is subject to an
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code>ap_location_walk()</code> call. This ensures that
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code class="directive"><a href="/mod/core.html#location">&lt;Location&gt;</a></code> sections
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend are consistently enforced for all requests. If the request is an internal
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend redirect or a sub-request, it may borrow some or all of the processing
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend from the previous or parent request's ap_location_walk, so this step
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend is generally very efficient after processing the main request.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="translate_name" id="translate_name">translate_name</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>Modules can determine the file name, or alter the given URI
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend in this step. For example, <code class="module"><a href="/mod/mod_vhost_alias.html">mod_vhost_alias</a></code> will
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend translate the URI's path into the configured virtual host,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code class="module"><a href="/mod/mod_alias.html">mod_alias</a></code> will translate the path to an alias path,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend and if the request falls back on the core, the <code class="directive"><a href="/mod/core.html#documentroot">DocumentRoot</a></code> is prepended to the request resource.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>If all modules <code>DECLINE</code> this phase, an error 500 is
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend returned to the browser, and a "couldn't translate name" error is logged
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend automatically.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="map_to_storage" id="map_to_storage">Hook: map_to_storage</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>After the file or correct URI was determined, the
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend appropriate per-dir configurations are merged together. For
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend example, <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code> compares and merges the appropriate
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code class="directive"><a href="/mod/mod_proxy.html#proxy">&lt;Proxy&gt;</a></code> sections.
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend If the URI is nothing more than a local (non-proxy) <code>TRACE</code>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend request, the core handles the request and returns <code>DONE</code>.
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend If no module answers this hook with <code>OK</code> or <code>DONE</code>,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend the core will run the request filename against the <code class="directive"><a href="/mod/core.html#directory">&lt;Directory&gt;</a></code> and <code class="directive"><a href="/mod/core.html#files">&lt;Files&gt;</a></code> sections. If the request
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend 'filename' isn't an absolute, legal filename, a note is set for
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend later termination.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="location-walk" id="location-walk">URI Location Walk</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>Every request is hardened by a second
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code>ap_location_walk()</code> call. This reassures that a
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend translated request is still subjected to the configured
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code class="directive"><a href="/mod/core.html#location">&lt;Location&gt;</a></code> sections.
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend The request again borrows some or all of the processing from its previous
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code>location_walk</code> above, so this step is almost always very
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend efficient unless the translated URI mapped to a substantially different
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend path or Virtual Host.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="header_parser" id="header_parser">Hook: header_parser</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>The main request then parses the client's headers. This
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend prepares the remaining request processing steps to better serve
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend the client's request.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<div class="section">
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<h2><a name="security" id="security">The Security Phase</a></h2>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>Needs Documentation. Code is:</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <div class="example"><pre>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendswitch (ap_satisfies(r)) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendcase SATISFY_ALL:
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendcase SATISFY_NOSPEC:
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend if ((access_status = ap_run_access_checker(r)) != 0) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend return decl_die(access_status, "check access", r);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend if (ap_some_auth_required(r)) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend if (((access_status = ap_run_check_user_id(r)) != 0)
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend || !ap_auth_type(r)) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend return decl_die(access_status, ap_auth_type(r)
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend ? "check user. No user file?"
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend : "perform authentication. AuthType not set!",
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend r);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend if (((access_status = ap_run_auth_checker(r)) != 0)
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend || !ap_auth_type(r)) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend return decl_die(access_status, ap_auth_type(r)
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend ? "check access. No groups file?"
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend : "perform authentication. AuthType not set!",
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend r);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend break;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendcase SATISFY_ANY:
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend if (((access_status = ap_run_access_checker(r)) != 0)) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend if (!ap_some_auth_required(r)) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend return decl_die(access_status, "check access", r);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend if (((access_status = ap_run_check_user_id(r)) != 0)
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend || !ap_auth_type(r)) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend return decl_die(access_status, ap_auth_type(r)
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend ? "check user. No user file?"
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend : "perform authentication. AuthType not set!",
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend r);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend if (((access_status = ap_run_auth_checker(r)) != 0)
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend || !ap_auth_type(r)) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend return decl_die(access_status, ap_auth_type(r)
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend ? "check access. No groups file?"
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend : "perform authentication. AuthType not set!",
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend r);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend break;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend}</pre></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<div class="section">
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<h2><a name="preparation" id="preparation">The Preparation Phase</a></h2>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="type_checker" id="type_checker">Hook: type_checker</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>The modules have an opportunity to test the URI or filename
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend against the target resource, and set mime information for the
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend request. Both <code class="module"><a href="/mod/mod_mime.html">mod_mime</a></code> and
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code class="module"><a href="/mod/mod_mime_magic.html">mod_mime_magic</a></code> use this phase to compare the file
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend name or contents against the administrator's configuration and set the
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend content type, language, character set and request handler. Some modules
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend may set up their filters or other request handling parameters at this
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend time.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>If all modules <code>DECLINE</code> this phase, an error 500 is
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend returned to the browser, and a "couldn't find types" error is logged
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend automatically.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="fixups" id="fixups">Hook: fixups</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>Many modules are 'trounced' by some phase above. The fixups
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend phase is used by modules to 'reassert' their ownership or force
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend the request's fields to their appropriate values. It isn't
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend always the cleanest mechanism, but occasionally it's the only
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend option.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<div class="section">
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<h2><a name="handler" id="handler">The Handler Phase</a></h2>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>This phase is <strong>not</strong> part of the processing in
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code>ap_process_request_internal()</code>. Many
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend modules prepare one or more subrequests prior to creating any
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend content at all. After the core, or a module calls
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code>ap_process_request_internal()</code> it then calls
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <code>ap_invoke_handler()</code> to generate the request.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="insert_filter" id="insert_filter">Hook: insert_filter</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>Modules that transform the content in some way can insert
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend their values and override existing filters, such that if the
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend user configured a more advanced filter out-of-order, then the
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend module can move its order as need be. There is no result code,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend so actions in this hook better be trusted to always succeed.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <h3><a name="hook_handler" id="hook_handler">Hook: handler</a></h3>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend <p>The module finally has a chance to serve the request in its
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend handler hook. Note that not every prepared request is sent to
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend the handler hook. Many modules, such as <code class="module"><a href="/mod/mod_autoindex.html">mod_autoindex</a></code>,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend will create subrequests for a given URI, and then never serve the
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend subrequest, but simply lists it for the user. Remember not to
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend put required teardown from the hooks above into this module,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend but register pool cleanups against the request pool to free
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend resources as required.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend</div></div>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<div class="bottomlang">
ad74a0524a06bfe11b7de9e3b4ce7233ab3bd3f7nd<p><span>Available Languages: </span><a href="/en/developer/request.html" title="English">&nbsp;en&nbsp;</a></p>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd</div><div id="footer">
b95ae799514ad86a15610ad75808d7065e9847c9kess<p class="apache">Copyright 1995-2005 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend</body></html>