From 0e4717d45f98e39c0ece121e5f0b5d1f0cecf0a8 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Thu, 23 Jan 2014 14:33:09 +0000 Subject: [PATCH] Merge r1557641, r1559394, r1559398 from trunk: don't search for directory indexes/directoryslashes if a URL is in the middle of being rewritten [in per-dir context]. PR53929 followups to r1557641 suggested by nd -- add prefix to both the macro and the handler name itself. no make depend in sandbox, fix bld break from r1559394 Submitted by: covener Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1560697 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 9 --------- include/ap_mmn.h | 3 ++- modules/mappers/mod_dir.c | 6 ++++++ modules/mappers/mod_rewrite.c | 4 ++-- modules/mappers/mod_rewrite.h | 2 ++ 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/STATUS b/STATUS index 6045fdc20e..138027f89f 100644 --- a/STATUS +++ b/STATUS @@ -98,15 +98,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * mod_dir: stop trying to index or redirect requests that are halfway - through being rewritten by per-dir mod_rewrite. Old releases would skip any - unknown r->handler. PR53929 - trunk patch: http://svn.apache.org/r1557641 - http://svn.apache.org/r1559394 - http://svn.apache.org/r1559398 - 2.4.x patch: http://people.apache.org/~covener/patches/2.4.x-moddir_skip_rewritten.diff - (skips change of handler name) - +1: covener, minfrin, jim * mod_session: Fix problems interpreting the SessionInclude and SessionExclude configuration. diff --git a/include/ap_mmn.h b/include/ap_mmn.h index c95274246e..c164932329 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -424,6 +424,7 @@ * 20120211.27 (2.4.7-dev) Add ap_podx_restart_t and ap_mpm_podx_* * 20120211.28 (2.4.7-dev) Add ap_regname * 20120211.29 (2.4.7-dev) Add uds_path to proxy_conn_rec + * 20120211.30 (2.4.7-dev) REWRITE_REDIRECT_HANDLER_NAME in mod_rewrite.h */ #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */ @@ -431,7 +432,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 20120211 #endif -#define MODULE_MAGIC_NUMBER_MINOR 29 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 30 /* 0...n */ /** * Determine if the server's current MODULE_MAGIC_NUMBER is at least a diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c index 9707ad50be..2316c53220 100644 --- a/modules/mappers/mod_dir.c +++ b/modules/mappers/mod_dir.c @@ -29,6 +29,7 @@ #include "http_log.h" #include "http_main.h" #include "util_script.h" +#include "mod_rewrite.h" module AP_MODULE_DECLARE_DATA dir_module; @@ -260,6 +261,11 @@ static int fixup_dir(request_rec *r) return HTTP_MOVED_PERMANENTLY; } + /* we're running between mod_rewrites fixup and its internal redirect handler, step aside */ + if (!strcmp(r->handler, REWRITE_REDIRECT_HANDLER_NAME)) { + return DECLINED; + } + if (d->index_names) { names_ptr = (char **)d->index_names->elts; num_names = d->index_names->nelts; diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 0ac4dc9d6a..52b9e1e0f5 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -5004,7 +5004,7 @@ static int hook_fixup(request_rec *r) rewritelog((r, 1, dconf->directory, "internal redirect with %s " "[INTERNAL REDIRECT]", r->filename)); r->filename = apr_pstrcat(r->pool, "redirect:", r->filename, NULL); - r->handler = "redirect-handler"; + r->handler = REWRITE_REDIRECT_HANDLER_NAME; return OK; } } @@ -5050,7 +5050,7 @@ static int hook_mimetype(request_rec *r) */ static int handler_redirect(request_rec *r) { - if (strcmp(r->handler, "redirect-handler")) { + if (strcmp(r->handler, REWRITE_REDIRECT_HANDLER_NAME)) { return DECLINED; } diff --git a/modules/mappers/mod_rewrite.h b/modules/mappers/mod_rewrite.h index 040baeeac1..8fa158ecca 100644 --- a/modules/mappers/mod_rewrite.h +++ b/modules/mappers/mod_rewrite.h @@ -29,6 +29,8 @@ #include "apr_optional.h" #include "httpd.h" +#define REWRITE_REDIRECT_HANDLER_NAME "redirect-handler" + /* rewrite map function prototype */ typedef char *(rewrite_mapfunc_t)(request_rec *r, char *key); -- 2.40.0