On Wed, 16 Apr 2014 20:14:00 +0200 Cyril Bonté <[email protected]> wrote:
> Hi again Thierry, > > Le 16/04/2014 16:34, Thierry FOURNIER a écrit : > >> Shouldn't we need to provide a matching method (for example "-m str") ? > >> In this case, the "language" documentation also needs to be updated. > > > > > > Fixed. > > Great ! > haproxy becomes fun and enlarges Y0ur creativity (dedicated to the > "spam" thread ;-) ). > > Look at this : > use_backend > bk_%[req.fhdr(accept-language),language(de;es;fr;en),map(language.map,en)] > if TRUE > > Where language.map contains : > fr fr > en en > us en > de de > > Unfortunately, currently we can't benefit from the default value > declared in the map. > This is because sample_conv_q_prefered returns 0 when no matching > language was found. In this case, map() is not called. > > Is it possible to always return 1 ? Hi Cyril, The 0 returned is the expected behavior. If no value matches the converter, than the expression fails. In other way you can use the default value in the "language" converter itself. I think that if you write the following expression, you have the expected behavior: use_backend bk_%[req.fhdr(accept-language),\ language(de;es;fr;en,en),map(language.map)] if TRUE Thierry > > -- > Cyril Bonté

