This seems to do the trick. *result (see below) has
plenty of room to grow, so the substitution '&' -> '%26'
can be done in place. Addition of a pool argument
is required of the callers, but that should cause no
trouble.
char* escape_url(pool *p, char *val)
{
char *result = ap_os_escape_path(p, val?val:"", 1);
char *end = result + strlen(result);
char *seek;
/* additional escape for '&' */
for ( seek = end-1; seek >= result; --seek) {
char *ptr;
if (*seek != '&')
continue;
for (ptr = end; ptr > seek; --ptr) {
ptr[2] = ptr[0];
}
strncpy(seek, "%26", 3);
end += 2;
}
return(result);
}
Will add patch to cvs if there's no objections.
--
Joe Schaefer