From 75c61fe46c15aefbc1edaae6920260eb442be90b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Malo?= Date: Mon, 14 Jul 2003 12:36:20 +0000 Subject: [PATCH] Introduce the "virtual" modifier to the Action directive, which allows the use of handlers for virtual locations. PR: 8431 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100589 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ modules/mappers/mod_actions.c | 35 +++++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 882012c03e..99879a5d14 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) mod_actions: Introduce the "virtual" modifier to the Action directive, + which allows the use of handlers for virtual locations. PR 8431. + [André Malo] + *) mod_speling: Recognize AcceptPathInfo setting for the particular location. Default is to reject path information. PR 21059. [André Malo] diff --git a/modules/mappers/mod_actions.c b/modules/mappers/mod_actions.c index 578792b700..0eef6c7822 100644 --- a/modules/mappers/mod_actions.c +++ b/modules/mappers/mod_actions.c @@ -130,11 +130,20 @@ static void *merge_action_dir_configs(apr_pool_t *p, void *basev, void *addv) } static const char *add_action(cmd_parms *cmd, void *m_v, - const char *type, const char *script) + const char *type, const char *script, + const char *option) { action_dir_config *m = (action_dir_config *)m_v; - apr_table_setn(m->action_types, type, script); + + if (option && strcasecmp(option, "virtual")) { + return apr_pstrcat(cmd->pool, + "unrecognized option '", option, "'", NULL); + } + + apr_table_setn(m->action_types, type, + apr_pstrcat(cmd->pool, option ? "1" : "0", script, NULL)); m->configured = 1; + return NULL; } @@ -164,7 +173,7 @@ static const char *set_script(cmd_parms *cmd, void *m_v, static const command_rec action_cmds[] = { - AP_INIT_TAKE2("Action", add_action, NULL, OR_FILEINFO, + AP_INIT_TAKE23("Action", add_action, NULL, OR_FILEINFO, "a media type followed by a script name"), AP_INIT_TAKE2("Script", set_script, NULL, ACCESS_CONF | RSRC_CONF, "a method followed by a script name"), @@ -208,15 +217,17 @@ static int action_handler(request_rec *r) /* 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; - if (r->finfo.filetype == 0) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, - "File does not exist: %s", r->filename); - return HTTP_NOT_FOUND; - } + ap_field_noparam(r->pool, r->content_type); + action = action ? action : ap_default_type(r); + + if ((t = apr_table_get(conf->action_types, action))) { + if (*t++ == '0' && r->finfo.filetype == 0) { + ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, + "File does not exist: %s", r->filename); + return HTTP_NOT_FOUND; + } + + script = t; } if (script == NULL) -- 2.50.1