/[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 67 - (hide annotations) (download)
Wed Feb 15 05:40:02 2006 UTC (8 years, 10 months ago) by vericgar
Original Path: trunk/dist/2.2/patches/06_all_mod_rewrite_ampescape.patch
File size: 1946 byte(s)
Create work area for apache-2.2
1 vericgar 2 diff -ru httpd-2.0.52/modules/mappers/mod_rewrite.c httpd-2.0.52.ampescape/modules/mappers/mod_rewrite.c
2     --- httpd-2.0.52/modules/mappers/mod_rewrite.c 2004-08-27 21:23:26.000000000 +0200
3     +++ httpd-2.0.52.ampescape/modules/mappers/mod_rewrite.c 2004-11-19 19:04:17.190398544 +0100
4     @@ -964,6 +964,7 @@
5     map_pfn_register("tolower", rewrite_mapfunc_tolower);
6     map_pfn_register("toupper", rewrite_mapfunc_toupper);
7     map_pfn_register("escape", rewrite_mapfunc_escape);
8     + map_pfn_register("ampescape", rewrite_mapfunc_ampescape);
9     map_pfn_register("unescape", rewrite_mapfunc_unescape);
10     }
11     return OK;
12     @@ -3346,6 +3347,29 @@
13     return value;
14     }
15    
16     +static char *rewrite_mapfunc_ampescape(request_rec *r, char *key) {
17     + /* we only need to escape the ampersand */
18     +
19     + unsigned char *copy = (char *)apr_palloc(r->pool, 3 * strlen(key) + 3);
20     + const unsigned char *s = (const unsigned char *)key;
21     + unsigned char *d = (unsigned char *)copy;
22     + unsigned c;
23     +
24     + while ((c = *s)) {
25     + if (c == '&') {
26     + *d++ = '%';
27     + *d++ = '2';
28     + *d++ = '6';
29     + } else {
30     + *d++ = c;
31     + }
32     + ++s;
33     + }
34     + *d = '\0';
35     +
36     + return copy;
37     +}
38     +
39     static char *rewrite_mapfunc_unescape(request_rec *r, char *key)
40     {
41     char *value;
42     diff -ru httpd-2.0.52/modules/mappers/mod_rewrite.h httpd-2.0.52.ampescape/modules/mappers/mod_rewrite.h
43     --- httpd-2.0.52/modules/mappers/mod_rewrite.h 2004-08-20 23:17:41.000000000 +0200
44     +++ httpd-2.0.52.ampescape/modules/mappers/mod_rewrite.h 2004-11-19 18:29:50.000000000 +0100
45     @@ -389,6 +389,7 @@
46     static char *rewrite_mapfunc_toupper(request_rec *r, char *key);
47     static char *rewrite_mapfunc_tolower(request_rec *r, char *key);
48     static char *rewrite_mapfunc_escape(request_rec *r, char *key);
49     +static char *rewrite_mapfunc_ampescape(request_rec *r, char *key);
50     static char *rewrite_mapfunc_unescape(request_rec *r, char *key);
51    
52     static char *select_random_value_part(request_rec *r, char *value);

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.20