/[apache]/trunk/dist/2.2/patches/02_all_mod_rewrite_ampescape.patch
Gentoo

Contents of /trunk/dist/2.2/patches/02_all_mod_rewrite_ampescape.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 69 - (show annotations) (download)
Wed Feb 15 05:53:40 2006 UTC (8 years, 5 months ago) by vericgar
File size: 1319 byte(s)
Changes for apache-2.2, see source and bug 114232 for details
1 Provide escaping for the ampersand in mod_rewrite
2 diff -ur httpd-2.2.0/modules/mappers/mod_rewrite.c httpd-2.2.0.patched/modules/mappers/mod_rewrite.c
3 --- httpd-2.2.0/modules/mappers/mod_rewrite.c 2005-11-10 07:20:05.000000000 -0800
4 +++ httpd-2.2.0.patched/modules/mappers/mod_rewrite.c 2006-02-04 13:52:34.000000000 -0800
5 @@ -1075,6 +1075,30 @@
6 return ap_escape_uri(r->pool, key);
7 }
8
9 +static char *rewrite_mapfunc_ampescape(request_rec *r, char *key) {
10 + /* we only need to escape the ampersand */
11 +
12 + unsigned char *copy = (char *)apr_palloc(r->pool, 3 * strlen(key) + 3);
13 + const unsigned char *s = (const unsigned char *)key;
14 + unsigned char *d = (unsigned char *)copy;
15 + unsigned c;
16 +
17 + while ((c = *s)) {
18 + if (c == '&') {
19 + *d++ = '%';
20 + *d++ = '2';
21 + *d++ = '6';
22 + } else {
23 + *d++ = c;
24 + }
25 + ++s;
26 + }
27 + *d = '\0';
28 +
29 + return copy;
30 +}
31 +
32 +
33 static char *rewrite_mapfunc_unescape(request_rec *r, char *key)
34 {
35 ap_unescape_url(key);
36 @@ -4011,6 +4035,7 @@
37 map_pfn_register("tolower", rewrite_mapfunc_tolower);
38 map_pfn_register("toupper", rewrite_mapfunc_toupper);
39 map_pfn_register("escape", rewrite_mapfunc_escape);
40 + map_pfn_register("ampescape", rewrite_mapfunc_ampescape);
41 map_pfn_register("unescape", rewrite_mapfunc_unescape);
42 }
43 return OK;

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20