haproxy/include/common
Krzysztof Piotr Oledzki e6bbd74690 [MEDIUM] Handle long lines properly
Currently, there is a hidden line length limit in the haproxy, set
to 256-1 chars. With large acls (for example many hdr(host) matches)
it may be not enough and which is even worse, error message may
be totally confusing as everything above this limit is treated
as a next line:

echo -ne "frontend aqq 1.2.3.4:80\nmode http\nacl e hdr(host) -i X X X X X X X www.xx.example.com stats\n"|
 sed s/X/www.some-host-name.example.com/g > ha.cfg && haproxy -c -f ./ha.cfg

[WARNING] 300/163906 (11342) : parsing [./ha.cfg:4] : 'stats' ignored because frontend 'aqq' has no backend capability.

Recently I hit simmilar problem and it took me a while to find why
requests for "stats" are not handled properly.

This patch:
 - makes the limit configurable (LINESIZE)
 - increases default line length limit from 256 to 2048
 - increases MAX_LINE_ARGS from 40 to 64
 - fixes hidden assignment in fgets()
 - moves arg/end/args/line inside the loop, making code auditing easier
 - adds a check that shows error if the limit is reached
 - changes "*line++ = 0;" to "*line++ = '\0';" (cosmetics)

With this patch, when LINESIZE is defined to 256, above example produces:
[ALERT] 300/164724 (27364) : parsing [/tmp/ha.cfg:3]: line too long, limit: 255.
[ALERT] 300/164724 (27364) : Error reading configuration file : /tmp/ha.cfg
2007-11-01 23:00:51 +01:00
..
appsession.h [MAJOR] remove files distributed under an obscure license 2007-09-09 21:56:53 +02:00
base64.h
cfgparse.h [CLEANUP] add a few "const char *" where appropriate 2006-10-15 15:17:57 +02:00
compat.h [MINOR] add support for variable size arrays in structures 2007-05-08 14:08:05 +02:00
config.h [MEDIUM] implement memory pools version 2 2007-05-13 18:26:08 +02:00
debug.h [BUILD] debug.h had a typo. Also add FSM_PRINTF to debug FSM only. 2006-12-16 23:22:58 +01:00
defaults.h [MEDIUM] Handle long lines properly 2007-11-01 23:00:51 +01:00
epoll.h [BUILD] declare epoll_* as static when using our own functions 2007-04-15 23:57:41 +02:00
errors.h [MINOR] move error codes to common/errors.h 2007-10-28 11:14:07 +01:00
memory.h [MAJOR] call garbage collector when doing soft stop 2007-05-14 00:39:29 +02:00
mini-clist.h [CLEANUP] silent warning about LIST_* being redefined on OpenBSD 2007-10-28 11:41:06 +01:00
rbtree.h [MINOR] imported the rbtree function from Linux kernel 2007-01-07 02:12:57 +01:00
regex.h [MAJOR] merged the 'setbe' actions to switch the backend on a regex 2006-12-17 23:15:24 +01:00
sessionhash.h [MAJOR] remove files distributed under an obscure license 2007-09-09 21:56:53 +02:00
standard.h [MINOR] provide easy-to-use limit_r and LIM2A* macros 2007-10-25 16:59:40 +02:00
template.h
time.h [MEDIUM] stats: report server and backend cumulated downtime 2007-10-22 21:36:23 +02:00
tools.h [MINOR] forgot to include common/tools.h in the archive. 2006-12-22 14:40:41 +01:00
uri_auth.h [MINOR] report haproxy's version by default on the stats page 2007-10-15 10:05:11 +02:00
version.h [BUILD] centralize version and date into one file for each 2007-09-09 23:31:11 +02:00