From 0f5ddb65a13bf345972ce1dd4320c92bcfd5b04e Mon Sep 17 00:00:00 2001
From: Daniel Gruno
-This document will discuss how you can easily create modules for the Apache
+This document will discuss how you can create modules for the Apache
HTTP Server 2.4, by exploring an example module called
mod_example. In the first part of this document, the purpose
of this module will be to calculate and print out various digest values for
@@ -248,6 +248,8 @@ can create. Some other ways of hooking are:
ap_hook_pre_config: Place a hook that executes before any configuration data has been read (very early hook)ap_hook_post_config: Place a hook that executes after configuration has been parsed, but before the server has forkedap_hook_translate_name: Place a hook that executes when a URI needs to be translated into a filename on the server (think mod_rewrite)ap_hook_quick_handler: Similar to ap_hook_handler, except it is run before any other request hooks (translation, auth, fixups etc)ap_hook_log_transaction: Place a hook that executes when the server is about to add a log entry of the current requestr->args (char*): Contains the query string of the request, if anyr->headers_in (apr_table_t*): Contains all the headers sent by the clientr->connection (conn_rec*): A record containing information about the current connectionr->user (char*): If the URI requires authentication, this is set to the username providedr->useragent_ip (char*): The IP address of the client connecting to usr->pool (apr_pool_t*): The memory pool of this request. We'll discuss this in the "
-Memory management" chapter.r->pool (apr_pool_t*): The memory pool of this request. We'll discuss this in the
+"Memory management" chapter.
A complete list of all the values contained with in the request_req structure can be found in
@@ -1313,10 +1316,11 @@ two configurations and decide how they are to be merged:
void* merge_dir_conf(apr_pool_t* pool, void* BASE, void* ADD) {
- example_config* base = (example_config *) BASE ;
- example_config* add = (example_config *) ADD ;
- example_config* conf = (example_config *) create_dir_conf(pool, "Merged configuration");
+ example_config* base = (example_config *) BASE ; /* This is what was set in the parent context */
+ example_config* add = (example_config *) ADD ; /* This is what is set in the new context */
+ example_config* conf = (example_config *) create_dir_conf(pool, "Merged configuration"); /* This will be the merged configuration */
+ /* Merge configurations */
conf->enabled = ( add->enabled == 0 ) ? base->enabled : add->enabled ;
conf->typeOfAction = add->typeOfAction ? add->typeOfAction : base->typeOfAction;
strcpy(conf->path, strlen(add->path) ? add->path : base->path);
@@ -1658,7 +1662,7 @@ static int example_handler(request_req *r)
if (formData) {
int i;
for (i = 0; formData[i]; i++) {
- ap_rprintf(r, "%s == %s\n", formData[i]->key, formData[i]->value);
+ ap_rprintf(r, "%s = %s\n", formData[i]->key, formData[i]->value);
}
}
return OK;
--
2.47.3