From 723e3e23bd50d9183dd5b6a00a0087b45a7f7c65 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); @@ -1634,8 +1638,8 @@ keyValuePair* readPost(request_req* r) { if (res != OK || !pairs) return NULL; /* Return NULL if we failed or if there are is no POST data */ kvp = apr_pcalloc(r->pool, sizeof(keyValuePair) * (pairs->nelts + 1)); while (pairs && !apr_is_empty_array(pairs)) { - ap_form_pair_t *pair = (ap_form_pair_t *) apr_array_pop(pairs); i++; + ap_form_pair_t *pair = (ap_form_pair_t *) apr_array_pop(pairs); apr_brigade_length(pair->value, 1, &len); size = (apr_size_t) len; buffer = apr_palloc(r->pool, size + 1); @@ -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; diff --git a/docs/manual/howto/cgi.html.en b/docs/manual/howto/cgi.html.en index fa00983a9b..2c34351502 100644 --- a/docs/manual/howto/cgi.html.en +++ b/docs/manual/howto/cgi.html.en @@ -483,8 +483,11 @@ print "Hello, World.";#!/usr/bin/perl +use strict; +use warnings; + print "Content-type: text/html\n\n"; -foreach $key (keys %ENV) { +foreach my $key (keys %ENV) { print "$key --> $ENV{$key}<br>"; }diff --git a/docs/manual/howto/cgi.html.fr b/docs/manual/howto/cgi.html.fr index b40278e82a..e4d672b8c5 100644 --- a/docs/manual/howto/cgi.html.fr +++ b/docs/manual/howto/cgi.html.fr @@ -26,6 +26,8 @@ ja | ko +Cette traduction peut être périmée. Vérifiez la version + anglaise pour les changements récents.
Introduction
- diff --git a/docs/manual/howto/cgi.xml.fr b/docs/manual/howto/cgi.xml.fr index a87c3de58a..a87b9cf9b7 100644 --- a/docs/manual/howto/cgi.xml.fr +++ b/docs/manual/howto/cgi.xml.fr @@ -1,7 +1,7 @@ - + diff --git a/docs/manual/howto/cgi.xml.ja b/docs/manual/howto/cgi.xml.ja index 32cc66b67b..07dbb764fc 100644 --- a/docs/manual/howto/cgi.xml.ja +++ b/docs/manual/howto/cgi.xml.ja @@ -1,7 +1,7 @@ - + +
Configurer Apache pour autoriser CGI