arrfab / rpms / httpd

Forked from rpms/httpd 5 years ago
Clone

Blame SOURCES/httpd-2.4.6-rewrite-dir.patch

0943f8
Index: modules/mappers/mod_rewrite.h
0943f8
===================================================================
0943f8
--- a/modules/mappers/mod_rewrite.h	(revision 1560696)
0943f8
+++ b/modules/mappers/mod_rewrite.h	(revision 1560697)
0943f8
@@ -29,6 +29,8 @@
0943f8
 #include "apr_optional.h"
0943f8
 #include "httpd.h"
0943f8
 
0943f8
+#define REWRITE_REDIRECT_HANDLER_NAME "redirect-handler"
0943f8
+
0943f8
 /* rewrite map function prototype */
0943f8
 typedef char *(rewrite_mapfunc_t)(request_rec *r, char *key);
0943f8
 
0943f8
Index: modules/mappers/mod_dir.c
0943f8
===================================================================
0943f8
--- a/modules/mappers/mod_dir.c	(revision 1560696)
0943f8
+++ b/modules/mappers/mod_dir.c	(revision 1560697)
0943f8
@@ -29,6 +29,7 @@
0943f8
 #include "http_log.h"
0943f8
 #include "http_main.h"
0943f8
 #include "util_script.h"
0943f8
+#include "mod_rewrite.h"
0943f8
 
0943f8
 module AP_MODULE_DECLARE_DATA dir_module;
0943f8
 
0943f8
@@ -260,6 +261,11 @@
0943f8
         return HTTP_MOVED_PERMANENTLY;
0943f8
     }
0943f8
 
0943f8
+    /* we're running between mod_rewrites fixup and its internal redirect handler, step aside */
0943f8
+    if (!strcmp(r->handler, REWRITE_REDIRECT_HANDLER_NAME)) { 
0943f8
+        return DECLINED;
0943f8
+    }
0943f8
+
0943f8
     if (d->index_names) {
0943f8
         names_ptr = (char **)d->index_names->elts;
0943f8
         num_names = d->index_names->nelts;
0943f8
Index: modules/mappers/mod_rewrite.c
0943f8
===================================================================
0943f8
--- a/modules/mappers/mod_rewrite.c	(revision 1560696)
0943f8
+++ b/modules/mappers/mod_rewrite.c	(revision 1560697)
0943f8
@@ -5004,7 +5004,7 @@
0943f8
             rewritelog((r, 1, dconf->directory, "internal redirect with %s "
0943f8
                         "[INTERNAL REDIRECT]", r->filename));
0943f8
             r->filename = apr_pstrcat(r->pool, "redirect:", r->filename, NULL);
0943f8
-            r->handler = "redirect-handler";
0943f8
+            r->handler = REWRITE_REDIRECT_HANDLER_NAME;
0943f8
             return OK;
0943f8
         }
0943f8
     }
0943f8
@@ -5050,7 +5050,7 @@
0943f8
  */
0943f8
 static int handler_redirect(request_rec *r)
0943f8
 {
0943f8
-    if (strcmp(r->handler, "redirect-handler")) {
0943f8
+    if (strcmp(r->handler, REWRITE_REDIRECT_HANDLER_NAME)) {
0943f8
         return DECLINED;
0943f8
     }
0943f8