]> granicus.if.org Git - apache/commitdiff
Because mod_imap's handler runs on every request in the default
authorBrian Pane <brianp@apache.org>
Mon, 29 Apr 2002 01:03:17 +0000 (01:03 +0000)
committerBrian Pane <brianp@apache.org>
Mon, 29 Apr 2002 01:03:17 +0000 (01:03 +0000)
configuration, rearrange the code to keep it from allocating a few
pages worth of local variables on the stack on requests that don't
use imagemaps

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

modules/mappers/mod_imap.c

index 7bde235867b19b5cd94f4d088a319f14fcb330bf..6013cb94e75e976c7417ff43d3439792760be8a9 100644 (file)
@@ -607,7 +607,7 @@ static void menu_footer(request_rec *r)
     ap_rputs("\n\n</body>\n</html>\n", r);         /* finish the menu */
 }
 
-static int imap_handler(request_rec *r)
+static int imap_handler_internal(request_rec *r)
 {
     char input[MAX_STRING_LEN];
     char *directive;
@@ -635,10 +635,6 @@ static int imap_handler(request_rec *r)
 
     ap_configfile_t *imap; 
 
-    if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE)
-                                     && strcmp(r->handler, "imap-file")))
-       return DECLINED;
-
     icr = ap_get_module_config(r->per_dir_config, &imap_module);
 
     imap_menu = icr->imap_menu ? icr->imap_menu : IMAP_MENU_DEFAULT;
@@ -908,6 +904,21 @@ menu_bail:
     return HTTP_INTERNAL_SERVER_ERROR;
 }
 
+static int imap_handler(request_rec *r)
+{
+    /* Optimizatoin: skip the allocation of large local variables on the
+     * stack (in imap_handler_internal()) on requests that aren't using
+     * imagemaps
+     */
+    if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE)
+                                     && strcmp(r->handler, "imap-file"))) {
+       return DECLINED;
+    }
+    else {
+        return imap_handler_internal(r);
+    }
+}
+
 static void register_hooks(apr_pool_t *p)
 {
     ap_hook_handler(imap_handler,NULL,NULL,APR_HOOK_MIDDLE);