Index: modules/mappers/mod_alias.c
===================================================================
--- modules/mappers/mod_alias.c	(revision 1686748)
+++ modules/mappers/mod_alias.c	(working copy)
@@ -34,7 +34,6 @@
 #include "http_config.h"
 #include "http_request.h"
 #include "http_log.h"
-#include "ap_expr.h"
 
 
 typedef struct {
@@ -51,20 +50,11 @@
 } alias_server_conf;
 
 typedef struct {
-    unsigned int alias_set:1;
-    unsigned int redirect_set:1;
     apr_array_header_t *redirects;
-    const ap_expr_info_t *alias;
-    char *handler;
-    const ap_expr_info_t *redirect;
-    int redirect_status;                /* 301, 302, 303, 410, etc */
 } alias_dir_conf;
 
 module AP_MODULE_DECLARE_DATA alias_module;
 
-static char magic_error_value;
-#define PREGSUB_ERROR      (&magic_error_value)
-
 static void *create_alias_config(apr_pool_t *p, server_rec *s)
 {
     alias_server_conf *a =
@@ -101,17 +91,7 @@
     (alias_dir_conf *) apr_pcalloc(p, sizeof(alias_dir_conf));
     alias_dir_conf *base = (alias_dir_conf *) basev;
     alias_dir_conf *overrides = (alias_dir_conf *) overridesv;
-
     a->redirects = apr_array_append(p, overrides->redirects, base->redirects);
-
-    a->alias = (overrides->alias_set == 0) ? base->alias : overrides->alias;
-    a->handler = (overrides->alias_set == 0) ? base->handler : overrides->handler;
-    a->alias_set = overrides->alias_set || base->alias_set;
-
-    a->redirect = (overrides->redirect_set == 0) ? base->redirect : overrides->redirect;
-    a->redirect_status = (overrides->redirect_set == 0) ? base->redirect_status : overrides->redirect_status;
-    a->redirect_set = overrides->redirect_set || base->redirect_set;
-
     return a;
 }
 
@@ -131,12 +111,6 @@
 
     /* XXX: real can NOT be relative to DocumentRoot here... compat bug. */
 
-    const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_LOC_FILE);
-
-    if (err != NULL) {
-        return err;
-    }
-
     if (use_regex) {
         new->regexp = ap_pregcomp(cmd->pool, fake, AP_REG_EXTENDED);
         if (new->regexp == NULL)
@@ -181,41 +155,9 @@
 }
 
 static const char *add_alias(cmd_parms *cmd, void *dummy, const char *fake,
-        const char *real)
+                             const char *real)
 {
-    if (real) {
-
-        return add_alias_internal(cmd, dummy, fake, real, 0);
-
-    }
-    else {
-        alias_dir_conf *dirconf = (alias_dir_conf *) dummy;
-
-        const char *err = ap_check_cmd_context(cmd, NOT_IN_DIRECTORY|NOT_IN_FILES);
-
-        if (err != NULL) {
-            return err;
-        }
-
-        if (!cmd->path) {
-            return "Alias must have two arguments when used globally";
-        }
-
-        dirconf->alias =
-                ap_expr_parse_cmd(cmd, fake, AP_EXPR_FLAG_STRING_RESULT,
-                        &err, NULL);
-        if (err) {
-            return apr_pstrcat(cmd->temp_pool,
-                    "Cannot parse alias expression '", fake, "': ", err,
-                    NULL);
-        }
-
-        dirconf->handler = cmd->info;
-        dirconf->alias_set = 1;
-
-        return NULL;
-
-    }
+    return add_alias_internal(cmd, dummy, fake, real, 0);
 }
 
 static const char *add_alias_regex(cmd_parms *cmd, void *dummy,
@@ -263,59 +205,6 @@
         return "Redirect: invalid first argument (of three)";
 
     /*
-     * if we have the 2nd arg and we understand the 1st one, or if we have the
-     * 1st arg but don't understand it, we use the expression syntax assuming
-     * a path from the location.
-     *
-     * if we understand the first arg but have no second arg, we are dealing
-     * with a status like "GONE".
-     */
-    if (grokarg1 && arg2 && !arg3 && HTTP_GONE != status) {
-        const char *expr_err = NULL;
-
-        dirconf->redirect =
-                ap_expr_parse_cmd(cmd, arg2, AP_EXPR_FLAG_STRING_RESULT,
-                        &expr_err, NULL);
-        if (expr_err) {
-            return apr_pstrcat(cmd->temp_pool,
-                    "Cannot parse redirect expression '", arg2, "': ", expr_err,
-                    NULL);
-        }
-
-        dirconf->redirect_status = status;
-        dirconf->redirect_set = 1;
-
-        return NULL;
-
-    }
-    else if (grokarg1 && !arg2 && HTTP_GONE == status) {
-
-        dirconf->redirect_status = status;
-        dirconf->redirect_set = 1;
-
-        return NULL;
-
-    }
-    else if (!grokarg1 && !arg2) {
-        const char *expr_err = NULL;
-
-        dirconf->redirect =
-                ap_expr_parse_cmd(cmd, arg1, AP_EXPR_FLAG_STRING_RESULT,
-                        &expr_err, NULL);
-        if (expr_err) {
-            return apr_pstrcat(cmd->temp_pool,
-                    "Cannot parse redirect expression '", arg1, "': ", expr_err,
-                    NULL);
-        }
-
-        dirconf->redirect_status = status;
-        dirconf->redirect_set = 1;
-
-        return NULL;
-
-    }
-
-    /*
      * if we don't have the 3rd arg and we didn't understand the 1st
      * one, then assume URL-path URL. This also handles case, eg, GONE
      * we even though we don't have a 3rd arg, we did understand the 1st
@@ -380,11 +269,11 @@
 
 static const command_rec alias_cmds[] =
 {
-    AP_INIT_TAKE12("Alias", add_alias, NULL, RSRC_CONF | ACCESS_CONF,
-                  "a fakename and a realname, or a realname in a Location"),
-    AP_INIT_TAKE12("ScriptAlias", add_alias, "cgi-script", RSRC_CONF | ACCESS_CONF,
-                  "a fakename and a realname, or a realname in a Location"),
-    AP_INIT_TAKE123("Redirect", add_redirect, (void *) HTTP_MOVED_TEMPORARILY,
+    AP_INIT_TAKE2("Alias", add_alias, NULL, RSRC_CONF,
+                  "a fakename and a realname"),
+    AP_INIT_TAKE2("ScriptAlias", add_alias, "cgi-script", RSRC_CONF,
+                  "a fakename and a realname"),
+    AP_INIT_TAKE23("Redirect", add_redirect, (void *) HTTP_MOVED_TEMPORARILY,
                    OR_FILEINFO,
                    "an optional status, then document to be redirected and "
                    "destination URL"),
@@ -444,80 +333,9 @@
     return urip - uri;
 }
 
-static char *try_alias(request_rec *r)
-{
-    alias_dir_conf *dirconf =
-            (alias_dir_conf *) ap_get_module_config(r->per_dir_config, &alias_module);
+static char magic_error_value;
+#define PREGSUB_ERROR      (&magic_error_value)
 
-    if (dirconf->alias) {
-        const char *err = NULL;
-
-        char *found = apr_pstrdup(r->pool,
-                ap_expr_str_exec(r, dirconf->alias, &err));
-        if (err) {
-            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02825)
-                          "Can't evaluate alias expression: %s", err);
-            return PREGSUB_ERROR;
-        }
-
-        if (dirconf->handler) { /* Set handler, and leave a note for mod_cgi */
-            r->handler = dirconf->handler;
-            apr_table_setn(r->notes, "alias-forced-type", r->handler);
-        }
-        /* XXX This is as SLOW as can be, next step, we optimize
-         * and merge to whatever part of the found path was already
-         * canonicalized.  After I finish eliminating os canonical.
-         * Better fail test for ap_server_root_relative needed here.
-         */
-        found = ap_server_root_relative(r->pool, found);
-        return found;
-
-    }
-
-    return NULL;
-}
-
-static char *try_redirect(request_rec *r, int *status)
-{
-    alias_dir_conf *dirconf =
-            (alias_dir_conf *) ap_get_module_config(r->per_dir_config, &alias_module);
-
-    if (dirconf->redirect_set) {
-        apr_uri_t uri;
-        const char *err = NULL;
-        char *found = "";
-
-        if (dirconf->redirect) {
-
-            found = apr_pstrdup(r->pool,
-                    ap_expr_str_exec(r, dirconf->redirect, &err));
-            if (err) {
-                ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(02826)
-                              "Can't evaluate redirect expression: %s", err);
-                return PREGSUB_ERROR;
-            }
-
-            apr_uri_parse(r->pool, found, &uri);
-            /* Do not escape the query string or fragment. */
-            found = apr_uri_unparse(r->pool, &uri, APR_URI_UNP_OMITQUERY);
-            found = ap_escape_uri(r->pool, found);
-            if (uri.query) {
-                found = apr_pstrcat(r->pool, found, "?", uri.query, NULL);
-            }
-            if (uri.fragment) {
-                found = apr_pstrcat(r->pool, found, "#", uri.fragment, NULL);
-            }
-
-        }
-
-        *status = dirconf->redirect_status;
-        return found;
-
-    }
-
-    return NULL;
-}
-
 static char *try_alias_list(request_rec *r, apr_array_header_t *aliases,
                             int is_redir, int *status)
 {
@@ -617,9 +435,7 @@
         return DECLINED;
     }
 
-    if ((ret = try_redirect(r, &status)) != NULL
-            || (ret = try_alias_list(r, serverconf->redirects, 1, &status))
-                    != NULL) {
+    if ((ret = try_alias_list(r, serverconf->redirects, 1, &status)) != NULL) {
         if (ret == PREGSUB_ERROR)
             return HTTP_INTERNAL_SERVER_ERROR;
         if (ap_is_HTTP_REDIRECT(status)) {
@@ -652,9 +468,7 @@
         return status;
     }
 
-    if ((ret = try_alias(r)) != NULL
-            || (ret = try_alias_list(r, serverconf->aliases, 0, &status))
-                    != NULL) {
+    if ((ret = try_alias_list(r, serverconf->aliases, 0, &status)) != NULL) {
         r->filename = ret;
         return OK;
     }
@@ -672,9 +486,7 @@
 
     /* It may have changed since last time, so try again */
 
-    if ((ret = try_redirect(r, &status)) != NULL
-            || (ret = try_alias_list(r, dirconf->redirects, 1, &status))
-                    != NULL) {
+    if ((ret = try_alias_list(r, dirconf->redirects, 1, &status)) != NULL) {
         if (ret == PREGSUB_ERROR)
             return HTTP_INTERNAL_SERVER_ERROR;
         if (ap_is_HTTP_REDIRECT(status)) {
