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

(-)httpd-2.0.52/modules/mappers/mod_rewrite.c (+24 lines)
Lines 964-969 Link Here
964
        map_pfn_register("tolower", rewrite_mapfunc_tolower);
964
        map_pfn_register("tolower", rewrite_mapfunc_tolower);
965
        map_pfn_register("toupper", rewrite_mapfunc_toupper);
965
        map_pfn_register("toupper", rewrite_mapfunc_toupper);
966
        map_pfn_register("escape", rewrite_mapfunc_escape);
966
        map_pfn_register("escape", rewrite_mapfunc_escape);
967
		map_pfn_register("ampescape", rewrite_mapfunc_ampescape);
967
        map_pfn_register("unescape", rewrite_mapfunc_unescape);
968
        map_pfn_register("unescape", rewrite_mapfunc_unescape);
968
    }
969
    }
969
    return OK;
970
    return OK;
Lines 3346-3351 Link Here
3346
    return value;
3347
    return value;
3347
}
3348
}
3348
3349
3350
static char *rewrite_mapfunc_ampescape(request_rec *r, char *key) {
3351
	/* we only need to escape the ampersand */
3352
3353
	unsigned char *copy = (char *)apr_palloc(r->pool, 3 * strlen(key) + 3);
3354
	const unsigned char *s = (const unsigned char *)key;
3355
	unsigned char *d = (unsigned char *)copy;
3356
	unsigned c;
3357
3358
	while ((c = *s)) {
3359
		if (c == '&') {
3360
			*d++ = '%';
3361
			*d++ = '2';
3362
			*d++ = '6';
3363
		} else {
3364
			*d++ = c;
3365
		}
3366
		++s;
3367
	}
3368
	*d = '\0';
3369
3370
	return copy;
3371
}
3372
3349
static char *rewrite_mapfunc_unescape(request_rec *r, char *key)
3373
static char *rewrite_mapfunc_unescape(request_rec *r, char *key)
3350
{
3374
{
3351
    char *value;
3375
    char *value;
(-)httpd-2.0.52/modules/mappers/mod_rewrite.h (+1 lines)
Lines 389-394 Link Here
389
static char *rewrite_mapfunc_toupper(request_rec *r, char *key);
389
static char *rewrite_mapfunc_toupper(request_rec *r, char *key);
390
static char *rewrite_mapfunc_tolower(request_rec *r, char *key);
390
static char *rewrite_mapfunc_tolower(request_rec *r, char *key);
391
static char *rewrite_mapfunc_escape(request_rec *r, char *key);
391
static char *rewrite_mapfunc_escape(request_rec *r, char *key);
392
static char *rewrite_mapfunc_ampescape(request_rec *r, char *key);
392
static char *rewrite_mapfunc_unescape(request_rec *r, char *key);
393
static char *rewrite_mapfunc_unescape(request_rec *r, char *key);
393
394
394
static char *select_random_value_part(request_rec *r, char *value);
395
static char *select_random_value_part(request_rec *r, char *value);

Return to bug 32328