You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by br...@apache.org on 2001/11/24 11:13:29 UTC
cvs commit: httpd-2.0/modules/mappers mod_actions.c
brianp 01/11/24 02:13:29
Modified: modules/mappers mod_actions.c
Log:
optimization: short-circuit out of the mod_actions handler if there are no actions defined in the config
Revision Changes Path
1.25 +14 -2 httpd-2.0/modules/mappers/mod_actions.c
Index: mod_actions.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_actions.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- mod_actions.c 2001/08/11 04:04:13 1.24
+++ mod_actions.c 2001/11/24 10:13:29 1.25
@@ -92,6 +92,9 @@
typedef struct {
apr_table_t *action_types; /* Added with Action... */
const char *scripted[METHODS]; /* Added with Script... */
+ int configured; /* True if Action or Script has been
+ * called at least once
+ */
} action_dir_config;
module actions_module;
@@ -121,6 +124,8 @@
new->scripted[i] = add->scripted[i] ? add->scripted[i]
: base->scripted[i];
}
+
+ new->configured = (base->configured || add->configured);
return new;
}
@@ -129,6 +134,7 @@
{
action_dir_config *m = (action_dir_config *)m_v;
apr_table_setn(m->action_types, type, script);
+ m->configured = 1;
return NULL;
}
@@ -146,6 +152,7 @@
else
m->scripted[methnum] = script;
+ m->configured = 1;
return NULL;
}
@@ -162,11 +169,14 @@
{
action_dir_config *conf = (action_dir_config *)
ap_get_module_config(r->per_dir_config, &actions_module);
- const char *t, *action = r->handler ? r->handler :
- ap_field_noparam(r->pool, r->content_type);
+ const char *t, *action;
const char *script;
int i;
+ if (!conf->configured) {
+ return DECLINED;
+ }
+
/* Note that this handler handles _all_ types, so handler is unchecked */
/* Set allowed stuff */
@@ -191,6 +201,8 @@
return DECLINED;
/* Second, check for actions (which override the method scripts) */
+ action = r->handler ? r->handler :
+ ap_field_noparam(r->pool, r->content_type);
if ((t = apr_table_get(conf->action_types,
action ? action : ap_default_type(r)))) {
script = t;