mod_example_hooks.c revision a9a941ed6ca86039137d64bdc7b1c4fda9d07d12
842ae4bd224140319ae7feec1872b93dfd491143fielding/* Licensed to the Apache Software Foundation (ASF) under one or more
842ae4bd224140319ae7feec1872b93dfd491143fielding * contributor license agreements. See the NOTICE file distributed with
842ae4bd224140319ae7feec1872b93dfd491143fielding * this work for additional information regarding copyright ownership.
842ae4bd224140319ae7feec1872b93dfd491143fielding * The ASF licenses this file to You under the Apache License, Version 2.0
842ae4bd224140319ae7feec1872b93dfd491143fielding * (the "License"); you may not use this file except in compliance with
842ae4bd224140319ae7feec1872b93dfd491143fielding * the License. You may obtain a copy of the License at
04891cf70e0bfc38bfb027541dc821f04c754ff7nd * Unless required by applicable law or agreed to in writing, software
04891cf70e0bfc38bfb027541dc821f04c754ff7nd * distributed under the License is distributed on an "AS IS" BASIS,
04891cf70e0bfc38bfb027541dc821f04c754ff7nd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
04891cf70e0bfc38bfb027541dc821f04c754ff7nd * See the License for the specific language governing permissions and
04891cf70e0bfc38bfb027541dc821f04c754ff7nd * limitations under the License.
3568de757bac0b47256647504c186d17ca272f85rbb * Apache example module. Provide demonstrations of how modules do things.
3568de757bac0b47256647504c186d17ca272f85rbb * It is not meant to be used in a production server. Since it participates
3568de757bac0b47256647504c186d17ca272f85rbb * in all of the processing phases, it could conceivable interfere with
3568de757bac0b47256647504c186d17ca272f85rbb * the proper operation of other modules -- particularly the ones related
3568de757bac0b47256647504c186d17ca272f85rbb * to security.
3568de757bac0b47256647504c186d17ca272f85rbb * In the interest of brevity, all functions and structures internal to
3568de757bac0b47256647504c186d17ca272f85rbb * this module, but which may have counterparts in *real* modules, are
3568de757bac0b47256647504c186d17ca272f85rbb * prefixed with 'x_' instead of 'example_'.
3568de757bac0b47256647504c186d17ca272f85rbb * To use mod_example_hooks, configure the Apache build with
3568de757bac0b47256647504c186d17ca272f85rbb * --enable-example and compile. Set up a <Location> block in your
3568de757bac0b47256647504c186d17ca272f85rbb * configuration file like so:
3568de757bac0b47256647504c186d17ca272f85rbb * <Location /example>
3568de757bac0b47256647504c186d17ca272f85rbb * SetHandler example-hooks-handler
3568de757bac0b47256647504c186d17ca272f85rbb * </Location>
3568de757bac0b47256647504c186d17ca272f85rbb * When you look at that location on your server, you will see a backtrace of
3568de757bac0b47256647504c186d17ca272f85rbb * the callbacks that have been invoked up to that point. See the ErrorLog for
3568de757bac0b47256647504c186d17ca272f85rbb * more information on code paths that touch mod_example_hooks.
3568de757bac0b47256647504c186d17ca272f85rbb * IMPORTANT NOTES
3568de757bac0b47256647504c186d17ca272f85rbb * ===============
3568de757bac0b47256647504c186d17ca272f85rbb * Do NOT use this module on a production server. It attaches itself to every
3568de757bac0b47256647504c186d17ca272f85rbb * phase of the server runtime operations including startup, shutdown and
3568de757bac0b47256647504c186d17ca272f85rbb * request processing, and produces copious amounts of logging data. This will
3568de757bac0b47256647504c186d17ca272f85rbb * negatively affect server performance.
3568de757bac0b47256647504c186d17ca272f85rbb * Do NOT use mod_example_hooks as the basis for your own code. This module
3568de757bac0b47256647504c186d17ca272f85rbb * implements every callback hook offered by the Apache core, and your
3568de757bac0b47256647504c186d17ca272f85rbb * module will almost certainly not have to implement this much. If you
3568de757bac0b47256647504c186d17ca272f85rbb * want a simple module skeleton to start development, use apxs -g.
3568de757bac0b47256647504c186d17ca272f85rbb * XXX TO DO XXX
3568de757bac0b47256647504c186d17ca272f85rbb * =============
3568de757bac0b47256647504c186d17ca272f85rbb * * Enable HTML backtrace entries for more callbacks that are not directly
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * associated with a request
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * * Make sure every callback that posts an HTML backtrace entry does so in the * right category, so nothing gets overwritten
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * * Implement some logic to show what happens in the parent, and what in the
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * child(ren)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/*--------------------------------------------------------------------------*/
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding/* Data declarations. */
8f3ec4772d2aeb347cf40e87c77627bb784dd018rbb/* Here are the static cells and structure declarations private to our */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe/* module. */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/*--------------------------------------------------------------------------*/
98fb535f829e2a95aabd82420931f476661fa8e3jorton * Sample configuration record. Used for both per-directory and per-server
f0e395a55abfcad3d2bd7c63470003b08a93d567nd * configuration data.
f0e395a55abfcad3d2bd7c63470003b08a93d567nd * It's perfectly reasonable to have two different structures for the two
f0e395a55abfcad3d2bd7c63470003b08a93d567nd * different environments. The same command handlers will be called for
98fb535f829e2a95aabd82420931f476661fa8e3jorton * both, though, so the handlers need to be able to tell them apart. One
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * possibility is for both structures to start with an int which is 0 for
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * one and 1 for the other.
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * Note that while the per-directory and per-server configuration records are
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * available to most of the module handlers, they should be treated as
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * READ-ONLY by all except the command and merge handlers. Sometimes handlers
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * are handed a record that applies to the current location by implication or
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * inheritance, and modifying it will change the rules for other locations.
41634f717c623556a16b27b25d7d909a66fe20f8wrowetypedef struct x_cfg {
3568de757bac0b47256647504c186d17ca272f85rbb * (directory, server, or combination).
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz int local; /* Boolean: "Example" directive declared
3568de757bac0b47256647504c186d17ca272f85rbb int congenital; /* Boolean: did we inherit an "Example"? */
41634f717c623556a16b27b25d7d909a66fe20f8wrowe char *loc; /* Location to which this record applies. */
3568de757bac0b47256647504c186d17ca272f85rbb * String pointer to hold the startup trace. No harm working with a global until
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * the server is (may be) multi-threaded.
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * Declare ourselves so the configuration routines can find and know us.
3568de757bac0b47256647504c186d17ca272f85rbb * We'll fill it in at the end of the module.
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantzmodule AP_MODULE_DECLARE_DATA example_hooks_module;
3568de757bac0b47256647504c186d17ca272f85rbb/*--------------------------------------------------------------------------*/
3568de757bac0b47256647504c186d17ca272f85rbb/* The following pseudo-prototype declarations illustrate the parameters */
24b534291150023e6b68eca89ddd33e475ccddc0wrowe/* passed to command handlers for the different types of directive */
24b534291150023e6b68eca89ddd33e475ccddc0wrowe/* syntax. If an argument was specified in the directive definition */
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz/* (look for "command_rec" below), it's available to the command handler */
3568de757bac0b47256647504c186d17ca272f85rbb/* via the (void *) info field in the cmd_parms argument passed to the */
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz/* handler (cmd->info for the examples below). */
3568de757bac0b47256647504c186d17ca272f85rbb/*--------------------------------------------------------------------------*/
3568de757bac0b47256647504c186d17ca272f85rbb * Command handler for a NO_ARGS directive. Declared in the command_rec
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * AP_INIT_NO_ARGS("directive", function, mconfig, where, help)
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * static const char *handle_NO_ARGS(cmd_parms *cmd, void *mconfig);
3568de757bac0b47256647504c186d17ca272f85rbb * Command handler for a RAW_ARGS directive. The "args" argument is the text
3568de757bac0b47256647504c186d17ca272f85rbb * of the commandline following the directive itself. Declared in the
3568de757bac0b47256647504c186d17ca272f85rbb * command_rec list with
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * AP_INIT_RAW_ARGS("directive", function, mconfig, where, help)
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * static const char *handle_RAW_ARGS(cmd_parms *cmd, void *mconfig,
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * const char *args);
3568de757bac0b47256647504c186d17ca272f85rbb * Command handler for a FLAG directive. The single parameter is passed in
3568de757bac0b47256647504c186d17ca272f85rbb * "bool", which is either zero or not for Off or On respectively.
3568de757bac0b47256647504c186d17ca272f85rbb * Declared in the command_rec list with
3568de757bac0b47256647504c186d17ca272f85rbb * AP_INIT_FLAG("directive", function, mconfig, where, help)
3568de757bac0b47256647504c186d17ca272f85rbb * static const char *handle_FLAG(cmd_parms *cmd, void *mconfig, int bool);
3568de757bac0b47256647504c186d17ca272f85rbb * Command handler for a TAKE1 directive. The single parameter is passed in
3568de757bac0b47256647504c186d17ca272f85rbb * "word1". Declared in the command_rec list with
3568de757bac0b47256647504c186d17ca272f85rbb * AP_INIT_TAKE1("directive", function, mconfig, where, help)
397df70abe0bdd78a84fb6c38c02641bcfeadceasf * static const char *handle_TAKE1(cmd_parms *cmd, void *mconfig,
397df70abe0bdd78a84fb6c38c02641bcfeadceasf * char *word1);
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Command handler for a TAKE2 directive. TAKE2 commands must always have
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * exactly two arguments. Declared in the command_rec list with
3568de757bac0b47256647504c186d17ca272f85rbb * AP_INIT_TAKE2("directive", function, mconfig, where, help)
78ae889ffe0fdfab72f56c6993b0f302cb48da55rbb * static const char *handle_TAKE2(cmd_parms *cmd, void *mconfig,
d69e1ed15b5db3d832c1f6c8c403ef397248857atrawick * char *word1, char *word2);
41634f717c623556a16b27b25d7d909a66fe20f8wrowe * Command handler for a TAKE3 directive. Like TAKE2, these must have exactly
41634f717c623556a16b27b25d7d909a66fe20f8wrowe * three arguments, or the parser complains and doesn't bother calling us.
6653a33e820463abd4f81915b7a1eba0f602e200brianp * Declared in the command_rec list with
3568de757bac0b47256647504c186d17ca272f85rbb * AP_INIT_TAKE3("directive", function, mconfig, where, help)
6653a33e820463abd4f81915b7a1eba0f602e200brianp * static const char *handle_TAKE3(cmd_parms *cmd, void *mconfig,
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * char *word1, char *word2, char *word3);
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * Command handler for a TAKE12 directive. These can take either one or two
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * arguments.
3568de757bac0b47256647504c186d17ca272f85rbb * - word2 is a NULL pointer if no second argument was specified.
dd028aa8111afb6534fece555e8c2d408894671etrawick * Declared in the command_rec list with
d90b36a9e6f6ea9a583694f4db5e5edd54a750b3minfrin * AP_INIT_TAKE12("directive", function, mconfig, where, help)
d90b36a9e6f6ea9a583694f4db5e5edd54a750b3minfrin * static const char *handle_TAKE12(cmd_parms *cmd, void *mconfig,
d90b36a9e6f6ea9a583694f4db5e5edd54a750b3minfrin * char *word1, char *word2);
ca53a74f4012a45cbad48e940eddf27d866981f9dougm * Command handler for a TAKE123 directive. A TAKE123 directive can be given,
ca53a74f4012a45cbad48e940eddf27d866981f9dougm * as might be expected, one, two, or three arguments.
ca53a74f4012a45cbad48e940eddf27d866981f9dougm * - word2 is a NULL pointer if no second argument was specified.
d90b36a9e6f6ea9a583694f4db5e5edd54a750b3minfrin * - word3 is a NULL pointer if no third argument was specified.
d90b36a9e6f6ea9a583694f4db5e5edd54a750b3minfrin * Declared in the command_rec list with
d90b36a9e6f6ea9a583694f4db5e5edd54a750b3minfrin * AP_INIT_TAKE123("directive", function, mconfig, where, help)
dd028aa8111afb6534fece555e8c2d408894671etrawick * static const char *handle_TAKE123(cmd_parms *cmd, void *mconfig,
dd028aa8111afb6534fece555e8c2d408894671etrawick * char *word1, char *word2, char *word3);
6653a33e820463abd4f81915b7a1eba0f602e200brianp * Command handler for a TAKE13 directive. Either one or three arguments are
6653a33e820463abd4f81915b7a1eba0f602e200brianp * permitted - no two-parameters-only syntax is allowed.
6653a33e820463abd4f81915b7a1eba0f602e200brianp * - word2 and word3 are NULL pointers if only one argument was specified.
6653a33e820463abd4f81915b7a1eba0f602e200brianp * Declared in the command_rec list with
6653a33e820463abd4f81915b7a1eba0f602e200brianp * AP_INIT_TAKE13("directive", function, mconfig, where, help)
6653a33e820463abd4f81915b7a1eba0f602e200brianp * static const char *handle_TAKE13(cmd_parms *cmd, void *mconfig,
6653a33e820463abd4f81915b7a1eba0f602e200brianp * char *word1, char *word2, char *word3);
6653a33e820463abd4f81915b7a1eba0f602e200brianp * Command handler for a TAKE23 directive. At least two and as many as three
6653a33e820463abd4f81915b7a1eba0f602e200brianp * arguments must be specified.
cd8f8c995d415473f3bfb0b329b2450f2a722c3atrawick * - word3 is a NULL pointer if no third argument was specified.
cd8f8c995d415473f3bfb0b329b2450f2a722c3atrawick * Declared in the command_rec list with
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * AP_INIT_TAKE23("directive", function, mconfig, where, help)
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * static const char *handle_TAKE23(cmd_parms *cmd, void *mconfig,
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * char *word1, char *word2, char *word3);
3568de757bac0b47256647504c186d17ca272f85rbb * Command handler for a ITERATE directive.
3568de757bac0b47256647504c186d17ca272f85rbb * - Handler is called once for each of n arguments given to the directive.
185aa71728867671e105178b4c66fbc22b65ae26sf * - word1 points to each argument in turn.
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * Declared in the command_rec list with
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * AP_INIT_ITERATE("directive", function, mconfig, where, help)
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * static const char *handle_ITERATE(cmd_parms *cmd, void *mconfig,
48d2edbfb84e5559b5da0f8d614ccab805cc67a8rbb * char *word1);
f2e009134c7e279f99dfca5bd421f721bf1f7840jorton * Command handler for a ITERATE2 directive.
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * - Handler is called once for each of the second and subsequent arguments
3568de757bac0b47256647504c186d17ca272f85rbb * given to the directive.
3568de757bac0b47256647504c186d17ca272f85rbb * - word1 is the same for each call for a particular directive instance (the
3568de757bac0b47256647504c186d17ca272f85rbb * first argument).
3568de757bac0b47256647504c186d17ca272f85rbb * - word2 points to each of the second and subsequent arguments in turn.
3568de757bac0b47256647504c186d17ca272f85rbb * Declared in the command_rec list with
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * AP_INIT_ITERATE2("directive", function, mconfig, where, help)
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * static const char *handle_ITERATE2(cmd_parms *cmd, void *mconfig,
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * char *word1, char *word2);
9f979f5c8061f6f6f560d1824e0e378ff5b91931rpluem/*--------------------------------------------------------------------------*/
9f979f5c8061f6f6f560d1824e0e378ff5b91931rpluem/* These routines are strictly internal to this module, and support its */
9f979f5c8061f6f6f560d1824e0e378ff5b91931rpluem/* operation. They are not referenced by any external portion of the */
9f979f5c8061f6f6f560d1824e0e378ff5b91931rpluem/* server. */
e2de0e939faab767454a164c7d2e8ea710fd1a26sf/*--------------------------------------------------------------------------*/
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * Locate our directory configuration record for the current request.
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard return (x_cfg *) ap_get_module_config(r->per_dir_config, &example_hooks_module);
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * The following utility routines are not used in the module. Don't
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * compile them so -Wall doesn't complain about functions that are
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * defined but not used.
3568de757bac0b47256647504c186d17ca272f85rbb * Locate our server configuration record for the specified server.
7cd5419264796cfeaf8215383cf0f89130a81fectrawick return (x_cfg *) ap_get_module_config(s->module_config, &example_hooks_module);
98cd3186185bb28ae6c95a3f159899fcf56a663ftrawick * Likewise for our configuration record for the specified request.
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf return (x_cfg *) ap_get_module_config(r->request_config, &example_hooks_module);
cd8f8c995d415473f3bfb0b329b2450f2a722c3atrawick#endif /* if 0 */
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * Likewise for our configuration record for a connection.
397df70abe0bdd78a84fb6c38c02641bcfeadceasf return (x_cfg *) ap_get_module_config(c->conn_config, &example_hooks_module);
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * You *could* change the following if you wanted to see the calling
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * sequence reported in the server's error_log, but beware - almost all of
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * these co-routines are called for every single request, and the impact
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * on the size (and readability) of the error_log is considerable.
49aa87d735a13ae3d04012ee0df91ddb51f7c36esfstatic void example_log_each(apr_pool_t *p, server_rec *s, const char *note)
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf if (s != NULL) {
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, "mod_example: %s",
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf apr_file_printf(out, "mod_example traced in non-loggable "
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * This utility routine traces the hooks called when the server starts up.
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * It leaves a trace in a global variable, so it should not be called from
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * a hook handler that runs in a multi-threaded situation.
7cd5419264796cfeaf8215383cf0f89130a81fectrawickstatic void trace_startup(apr_pool_t *p, server_rec *s, x_cfg *mconfig,
7cd5419264796cfeaf8215383cf0f89130a81fectrawick const char *note)
7cd5419264796cfeaf8215383cf0f89130a81fectrawick const char *sofar;
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * If we weren't passed a configuration record, we can't figure out to
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * what location this call applies. This only happens for co-routines
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * that don't operate in a particular directory or server context. If we
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * got a valid record, extract the location (directory or server) to which
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * it applies.
7cd5419264796cfeaf8215383cf0f89130a81fectrawick where = (mconfig != NULL) ? mconfig->loc : "nowhere";
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * Make sure that we start with a valid string, even if we have never been
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * This utility route traces the hooks called as a request is handled.
3568de757bac0b47256647504c186d17ca272f85rbb * It takes the current request as argument
72b6f1cf3e616473e1c26464b3193b13c2c09e87brianpstatic void trace_request(const request_rec *r, const char *note)
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard if ((sofar = apr_table_get(r->notes, TRACE_NOTE)) == NULL) {
01d315c948a50cb511dbaee108b9571ee9a4d287jim " </dl>\n"
dd028aa8111afb6534fece555e8c2d408894671etrawick " </li>\n",
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard trace_copy = apr_pstrcat(r->pool, sofar, addon, NULL);
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * This utility routine traces the hooks called while processing a
f714f1a7002928d785e53e70349700a7f595fee3trawick * Connection. Its trace is kept in the pool notes of the pool associated
f714f1a7002928d785e53e70349700a7f595fee3trawick * with the Connection.
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh * Key to get and set the userdata. We should be able to get away
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh * with a constant key, since in prefork mode the process will have
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh * the connection and its pool to itself entirely, and in
3568de757bac0b47256647504c186d17ca272f85rbb * multi-threaded mode each connection will have its own pool.
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddardstatic void trace_connection(conn_rec *c, const char *note)
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh " </dl>\n"
4a13940dc2990df0a798718d3a3f9cf1566c2217bjh " </li>\n",
663237d6bcc59ac0997d71d48a1baa55fa29a3d8jim /* Find existing notes and copy */
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz /* Tack addon onto copy */
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard trace_copy = apr_pstrcat(c->pool, sofar, addon, NULL);
3568de757bac0b47256647504c186d17ca272f85rbb * Stash copy back into pool notes. This call has a cleanup
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * parameter, but we're not using it because the string has been
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * allocated from that same pool. There is also an unused return
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * value: we have nowhere to communicate any error that might
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * occur, and will have to check for the existence of this data on
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * the other end.
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard apr_pool_userdata_set((const void *) trace_copy, CONN_NOTE,
3568de757bac0b47256647504c186d17ca272f85rbbstatic void trace_nocontext(apr_pool_t *p, const char *file, int line,
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz const char *note)
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * Since we have no request or connection to trace, or any idea
3568de757bac0b47256647504c186d17ca272f85rbb * from where this routine was called, there's really not much we
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * can do. If we are not logging everything by way of the
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * EXAMPLE_LOG_EACH constant, do nothing in this routine.
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf ap_log_perror(file, line, APLOG_MODULE_INDEX, APLOG_NOTICE, 0, p, "%s", note);
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/*--------------------------------------------------------------------------*/
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* We prototyped the various syntax for command handlers (routines that */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* are called when the configuration parser detects a directive declared */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* by our module) earlier. Now we actually declare a "real" routine that */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* will be invoked by the parser when our "real" directive is */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* encountered. */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* If a command handler encounters a problem processing the directive, it */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* signals this fact by returning a non-NULL pointer to a string */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* describing the problem. */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* The magic return value DECLINE_CMD is used to deal with directives */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* that might be declared by multiple modules. If the command handler */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* returns NULL, the directive was processed; if it returns DECLINE_CMD, */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* the next module (if any) that declares the directive is given a chance */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* at it. If it returns any other value, it's treated as the text of an */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/* error message. */
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf/*--------------------------------------------------------------------------*/
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * Command handler for the NO_ARGS "Example" directive. All we do is mark the
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * call in the trace log, and flag the applicability of the directive to the
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * current location in that location's configuration record.
49aa87d735a13ae3d04012ee0df91ddb51f7c36esfstatic const char *cmd_example(cmd_parms *cmd, void *mconfig)
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * "Example Wuz Here"
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf trace_startup(cmd->pool, cmd->server, cfg, "cmd_example()");
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * This function gets called to create a per-directory configuration
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * record. This will be called for the "default" server environment, and for
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * each directory for which the parser finds any of our directives applicable.
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * If a directory doesn't have any of our directives involved (i.e., they
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * aren't in the .htaccess file, or a <Location>, <Directory>, or related
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * block), this routine will *not* be called - the configuration for the
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * closest ancestor is used.
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * The return value is a pointer to the created module-specific
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * structure.
49aa87d735a13ae3d04012ee0df91ddb51f7c36esfstatic void *x_create_dir_config(apr_pool_t *p, char *dirspec)
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * Allocate the space for our record from the pool supplied.
cd8f8c995d415473f3bfb0b329b2450f2a722c3atrawick * Now fill in the defaults. If there are any `parent' configuration
cd8f8c995d415473f3bfb0b329b2450f2a722c3atrawick * records, they'll get merged as part of a separate callback.
d69e1ed15b5db3d832c1f6c8c403ef397248857atrawick * Finally, add our trace to the callback list.
fe6baec9bbcd36f932b71a355120cd7b5a685d6cfielding cfg->loc = apr_pstrcat(p, "DIR(", dname, ")", NULL);
3568de757bac0b47256647504c186d17ca272f85rbb note = apr_psprintf(p, "x_create_dir_config(p == %pp, dirspec == %s)",
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf (void*) p, dirspec);
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard return (void *) cfg;
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * This function gets called to merge two per-directory configuration
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * records. This is typically done to cope with things like .htaccess files
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * or <Location> directives for directories that are beneath one for which a
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * configuration record was already created. The routine has the
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * responsibility of creating a new record and merging the contents of the
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * other two into it appropriately. If the module doesn't declare a merge
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * routine, the record for the closest ancestor location (that has one) is
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * used exclusively.
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * The routine MUST NOT modify any of its arguments!
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * The return value is a pointer to the created module-specific structure
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * containing the merged values.
8e9734d1a4af74c141e2a0f880bb51bb061fa03atrawickstatic void *x_merge_dir_config(apr_pool_t *p, void *parent_conf,
cd8f8c995d415473f3bfb0b329b2450f2a722c3atrawick x_cfg *merged_config = (x_cfg *) apr_pcalloc(p, sizeof(x_cfg));
0f113d7123e8bd3e3e2e9b6373461a1a773bfccatrawick * Some things get copied directly from the more-specific record, rather
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * than getting merged.
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * Others, like the setting of the `congenital' flag, get ORed in. The
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * setting of that particular flag, for instance, is TRUE if it was ever
3568de757bac0b47256647504c186d17ca272f85rbb * true anywhere in the upstream configuration.
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz merged_config->congenital = (pconf->congenital | pconf->local);
8dfa8c6f60f12e0b65eebbb652b629f911f0f84bsf * If we're merging records for two different types of environment (server
c0659e61002e9d6ff77b2dca72540e0af1b2ca64stoddard * and directory), mark the new record appropriately. Otherwise, inherit
3568de757bac0b47256647504c186d17ca272f85rbb * the current value.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick (pconf->cmode == nconf->cmode) ? pconf->cmode : CONFIG_MODE_COMBO;
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * Now just record our being called in the trace list. Include the
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * locations we were asked to merge.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick note = apr_psprintf(p, "x_merge_dir_config(p == %pp, parent_conf == "
f886987cd0bd4220c14043c4d9be77ec22902e73trawick "%pp, newloc_conf == %pp)", (void*) p,
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick return (void *) merged_config;
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * This function gets called to create a per-server configuration
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * record. It will always be called for the "default" server.
a72ba68ecbbc61e4b513e50d6000245c33f753dcwrowe * The return value is a pointer to the created module-specific
2e7f1d7da527c09e717251e186deffe55e6fbd0ftrawick * structure.
64c351fd973428b5bb4c28e983fa86875ea4e60fdougmstatic void *x_create_server_config(apr_pool_t *p, server_rec *s)
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * As with the x_create_dir_config() reoutine, we allocate and fill
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * in an empty record.
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * Note that we were called in the trace list.
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm return (void *) cfg;
36c8049de63c446926139936c3d195330a0539cetrawick * This function gets called to merge two per-server configuration
36c8049de63c446926139936c3d195330a0539cetrawick * records. This is typically done to cope with things like virtual hosts and
36c8049de63c446926139936c3d195330a0539cetrawick * the default server configuration The routine has the responsibility of
36c8049de63c446926139936c3d195330a0539cetrawick * creating a new record and merging the contents of the other two into it
36c8049de63c446926139936c3d195330a0539cetrawick * appropriately. If the module doesn't declare a merge routine, the more
36c8049de63c446926139936c3d195330a0539cetrawick * specific existing record is used exclusively.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * The routine MUST NOT modify any of its arguments!
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * The return value is a pointer to the created module-specific structure
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * containing the merged values.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawickstatic void *x_merge_server_config(apr_pool_t *p, void *server1_conf,
cb97ae2ff6969c2789b8e03f1bc4187fa73b6bafwrowe x_cfg *merged_config = (x_cfg *) apr_pcalloc(p, sizeof(x_cfg));
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * Our inheritance rules are our own, and part of our module's semantics.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * Basically, just note whence we came.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick (s1conf->cmode == s2conf->cmode) ? s1conf->cmode : CONFIG_MODE_COMBO;
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick merged_config->congenital = (s1conf->congenital | s1conf->local);
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * Trace our call, including what we were asked to merge.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick note = apr_pstrcat(p, "x_merge_server_config(\"", s1conf->loc, "\",\"",
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick return (void *) merged_config;
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick/*--------------------------------------------------------------------------*
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * Now let's declare routines for each of the callback hooks in order. *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * (That's the order in which they're listed in the callback list, *not *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * the order in which the server calls them! See the command_rec *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * declaration near the bottom of this file.) Note that these may be *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * called for situations that don't relate primarily to our function - in *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * other words, the fixup handler shouldn't assume that the request has *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * to do with "example" stuff. *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * With the exception of the content handler, all of our routines will be *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * called for each request, unless an earlier handler from another module *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * aborted the sequence. *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * There are three types of hooks (see include/ap_config.h): *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * VOID : No return code, run all handlers declared by any module *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * RUN_FIRST : Run all handlers until one returns something other *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * than DECLINED. Hook runner result is result of last callback *
e8f95a682820a599fe41b22977010636be5c2717jim * RUN_ALL : Run all handlers until one returns something other than OK *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * or DECLINED. The hook runner returns that other value. If *
f886987cd0bd4220c14043c4d9be77ec22902e73trawick * all hooks run, the hook runner returns OK. *
f886987cd0bd4220c14043c4d9be77ec22902e73trawick * Handlers that are declared as "int" can return the following: *
f886987cd0bd4220c14043c4d9be77ec22902e73trawick * OK Handler accepted the request and did its thing with it. *
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * DECLINED Handler took no action. *
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * HTTP_mumble Handler looked at request and found it wanting. *
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * See include/httpd.h for a list of HTTP_mumble status codes. Handlers *
3568de757bac0b47256647504c186d17ca272f85rbb * that are not declared as int return a valid pointer, or NULL if they *
72b6f1cf3e616473e1c26464b3193b13c2c09e87brianp * DECLINE to handle their phase for that specific request. Exceptions, if *
72b6f1cf3e616473e1c26464b3193b13c2c09e87brianp * any, are noted with each routine. *
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick *--------------------------------------------------------------------------*/
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * This routine is called before the server processes the configuration
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * files. There is no return value.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawickstatic int x_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * Log the call and exit.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * This routine is called after the server processes the configuration
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * files. At this point the module may review and adjust its configuration
2e7f1d7da527c09e717251e186deffe55e6fbd0ftrawick * settings in relation to one another and report any problems. On restart,
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * this routine will be called twice, once in the startup process (which
36c8049de63c446926139936c3d195330a0539cetrawick * exits shortly after this phase) and once in the running server process.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, the
f886987cd0bd4220c14043c4d9be77ec22902e73trawick * server will still call any remaining modules with an handler for this
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawickstatic int x_check_config(apr_pool_t *pconf, apr_pool_t *plog,
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * Log the call and exit.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * This routine is called when the -t command-line option is supplied.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * It executes only once, in the startup process, after the check_config
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * phase and just before the process exits. At this point the module
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * may output any information useful in configuration testing.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * This is a VOID hook: all defined handlers get called.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawickstatic void x_test_config(apr_pool_t *pconf, server_rec *s)
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick apr_file_printf(out, "Example module configuration test routine\n");
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * This routine is called to perform any module-specific log file
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * openings. It is invoked just before the post_config phase
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, the
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * server will still call any remaining modules with an handler for this
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawickstatic int x_open_logs(apr_pool_t *pconf, apr_pool_t *plog,
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * Log the call and exit.
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * This routine is called after the server finishes the configuration
f886987cd0bd4220c14043c4d9be77ec22902e73trawick * process. At this point the module may review and adjust its configuration
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * settings in relation to one another and report any problems. On restart,
f886987cd0bd4220c14043c4d9be77ec22902e73trawick * this routine will be called only once, in the running server process.
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * The return value is OK, DECLINED, or HTTP_mumble. If we return OK, the
64c351fd973428b5bb4c28e983fa86875ea4e60fdougm * server will still call any remaining modules with an handler for this
72b6f1cf3e616473e1c26464b3193b13c2c09e87brianpstatic int x_post_config(apr_pool_t *pconf, apr_pool_t *plog,
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * Log the call and exit.
44d2e75323651320b480d8bc2f098448a08de4fcwrowe * All our process-death routine does is add its trace to the log.
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * The arbitrary text we add to our trace entry indicates for which server
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * we're being called.
3568de757bac0b47256647504c186d17ca272f85rbb note = apr_pstrcat(s->process->pool, "x_child_exit(", sname, ")", NULL);
f886987cd0bd4220c14043c4d9be77ec22902e73trawick * All our process initialiser does is add its trace to the log.
f886987cd0bd4220c14043c4d9be77ec22902e73trawick * This is a VOID hook: all defined handlers get called.
f886987cd0bd4220c14043c4d9be77ec22902e73trawickstatic void x_child_init(apr_pool_t *p, server_rec *s)
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * The arbitrary text we add to our trace entry indicates for which server
8bfe865d8d61be4ba4a89e45427a3c4211ebabdctrawick * we're being called.
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz note = apr_pstrcat(p, "x_child_init(", sname, ")", NULL);
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz apr_pool_cleanup_register(p, s, x_child_exit, x_child_exit);
98fb535f829e2a95aabd82420931f476661fa8e3jorton * The hook runner for ap_hook_http_scheme is aliased to ap_http_scheme(),
98fb535f829e2a95aabd82420931f476661fa8e3jorton * a routine that the core and other modules call when they need to know
e8f95a682820a599fe41b22977010636be5c2717jim * the URL scheme for the request. For instance, mod_ssl returns "https"
e8f95a682820a599fe41b22977010636be5c2717jim * if the server_rec associated with the request has SSL enabled.
98fb535f829e2a95aabd82420931f476661fa8e3jorton * This hook was named 'ap_hook_http_method' in httpd 2.0.
98fb535f829e2a95aabd82420931f476661fa8e3jorton * This is a RUN_FIRST hook: the first handler to return a non NULL
98fb535f829e2a95aabd82420931f476661fa8e3jorton * value aborts the handler chain. The http_core module inserts a
98fb535f829e2a95aabd82420931f476661fa8e3jorton * fallback handler (with APR_HOOK_REALLY_LAST preference) that returns
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantzstatic const char *x_http_scheme(const request_rec *r)
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * Log the call and exit.
0cb6873985efbf0cc9644114925df6baa4b32d5awrowe /* We have no claims to make about the request scheme */
0cb6873985efbf0cc9644114925df6baa4b32d5awrowe * The runner for this hook is aliased to ap_default_port(), which the
0cb6873985efbf0cc9644114925df6baa4b32d5awrowe * core and other modules call when they need to know the default port
85c5af648e9f414bd4f157490766d2fd5515a9f5rpluem * for a particular server. This is used for instance to omit the
0cb6873985efbf0cc9644114925df6baa4b32d5awrowe * port number from a Redirect response Location header URL if the port
3568de757bac0b47256647504c186d17ca272f85rbb * number is equal to the default port for the service (like 80 for http).
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * This is a RUN_FIRST hook: the first handler to return a non-zero
3568de757bac0b47256647504c186d17ca272f85rbb * value is the last one executed. The http_core module inserts a
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * fallback handler (with APR_HOOK_REALLY_LAST order specifier) that
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz * returns 80.
3568de757bac0b47256647504c186d17ca272f85rbb * Log the call and exit.
cd8f8c995d415473f3bfb0b329b2450f2a722c3atrawick * This routine is called just before the handler gets invoked. It allows
397df70abe0bdd78a84fb6c38c02641bcfeadceasf * a module to insert a previously defined filter into the filter chain.
397df70abe0bdd78a84fb6c38c02641bcfeadceasf * No filter has been defined by this module, so we just log the call
397df70abe0bdd78a84fb6c38c02641bcfeadceasf * and exit.
49aa87d735a13ae3d04012ee0df91ddb51f7c36esf * This is a VOID hook: all defined handlers get called.
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * Log the call and exit.
73e8b26287de5c06fa470d36162e103dbac9c7e5wrowe * This routine is called to insert a previously defined error filter into
0f081398cf0eef8cc7c66a535d450110a92dc8aefielding * the filter chain as the request is being processed.
0cb6873985efbf0cc9644114925df6baa4b32d5awrowe * For the purpose of this example, we don't have a filter to insert,
3568de757bac0b47256647504c186d17ca272f85rbb * so just add to the trace and exit.
7cd5419264796cfeaf8215383cf0f89130a81fectrawick * This is a VOID hook: all defined handlers get called.
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz/*--------------------------------------------------------------------------*/
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz/* Now we declare our content handlers, which are invoked when the server */
28c170ac8e99644de58cad454c6e0f9b4b359be6jerenkrantz/* encounters a document which our module is supposed to have a chance to */
0cb6873985efbf0cc9644114925df6baa4b32d5awrowe/* see. (See mod_mime's SetHandler and AddHandler directives, and the */
3568de757bac0b47256647504c186d17ca272f85rbb/* mod_info and mod_status examples, for more details.) */
3568de757bac0b47256647504c186d17ca272f85rbb/* Since content handlers are dumping data directly into the connection */
char *note;
void *conn_data;
return DECLINED;
if (r->header_only) {
return OK;
trace);
return OK;
return DECLINED;
char *note;
(void*) c, (void*) c->pool);
return OK;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
#ifdef HAVE_UNIX_SUEXEC
return NULL;
return NULL;
return DECLINED;
return DECLINED;
return DECLINED;
return DECLINED;
#ifdef HAVE_UNIX_SUEXEC
{NULL}