]> granicus.if.org Git - apache/commitdiff
Introduce the "virtual" modifier to the Action directive,
authorAndré Malo <nd@apache.org>
Mon, 14 Jul 2003 12:36:20 +0000 (12:36 +0000)
committerAndré Malo <nd@apache.org>
Mon, 14 Jul 2003 12:36:20 +0000 (12:36 +0000)
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
modules/mappers/mod_actions.c

diff --git a/CHANGES b/CHANGES
index 882012c03eea6a41ddb72a318e3e1283a94b6aef..99879a5d1447b248ff411b7b77038df1a5e2b67c 100644 (file)
--- 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]
index 578792b70072abc54b029b8f3fe66baa63b785a8..0eef6c782235ebddd30a9d98c14965295ce73998 100644 (file)
@@ -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)