View | Details | Raw Unified | Return to bug 32328
Collapse All | Expand All

(-)modules/mappers/mod_rewrite.c (+25 lines)
Lines 1059-1064 Link Here
1059
    return ap_escape_uri(r->pool, key);
1059
    return ap_escape_uri(r->pool, key);
1060
}
1060
}
1061
1061
1062
static char *rewrite_mapfunc_ampescape(request_rec *r, char *key)
1063
{
1064
    /* we only need to escape the ampersand */
1065
    unsigned char *copy = (char *)apr_palloc(r->pool, 3 * strlen(key) + 3);
1066
    const unsigned char *s = (const unsigned char *)key;
1067
    unsigned char *d = (unsigned char *)copy;
1068
    unsigned c;
1069
1070
    while ((c = *s)) {
1071
        if (c == '&') {
1072
            *d++ = '%';
1073
            *d++ = '2';
1074
            *d++ = '6';
1075
        }
1076
        else {
1077
            *d++ = c;
1078
        }
1079
        ++s;
1080
    }
1081
    *d = '\0';
1082
1083
    return copy;
1084
}
1085
1062
static char *rewrite_mapfunc_unescape(request_rec *r, char *key)
1086
static char *rewrite_mapfunc_unescape(request_rec *r, char *key)
1063
{
1087
{
1064
    ap_unescape_url(key);
1088
    ap_unescape_url(key);
Lines 3994-3999 Link Here
3994
        map_pfn_register("tolower", rewrite_mapfunc_tolower);
4018
        map_pfn_register("tolower", rewrite_mapfunc_tolower);
3995
        map_pfn_register("toupper", rewrite_mapfunc_toupper);
4019
        map_pfn_register("toupper", rewrite_mapfunc_toupper);
3996
        map_pfn_register("escape", rewrite_mapfunc_escape);
4020
        map_pfn_register("escape", rewrite_mapfunc_escape);
4021
        map_pfn_register("ampescape", rewrite_mapfunc_ampescape);
3997
        map_pfn_register("unescape", rewrite_mapfunc_unescape);
4022
        map_pfn_register("unescape", rewrite_mapfunc_unescape);
3998
    }
4023
    }
3999
    return OK;
4024
    return OK;

Return to bug 32328