Greg Stein wrote:
That's not much of an example. All it really shows is how to register a
hook. A better example would be to *use* the hook in some way.

whoops. I guess I did leave out the explanatory comments. outside of that, it pretty much follows the example in almost all the other hooks by doing nothing, so it probably doesn't make sense to add real functionality there unless you want real functionality everywhere.


assuming mod_example is just meant to show all the hooks and how to hook into them, new patch with comments attached.

--Geoff
Index: modules/experimental/mod_example.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/experimental/mod_example.c,v
retrieving revision 1.41.2.1
diff -u -r1.41.2.1 mod_example.c
--- modules/experimental/mod_example.c  3 Feb 2003 17:31:37 -0000       1.41.2.1
+++ modules/experimental/mod_example.c  3 Oct 2003 14:45:45 -0000
@@ -1096,6 +1096,28 @@
 }
 
 /*
+ * This routine maps r->filename to a physical file on disk.  Useful for
+ * overriding default core behavior, including skipping mapping for
+ * requests that are not file based.
+ *
+ * The return value is OK, DECLINED, or HTTP_mumble.  If we return OK, no
+ * further modules are called for this phase.
+ */
+static int x_map_to_storage_handler(request_rec *r)
+{
+
+    x_cfg *cfg;
+
+    cfg = our_dconfig(r);
+    /*
+     * We don't actually *do* anything here, except note the fact that we were
+     * called.
+     */
+    trace_add(r->server, r, cfg, "x_map_to_storage_handler()");
+    return DECLINED;
+}
+
+/*
  * this routine gives our module another chance to examine the request
  * headers and to take special action. This is the first phase whose
  * hooks' configuration directives can appear inside the <Directory>
@@ -1298,6 +1320,7 @@
     ap_hook_default_port(x_default_port, NULL, NULL, APR_HOOK_MIDDLE);
 #endif
     ap_hook_translate_name(x_translate_handler, NULL, NULL, APR_HOOK_MIDDLE);
+    ap_hook_map_to_storage(x_map_to_storage_handler, NULL,NULL, APR_HOOK_MIDDLE);
     ap_hook_header_parser(x_header_parser_handler, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_check_user_id(x_check_user_id, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_fixups(x_fixer_upper, NULL, NULL, APR_HOOK_MIDDLE);

Reply via email to