[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#204508: apache: mod_rewrite can't rewrite to filenames containing a '?'



Package: apache
Version: 1.3.27-0.1
Severity: wishlist
Tags: patch


Mod_rewrite can't rewrite URIs to filenames containing a questionmark,
as they are generated by "wget -E" when mirroring dynamic content to
static files, for example. I patched mod_rewrite to make it accept a
further rule flag: "nosplit". When this flag is set, mod_rewrite will
not split out the query string from the filename.


--- mod_rewrite.h-original	Thu Aug  7 21:38:42 2003
+++ mod_rewrite.h	Thu Aug  7 21:43:12 2003
@@ -218,6 +218,7 @@
 #define RULEFLAG_QSAPPEND           1<<11
 #define RULEFLAG_NOCASE             1<<12
 #define RULEFLAG_NOESCAPE           1<<13
+#define RULEFLAG_NOSPLIT            1<<14
 
 #define ACTION_NORMAL               1<<0
 #define ACTION_NOESCAPE             1<<1
--- mod_rewrite.c-original	Thu Aug  7 21:38:53 2003
+++ mod_rewrite.c	Thu Aug  7 21:41:34 2003
@@ -936,6 +936,10 @@
              || strcasecmp(key, "NC") == 0    ) {
         cfg->flags |= RULEFLAG_NOCASE;
     }
+    else if (   strcasecmp(key, "nosplit") == 0
+             || strcasecmp(key, "NSA") == 0    ) {
+        cfg->flags |= RULEFLAG_NOSPLIT;
+    }
     else {
         return ap_pstrcat(p, "RewriteRule: unknown flag '", key, "'\n", NULL);
     }
@@ -1980,7 +1984,9 @@
      *  an on-the-fly generated QUERY_STRING part into r->args
      */
     r->filename = ap_pstrdup(r->pool, newuri);
-    splitout_queryargs(r, p->flags & RULEFLAG_QSAPPEND);
+    if (!(p->flags & RULEFLAG_NOSPLIT)) {
+        splitout_queryargs(r, p->flags & RULEFLAG_QSAPPEND);
+    }
 
     /*
      *   Again add the previously stripped per-directory location



-- System Information
Debian Release: 3.0
Architecture: i386
Kernel: Linux aquila 2.4.20 #1 Son Jan 26 16:37:44 CET 2003 i686
Locale: LANG=de_CH, LC_CTYPE=de_CH.UTF-8

Versions of packages apache depends on:
ii  apache-common                1.3.27-0.1  Support files for all Apache webse
ii  dpkg                         1.10.9      Package maintenance system for Deb
ii  libc6                        2.2.5-11.5  GNU C Library: Shared libraries an
ii  libdb2                       2:2.7.7.0-7 The Berkeley database routines (ru
ii  libexpat1                    1.95.5-1    XML parsing C library - runtime li
ii  logrotate                    3.6.5-2     Log rotation utility
ii  mime-support                 3.18-1.3    MIME files 'mime.types' & 'mailcap
ii  perl                         5.6.1-8.2   Larry Wall's Practical Extraction 
ii  perl [perl5]                 5.6.1-8.2   Larry Wall's Practical Extraction 




Reply to: