httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Gale <s7g2...@yahoo.co.uk>
Subject Re: Improving The RewriteMap Program Feature
Date Tue, 04 Mar 2014 08:58:16 GMT
Hi Tim

What are the chances of getting this into the next release of Apache?

Kev

> On 2 Mar 2014, at 17:03, Tim Bannister <isoma@jellybaby.net> wrote:
> 
>> On 2 Mar 2014, at 16:46, Tim Bannister <isoma@jellybaby.net> wrote:
>> 
>> On 1 Mar 2014, at 12:20, Eric Covener <covener@gmail.com> wrote:
>> 
>>>> If the RewriteMap Program fails, the code within mod_rewrite returns an
>>>> empty string rather than NULL. In my tests this caused /index.htm to be
>>>> returned as the URL which is not very useful. I think it makes more sense
to
>>>> handle this situation as a NULL so that the default key is used as we could
>>>> then provide a backup method.
>>>> eg:
>>>>   RewriteRule ^/proxy/(.*) ${proxymap:$1|/proxybackup/$1} [P]
>>>>   RewriteRule ^/proxybackup/(.*) /proxybackup.php?url=$1 [L]
>>>> 
>>>> Looking at the mod_rewrite source code this appears to be a one liner change
>>>> in lookup_map_program:
>>>>   if (i == 4 && !strcasecmp(buf, "NULL"))
>>>>   .....
>>>> becomes:
>>>>   if ((i == 0) || (i == 4 && !strcasecmp(buf, "NULL"))) {
>>>>   .....
>>>> 
>>>> Is this minor change something that you would consider implementing?
>>> 
>>> I think it would need to be opt-in in 2.4, as changing it could break
>>> configs depending on the current behavior.    Maybe some extra flag on
>>> the definition of the RewriteMap or a RewriteOption?
>> 
>> Here's how I'd want it:
>> 
>> RewriteMap foo prgfb:/www/bin/example.pl
>> 
>> (prgfb — program with fallback).
> 
> In other words, a user could choose “prg” or “prgfb”. prg selects the legacy,
httpd-2.0 behaviour. prgfb selects a new behaviour which handles map program failure as NULL.
> 
> Eventually (2.6?), httpd could merge “prg” and “prgfb” into a single map type.
> 
> 
> -- 
> Tim Bannister – isoma@jellybaby.net
> 

Mime
View raw message