httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Garrett Rooney" <roo...@electricjellyfish.net>
Subject Re: Regexp-based rewriting for mod_headers?
Date Fri, 29 Sep 2006 14:45:42 GMT
On 9/29/06, Nick Kew <nick@webthing.com> wrote:
> On Thursday 28 September 2006 18:29, Garrett Rooney wrote:
> > On 9/28/06, Nick Kew <nick@webthing.com> wrote:
> > > We have a problem with DAV + SSL hardware.
> > > It appears to be the issue described in
> > > http://svn.haxx.se/users/archive-2006-03/0549.shtml
> > >
> > > It seems to me that the ability to rewrite a request header
> > > will fix that.  As a generic fix, I've patched mod_headers
> > > to support regexp-based rewriting of arbitrary headers.
> > >
> > > Please review.  If people like this (or if noone objects and I
> > > find the time), I'll document it and commit to /trunk/.
> >
> > The patch seems reasonable, but I've never messed with mod_headers, so
> > bear with me.  It should let you do something like:
> >
> > Header edit <header> <regex> <replace-string>
>
> Exactly (and support mod_headers's optional cond var).
>
> > Right?  Could you provide an example so I can confirm that it's
> > working correctly?
>
> The example that fixes the DAV problem above can be stated as
>
>   RequestHeader edit Destination ^https: http:
>
> Otherwise, one can dream up mod_rewrite like cases; e.g.
> (modulo line wrap)
>
>   Header edit Location ^http://([a-z0-9-]+)\.example\.com/
>                                                 http://example.com/$1/
>
> (not sure if that makes sense, but you get my meaning:-)

Cool.  I just tested it here, and it seems to work fine.  +1 to commit
from me, assuming suitable docs and so forth.

My only comment about the patch itself is I'm not overly thrilled
about recursively processing matches, simply because every time we
recurse we allocate an entire new string to hold the entire results,
which seems wasteful.  But on the other hand, any other solution would
probably be much more complex, and we're not talking about that many
levels of recursion in any sane configureation, so hey, whatever.

-garrett

Mime
View raw message