]> granicus.if.org Git - apache/commitdiff
Performance: Add quick_handler hook. This hook is called at the
authorBill Stoddard <stoddard@apache.org>
Tue, 27 Mar 2001 19:19:08 +0000 (19:19 +0000)
committerBill Stoddard <stoddard@apache.org>
Tue, 27 Mar 2001 19:19:08 +0000 (19:19 +0000)
very beginning of the request processing before location_walk,
translate_name, etc.  This hook is useful for URI keyed content
caches like Mike Abbott's Quick Shortcut Cache.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88596 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
include/http_config.h
modules/http/http_request.c
server/config.c

diff --git a/CHANGES b/CHANGES
index 9fd4fbd65033b81513c5ba66b27cf03883b67276..548a94b70a756122a45a2e0c8d55c0fafca1309a 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,9 @@
 Changes with Apache 2.0.16-dev
+  *) Performance: Add quick_handler hook. This hook is called at the
+     very beginning of the request processing before location_walk,
+     translate_name, etc.  This hook is useful for URI keyed content
+     caches like Mike Abbott's Quick Shortcut Cache.
+     [Bill Stoddard]
 
   *) top_module global variable renamed to ap_top_module [Perl]
 
index a54c25040d2c9f524e7345482253bef16d4344cd..391ea4ce6216d6a18c240f9bbe8f9981b8e0a088 100644 (file)
@@ -1002,6 +1002,16 @@ AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s))
  */
 AP_DECLARE_HOOK(int,handler,(request_rec *r))
 
+/**
+ * Run the quick handler functions for each module. The quick_handler
+ * is run before any other requests hooks are called (location_walk,
+ * directory_walk, access checking, et. al.). This hook was added
+ * to provide a quick way to serve content out of a URI keyed cache.
+ * @param r The request_rec
+ * @deffunc void ap_run_quick_handler(request_rec *r)
+ */
+AP_DECLARE_HOOK(int,quick_handler,(request_rec *r))
+
 /**
  * Retrieve the optional functions for each module.
  * This is run immediately before the server starts. Optional functions should
index 26ddec7901b66710556e6fb4b4b0f36399a3f1b2..17b0de9d0ab3aeb2a6c3d11b10a9e0737c094660 100644 (file)
@@ -391,7 +391,36 @@ static void check_pipeline_flush(request_rec *r)
 
 void ap_process_request(request_rec *r)
 {
-    process_request_internal(r);
+    int access_status;
+
+    /* Give quick handlers a shot at serving the request on the fast
+     * path, bypassing all of the other Apache hooks. 
+     *
+     * This hook was added to enable serving files out of a URI keyed 
+     * content cache ( e.g., Mike Abbott's Quick Shortcut Cache, 
+     * described here: http://oss.sgi.com/projects/apache/mod_qsc.html )
+     *
+     * It may have other uses as well, such as routing requests directly to
+     * content handlers that have the ability to grok HTTP and do their
+     * own access checking, etc (e.g. servlet engines). 
+     * 
+     * Use this hook with extreme care and only if you know what you are 
+     * doing.
+     * 
+     * Consider moving this hook to after the first location_walk in order
+     * to enable the quick handler to make decisions based on config
+     * directives in Location blocks.
+     */
+    access_status = ap_run_quick_handler(r);
+    if (access_status == OK) {
+        ap_finalize_request_protocol(r);
+    }
+    else if (access_status == DECLINED) {
+        process_request_internal(r);
+    }
+    else {
+        ap_die(access_status, r);
+    }
 
     /*
      * We want to flush the last packet if this isn't a pipelining connection
index aa91902690de8b6ac67b66ba43e917dc829b8a71..a03234a4d6046c57e07e8c782c686fbe7b83307c 100644 (file)
@@ -111,6 +111,7 @@ APR_HOOK_STRUCT(
               APR_HOOK_LINK(open_logs)
               APR_HOOK_LINK(child_init)
               APR_HOOK_LINK(handler)
+               APR_HOOK_LINK(quick_handler)
               APR_HOOK_LINK(optional_fn_retrieve)
 )
 
@@ -130,6 +131,8 @@ AP_IMPLEMENT_HOOK_VOID(child_init,
 
 AP_IMPLEMENT_HOOK_RUN_FIRST(int,handler,(request_rec *r),
                            (r),DECLINED)
+AP_IMPLEMENT_HOOK_RUN_FIRST(int,quick_handler,(request_rec *r),
+                           (r),DECLINED)
 
 AP_IMPLEMENT_HOOK_VOID(optional_fn_retrieve,(void),())