Hi Darren,

On Fri, Feb 23, 2018 at 05:29:47PM +0000, Darren Demicoli wrote:
> Hi all
> Recently I needed to substitute http headers in requests such as the 
> following:
> From
> Referer: https://a-b-c.example.com/x-caliber
> To
> Referer: https://a.b.c.example.com/x-caliber
> Basically any hyphen in the subdomain part of example.com needed to be
> replaced by dots, but any other hyphens should not be replaced. I tried doing
> it with regsub() but the limitation on the accepted characters (no
> parenthesis or square brackets) limits the possible regular expressions that
> can be used. Also "http-request replace-header" is limited because it does
> not handle multiple matches - if there is more than one match there is no way
> of back-referencing to all matches (so varying number of matches cannot be
> handled). What I needed was a cross between replace-header and regsub. So I
> am suggesting the substitute-header and substitute value actions for http
> requests and responses.

Well, given that it's very similar to the replace-header with different
semantics and should be able to be addressed properly using regsub(), I'd
rather work on finding a way to express all characters in regsub(). This
problem remains present with every other use cases and we must not start
to multiply the http actions just to workaround some parser limitations.

I'd like to see the config parser rewritten to be recursive instead of
left-right, but a lot of parts will have to be modified at the same time
and it will not be done quickly. But maybe we can find an acceptable
short-term workaround consisting in finding how to escape certain such
characters (basically, the comma, the quotes, parenthesis, braces and
brackets). I don't have much to propose for now but I'd rather see the
efforts focused on doing this you see.


Reply via email to