[Pkg-apache-commits] r937 - in /branches/lenny-apache2: changelog patches/00list patches/069_fix_mod_rewrite_B_PR45529.dpatch

sf at alioth.debian.org sf at alioth.debian.org
Sat May 30 12:06:38 UTC 2009


Author: sf
Date: Sat May 30 12:06:37 2009
New Revision: 937

URL: http://svn.debian.org/wsvn/pkg-apache/?sc=1&rev=937
Log:
fix mod_rewrite B flag

Added:
    branches/lenny-apache2/patches/069_fix_mod_rewrite_B_PR45529.dpatch
Modified:
    branches/lenny-apache2/changelog
    branches/lenny-apache2/patches/00list

Modified: branches/lenny-apache2/changelog
URL: http://svn.debian.org/wsvn/pkg-apache/branches/lenny-apache2/changelog?rev=937&op=diff
==============================================================================
--- branches/lenny-apache2/changelog (original)
+++ branches/lenny-apache2/changelog Sat May 30 12:06:37 2009
@@ -5,6 +5,7 @@
   * mod_deflate: Fix invalid etag to be emitted for on-the-fly gzip
     content-encoding. This prevented apache from sending "304 NOT MODIFIED"
     responses for compressed content.
+  * mod_rewrite: Fix "B" flag breakage (closes: #524268)
   * Properly declare that apache2-suexec* replace files in old versions of
     apache2.2-common (closes: #528951).
 

Modified: branches/lenny-apache2/patches/00list
URL: http://svn.debian.org/wsvn/pkg-apache/branches/lenny-apache2/patches/00list?rev=937&op=diff
==============================================================================
--- branches/lenny-apache2/patches/00list (original)
+++ branches/lenny-apache2/patches/00list Sat May 30 12:06:37 2009
@@ -27,6 +27,7 @@
 066_mpm_worker_segfault_PR45605.dpatch
 067_check_pollset_create_error.dpatch
 068_fix_deflate_etag_PR45023.dpatch
+069_fix_mod_rewrite_B_PR45529.dpatch
 099_config_guess_sub_update
 200_cp_suexec.dpatch
 201_build_suexec-custom.dpatch

Added: branches/lenny-apache2/patches/069_fix_mod_rewrite_B_PR45529.dpatch
URL: http://svn.debian.org/wsvn/pkg-apache/branches/lenny-apache2/patches/069_fix_mod_rewrite_B_PR45529.dpatch?rev=937&op=file
==============================================================================
--- branches/lenny-apache2/patches/069_fix_mod_rewrite_B_PR45529.dpatch (added)
+++ branches/lenny-apache2/patches/069_fix_mod_rewrite_B_PR45529.dpatch Sat May 30 12:06:37 2009
@@ -1,0 +1,85 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+--- a/modules/mappers/mod_rewrite.c	(Revision 732577)
++++ b/modules/mappers/mod_rewrite.c	(Revision 732578)
+@@ -380,6 +380,7 @@
+ /* Optional functions imported from mod_ssl when loaded: */
+ static APR_OPTIONAL_FN_TYPE(ssl_var_lookup) *rewrite_ssl_lookup = NULL;
+ static APR_OPTIONAL_FN_TYPE(ssl_is_https) *rewrite_is_https = NULL;
++static char *escape_uri(apr_pool_t *p, const char *path);
+ 
+ /*
+  * +-------------------------------------------------------+
+@@ -628,7 +629,47 @@
+     return 0;
+ }
+ 
++static const char c2x_table[] = "0123456789abcdef";
++
++static APR_INLINE unsigned char *c2x(unsigned what, unsigned char prefix,
++                                     unsigned char *where)
++{
++#if APR_CHARSET_EBCDIC
++    what = apr_xlate_conv_byte(ap_hdrs_to_ascii, (unsigned char)what);
++#endif /*APR_CHARSET_EBCDIC*/
++    *where++ = prefix;
++    *where++ = c2x_table[what >> 4];
++    *where++ = c2x_table[what & 0xf];
++    return where;
++}
++
+ /*
++ * Escapes a uri in a similar way as php's urlencode does.
++ * Based on ap_os_escape_path in server/util.c
++ */
++static char *escape_uri(apr_pool_t *p, const char *path) {
++    char *copy = apr_palloc(p, 3 * strlen(path) + 3);
++    const unsigned char *s = (const unsigned char *)path;
++    unsigned char *d = (unsigned char *)copy;
++    unsigned c;
++
++    while ((c = *s)) {
++        if (apr_isalnum(c) || c == '_') {
++            *d++ = c;
++        }
++        else if (c == ' ') {
++            *d++ = '+';
++        }
++        else {
++            d = c2x(c, '%', d);
++        }
++        ++s;
++    }
++    *d = '\0';
++    return copy;
++}
++
++/*
+  * escape absolute uri, which may or may not be path oriented.
+  * So let's handle them differently.
+  */
+@@ -2240,15 +2281,16 @@
+                 if (entry && (entry->flags & RULEFLAG_ESCAPEBACKREF)) {
+                     /* escape the backreference */
+                     char *tmp2, *tmp;
+-                    tmp = apr_pstrndup(pool, bri->source + bri->regmatch[n].rm_so, span);
+-                    tmp2 = ap_escape_path_segment(pool, tmp);
++                    tmp = apr_palloc(pool, span + 1);
++                    strncpy(tmp, bri->source + bri->regmatch[n].rm_so, span);
++                    tmp[span] = '\0';
++                    tmp2 = escape_uri(pool, tmp);
+                     rewritelog((ctx->r, 5, ctx->perdir, "escaping backreference '%s' to '%s'",
+                             tmp, tmp2));
+ 
+                     current->len = span = strlen(tmp2);
+                     current->string = tmp2;
+-                }
+-                else {
++                } else {
+                     current->len = span;
+                     current->string = bri->source + bri->regmatch[n].rm_so;
+                 }




More information about the Pkg-apache-commits mailing list