]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: init: don't use environment locale
authorMaxime de Roucy <maxime.deroucy@gmail.com>
Wed, 18 May 2016 21:13:38 +0000 (23:13 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 19 May 2016 05:19:19 +0000 (07:19 +0200)
commite3841395ad043fbb356225ac09714eb178286db6
tree96f3b7a3aa7ce8abfa9f81205b3da0c6c50320c4
parentf34b28aa6e325c7fe6d87db0836452afd727fa5f
BUG/MEDIUM: init: don't use environment locale

This patch removes setlocale from the main function. It was introduced
by commit 379d9c7 ("MEDIUM: init: allow directory as argument of -f")
in 1.7-dev a few commits ago after a discussion on the mailing list.

Some regex may have different behaviours depending on the
locale. Some LUA scripts may change their behaviour too
(http://lua-users.org/wiki/LuaLocales).

Without this patch (haproxy is using setlocale) :

$ cat locale.cfg
defaults
  mode http

frontend test
  bind :9000
  mode http
  use_backend testbk if { hdr_reg(X-Test) ^\w+$ }

backend testbk
  mode http
  server s 127.0.0.1:80

$ LANG=fr_FR.UTF-8 ./haproxy -f locale.cfg
$ curl -i -H "X-Test: échec" localhost:9000
HTTP/1.1 200 OK
...

$ LANG=C ./haproxy -f locale.cfg
$ curl -i -H "X-Test: échec" localhost:9000
HTTP/1.0 503 Service Unavailable
...
doc/haproxy.1
doc/management.txt
src/haproxy.c