request.html.en revision ac082aefa89416cbdc9a1836eaf3bed9698201c8
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 -->
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh<title>Request Processing in the Apache HTTP Server 2.x - 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" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen<script src="/style/scripts/prettify.js" type="text/javascript">
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen</script>
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<link href="/images/favicon.ico" rel="shortcut icon" /></head>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend<body id="manual-page"><div id="page-header">
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowen<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
3f08db06526d6901aa08c110b5bc7dde6bc39905nd<p class="apache">Apache HTTP Server Version 2.5</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">
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh<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/">Documentation</a> &gt; <a href="../">Version 2.5</a> &gt; <a href="./">Developer Documentation</a></div><div id="page-content"><div id="preamble"><h1>Request Processing in the Apache HTTP Server 2.x</h1>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd<div class="toplang">
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<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
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh <p>Several changes in 2.0 and above 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
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh the Apache HTTP Server 1.3 to attempt to optimize subrequest
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh or redirect 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
dc06c0ac17fcd3d721bb865d7fc5d2cefe67c57ftrawick back into <code>ap_process_request_internal()</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
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh performance of 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>
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></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
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh to bypass core 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
d8925e7b1eb8644294705d7132173f6fcfe0350ahumbedooh repercussions.</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
1050464f9f91f75e7a1c5c3daf3fb7b8aa74592ahumbedooh <pre class="prettyprint lang-c">
8951c7d73bfa2ae5a2c8fe5bd27f3e677be02564noirin if ((access_status = ap_run_access_checker(r)) != 0) {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend return decl_die(access_status, "check access", r);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
8951c7d73bfa2ae5a2c8fe5bd27f3e677be02564noirin if ((access_status = ap_run_check_user_id(r)) != 0) {
8951c7d73bfa2ae5a2c8fe5bd27f3e677be02564noirin return decl_die(access_status, "check user", r);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
8951c7d73bfa2ae5a2c8fe5bd27f3e677be02564noirin if ((access_status = ap_run_auth_checker(r)) != 0) {
8951c7d73bfa2ae5a2c8fe5bd27f3e677be02564noirin return decl_die(access_status, "check authorization", r);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend }
1050464f9f91f75e7a1c5c3daf3fb7b8aa74592ahumbedooh </pre>
1050464f9f91f75e7a1c5c3daf3fb7b8aa74592ahumbedooh
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">
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung<p><span>Available Languages: </span><a href="/en/developer/request.html" title="English">&nbsp;en&nbsp;</a></p>
727872d18412fc021f03969b8641810d8896820bhumbedooh</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
0d0ba3a410038e179b695446bb149cce6264e0abnd<script type="text/javascript"><!--//--><![CDATA[//><!--
727872d18412fc021f03969b8641810d8896820bhumbedoohvar comments_shortname = 'httpd';
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedoohvar comments_identifier = 'http://httpd.apache.org/docs/trunk/developer/request.html';
0d0ba3a410038e179b695446bb149cce6264e0abnd(function(w, d) {
cc7e1025de9ac63bd4db6fe7f71c158b2cf09fe4humbedooh if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread"><\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd var s = d.createElement('script');
0d0ba3a410038e179b695446bb149cce6264e0abnd s.type = 'text/javascript';
0d0ba3a410038e179b695446bb149cce6264e0abnd s.async = true;
ac082aefa89416cbdc9a1836eaf3bed9698201c8humbedooh s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
0d0ba3a410038e179b695446bb149cce6264e0abnd (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
0d0ba3a410038e179b695446bb149cce6264e0abnd }
0d0ba3a410038e179b695446bb149cce6264e0abnd else {
727872d18412fc021f03969b8641810d8896820bhumbedooh d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
0d0ba3a410038e179b695446bb149cce6264e0abnd }
0d0ba3a410038e179b695446bb149cce6264e0abnd})(window, document);
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh//--><!]]></script></div><div id="footer">
5effc8b39fae5cd169d17f342bfc265705840014rbowen<p class="apache">Copyright 2012 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
d229f940abfb2490dee17979e9a5ff31b7012eb5rbowen<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
0d0ba3a410038e179b695446bb149cce6264e0abndif (typeof(prettyPrint) !== 'undefined') {
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd prettyPrint();
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd}
7fec19672a491661b2fe4b29f685bc7f4efa64d4nd//--><!]]></script>
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend</body></html>