Structure of a module
This paragraph describes the elements which are included in an Apache module. A table of commands, which are used in the configuration file. Each line of the table contains the name of the command and the name of the function associated with this command. This table can be empty if the module does not implement any configuration command. A table d'handlers, used for the response phase in the request processing. Each module intervening in the response phase can implement one or more handlers. Each line of the table contains the name of the handler and the associated function. If the module does not intervene in the response, this table is empty. For this step the modules declare a table of handlers because they can deal with several types of files (thus they need a line of table for each type of file). However the majority of the modules declare only one handler in this table. . For the stages where the module does not intervene, the corresponding handlers have value NULL. Handlers corresponding at the other steps of request processing (one handler by step). For the steps where the module does not intervene, the corresponding handlers have the NULL value.
Request processing
At the startup of Apache, a table indexing for each step (except the response phase) all the handlers handling this step is created, by traversing the configuration of each module in the opposite order where they were activated in the configuration file (the last module activated has the greatest priority). Thus, for each processing step, the server has a list of handlers (as well as the module where the handler is implemented). A handler can typically do one of three things: Handle the request, and indicate that it has done so by returning the constant OK. Decline to handle the request by returning the integer constant DECLINED. In this case, the server behaves in all respects as if the handler simply hadn't been there. Signal an error, by returning one of the HTTP error codes. This terminates normal handling of the request, although an ErrorDocument may be invoked to try to mop up, and it will be logged in any case. Most phases are terminated by the first module that handles them; however, for logging, `fixups', and authentication checking, all handlers always run (barring an error). The 'fixups' step is done just before the response. It allows modules which implement a handler for a given step, but which could'nt handle this step because a handler of anoter module returned OK before for this step, to modify certains fiels of response headers. Fot the response step, a handler is associated with the request according to the MIME type of the requested object. Therefore, the response will be provided only by the module which implements this handler. Fot the requests with none associated handler (the type of the requested file doesn't need any treatment), the default handler in the core module of Apache is invoked to send the response to the client. The steps described previously are named in the sources of Apache as follows (except the phase which I called 'response' which corresponds to the invocation of the handler in charge of sending the response to the client): filename translation header parser check access check user_id check auth type checker fixups response logger These are these names that I use in the description of the modules of Apache. Contact - version française