After Apache has translated the URI into a filename, it enters the header parser phase. This phase gives handlers a chance to examine the incoming request header and to take special action, perhaps altering the headers on the fly (as we will do below to create an anonymous proxy server) or blocking unwanted transactions at an early stage. For example, the header parser phase is commonly used to block unwanted robots before they consume the server resources during the later phases. You could use the Apache::BlockAgent module, implemented as an access handler in the last chapter, to block robots during this earlier phase.
Header parser handlers are installed with the PerlHeaderParserHandler. Because the URI has been mapped to a filename at this point, the directive is allowed in .htaccess files and directory configuration sections, as well as in the main body of the configuration files. All registered header parser handlers will be run unless one returns an error code or DONE.
When PerlInitHandler is used within a directory section or a .htaccess file, it acts as an alias for PerlHeaderParserHeader.
One nontrivial use for the header parser phase is to implement an unsupported HTTP request method. The Apache server handles the most common HTTP methods, such as GET, HEAD, and POST. Apache also provides hooks for managing the less commonly used PUT and DELETE methods, but the work of processing the method ...