Hi Tim

Ah - ok. I misunderstood what you were proposing.

That sounds like a good solution to me as it doesn't break compatibility.


Kev

> On 2 Mar 2014, at 17:03, Tim Bannister <[email protected]> wrote:
> 
>> On 2 Mar 2014, at 16:46, Tim Bannister <[email protected]> wrote:
>> 
>> On 1 Mar 2014, at 12:20, Eric Covener <[email protected]> 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 – [email protected]
> 

Reply via email to