Hi Holger,

On Sat, May 06, 2017 at 02:08:29AM +0200, Holger Just wrote:
> This patch against current master adds a new b64dec converter. It takes
> a base64 encoded string and returns its decoded binary representation.
> 
> This converter can be used to e.g. extract the username of a basic auth
> header to add it to the log:
> 
> acl BASIC_AUTH hdr_beg(Authorization) "Basic "
> http-request capture hdr(Authorization),regsub(^Basic\ ,),b64dec if
> BASIC_AUTH

It's so obvious it doesn't even need a justification indeed! I even
thought we already had it!

> I'm open for suggestions for a better name for the converter.
> base64_decode might work but doesn't suit the code formatting well and
> is pretty long...

I didn't find a better one either.

> As a note to reviewers: please be aware that I'm not a C programmer at
> all and I am way outside of my comfort zone here. As such, this function
> might have unhandled edge-cases. I tried to model it according to the
> existing base64 converter and my understanding of how the converters are
> supposed to work but might have missed something.

Thanks for the warning, much appreciated. It made me re-read it after
applying it. But your code is fine, no problem detected! So you're
becoming a C programmer ;-)

> Once verified, I think this converter can be safely added to the
> supported stable versions of HAProxy.

Yes I think it can make sense to backport it at least to 1.7, it can
help sometimes.

Thanks!
Willy

Reply via email to