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;
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;
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);