691 Commits

Author SHA1 Message Date
Willy Tarreau
cb07d0f052 [RELEASE] Released version 1.3.14.4
Released version 1.3.14.4 with the following main changes :
    - [BUILD] Replace hardcoded 'LD = gcc' with 'LD = $(CC)'
    - [BUILD] Added support for 'make install'
    - [BUILD] Added 'install-man' make target for installing the man page
    - [BUILD] Added 'install-bin' make target
    - [BUILD] Added 'install-doc' make target
    - [BUILD] Removed "/" after '$(DESTDIR)' in install targets
    - [BUILD] Changed 'install' target to install the binaries first
    - [MEDIUM] fix stats socket limitation to 16 kB
v1.3.14.4
2008-03-20 09:43:52 +01:00
Christian Wiese
d143bb3ae0 [BUILD] Changed 'install' target to install the binaries first 2008-03-17 22:51:27 +01:00
Christian Wiese
514b3f8af1 [BUILD] Removed "/" after '$(DESTDIR)' in install targets
SBINDIR, MANDIR and DOCDIR use an absolute path
2008-03-17 22:51:27 +01:00
Christian Wiese
33fb4aaca3 [BUILD] Added 'install-doc' make target
This change is also introducing a new make variable called DOCDIR,
which is set to "$(PREFIX)/doc/haproxy" by default.
2008-03-17 22:51:27 +01:00
Christian Wiese
b95da1372d [BUILD] Added 'install-bin' make target 2008-03-17 22:51:27 +01:00
Christian Wiese
7c5a0e657e [BUILD] Added 'install-man' make target for installing the man page
This change is also introducing a new variable in the Makefile called
MANDIR, which is set to "$PREFIX/share/man" by default.
2008-03-17 22:51:26 +01:00
Christian Wiese
12fdf4dc7b [BUILD] Added support for 'make install'
To be flexible while installing haproxy following variables have been
added to the Makefile:
- DESTDIR useful i.e. while installing in a sandbox (not set by default)
- PREFIX  defines the default install prefix (default: /usr/local)
- SBINDIR defines the dir the haproxy binary gets installed
  (default: $PREFIX/sbin)
2008-03-17 22:51:26 +01:00
Christian Wiese
df2df3e0ff [BUILD] Replace hardcoded 'LD = gcc' with 'LD = $(CC)'
haproxy relies on linking the binary using gcc, so there is no real need to
hardcode both (CC and LD). Setting 'LD = $(CC)' will make the build system
a bit more cross-compile friendly because only the right cross-compiler has
to be passed via make.
2008-03-17 22:49:52 +01:00
Willy Tarreau
28d65acf7a [MEDIUM] fix stats socket limitation to 16 kB
Due to the way the stats socket work, it was not possible to
maintain the information related to the command entered, so
after filling a whole buffer, the request was lost and it was
considered that there was nothing to write anymore.

The major reason was that some flags were passed directly
during the first call to stats_dump_raw() instead of being
stored persistently in the session.

To definitely fix this problem, flags were added to the stats
member of the session structure.

A second problem appeared. When the stats were produced, a first
call to client_retnclose() was performed, then one or multiple
subsequent calls to buffer_write_chunks() were done. But once the
stats buffer was full and a reschedule operated, the buffer was
flushed, the write flag cleared from the buffer and nothing was
done to re-arm it.

For this reason, a check was added in the proto_uxst_stats()
function in order to re-call the client FSM when data were added
by stats_dump_raw(). Finally, the whole unix stats dump FSM was
rewritten to avoid all the magics it depended on. It is now
simpler and looks more like the HTTP one.
2008-03-17 21:43:47 +01:00
Willy Tarreau
682c3c1be3 [RELEASE] Released version 1.3.14.3
Released version 1.3.14.3 with the following main changes :
    - [BUG]: Restore clearing t->logs.bytes
    - [DOC] Update a "contrib" file with a hint about a scheme used for formathing subjects
    - [BUG] Don't increment server connections too much + fix retries
    - [BUG] appsession lookup in URL does not work
    - [MINOR] report correct section type for unknown keywords.
    - [BUILD] update MacOS Makefile to build on newer versions
    - [DOC] fix erroneous "useallbackups" option in the doc
    - [DOC] applied small fixes from early readers
    - [BUG] failed conns were sometimes incremented in the frontend!
    - [TESTS] add test-pollers.cfg to easily report pollers in use
    - [BUILD] ensure that makefile understands USE_DLMALLOC=1
    - [CLEANUP] update .gitignore to ignore more temporary files
    - [CLEANUP] report dlmalloc's source path only if explictly specified
    - [BUG] str2sun could leak a small buffer in case of error during parsing
    - [BUG] option allbackups was not working anymore in roundrobin mode
v1.3.14.3
2008-03-08 22:07:42 +01:00
Willy Tarreau
7f4ff3f61d [BUG] option allbackups was not working anymore in roundrobin mode
Commit 3168223a7b33a1d5aad1e11b8f2ad917645d7f27 broke option
"allbackups" in roundrobin mode due to an erroneous structure
member replacement in backend.c. The PR_O_USE_ALL_BK flag was
not tested in the right member anymore.

This bug uncoverred another one, by which all backup servers would
be used whatever the option's value, if all of them had been seen
as simultaneously failed at one moment.

This patch fixes the two stupid errors. Correctness has been tested
using the test-fwrr.cfg config example.
(cherry picked from commit f4cca45b5e6c6ed88a0062cf92ae57e01405ab12)
2008-03-08 21:59:15 +01:00
Willy Tarreau
4415cb391d [BUG] str2sun could leak a small buffer in case of error during parsing
Matt Farnsworth reported a memory leak in str2sun() in case a too large
socket path is passed. The bug is very minor because it only happens
once during config parsing, but has to be fixed nevertheless. The patch
Matt provided could even be improved by completely removing the useless
strdup() in this function.
(cherry picked from commit caf720d3ff7758273278aecab26bb7624ec2f555)
2008-03-08 21:59:10 +01:00
Willy Tarreau
92bce7baeb [CLEANUP] report dlmalloc's source path only if explictly specified
There's no point in reporting dlmalloc's source path if it was the
default one.
(cherry picked from commit f32d19a3957be4f3b275a72105fb53b39219999e)
2008-03-08 21:59:03 +01:00
Willy Tarreau
c454c8f4df [CLEANUP] update .gitignore to ignore more temporary files
(cherry picked from commit 83ded5082efdd421dd809b7d5b182911d1d49bb8)
2008-03-08 21:58:51 +01:00
Krzysztof Piotr Oledzki
655d29a0df [BUG] Don't increment server connections too much + fix retries
Commit 98937b875798e10fac671d109355cde29d2a411a while fixing
one bug introduced another one. With "retries 4" and
"option redispatch" haproxy tries to connect 4 times to
one server server and 1 time to a second one. However
logs showed 5 connections to the first server (the
last one was counted twice) and 2 to the second.

This patch also fixes srv->retries and be->retries increments.

Now I get: 3 retries and 1 error in a first server (4 cum_sess)
and 1 error in a second server (1 cum_sess) with:
 retries 4
 option redispatch

and: 4 retries and 1 error (5 cum_sess) with:
 retries 4

So, the number of connections effectively served by a server is:
 srv->cum_sess - srv->failed_conns - srv->retries

(cherry picked from commit 626a19b66f769a87e7c995267ccedf14149e03b3)
2008-03-08 21:58:03 +01:00
Willy Tarreau
ae5589d1cf [BUILD] ensure that makefile understands USE_DLMALLOC=1
USE_DLMALLOC=1 was ignored since last makefile update. It's better
to keep it running for existing setups.
(cherry picked from commit f14358bd1ad4f7c9fd32c3900ac3a2848bed1b9a)
2008-03-08 21:52:16 +01:00
Ryan Warnick
aa9d40e293 [BUG] appsession lookup in URL does not work
We've been trying to use the latest release (1.3.14.2) of haproxy  to do
sticky sessions.  Cookie insertion is not an option for us, although we
would much rather use it, as we are trying to work around a problem where
cookies are unreliable.  The appsession functionality only partially worked
(it wouldn't read the session id out of a query string) until we made the
following code change to the get_srv_from_appsession function in
proto_http.c.
(cherry picked from commit 6d0b1fac23517f16b3972b529ea41718b3643c9f)
2008-03-08 21:51:46 +01:00
Willy Tarreau
6f93cd9ba8 [TESTS] add test-pollers.cfg to easily report pollers in use
(cherry picked from commit 8b2f55aec473879586005a8a4a107f3ba5f9c2a9)
2008-03-08 21:51:40 +01:00
Willy Tarreau
1b1b7a967d [BUG] failed conns were sometimes incremented in the frontend!
(cherry picked from commit 50fd1e1e3bf7cdd383a906c511a2e77e9ac5205d)
2008-03-08 21:51:23 +01:00
Willy Tarreau
8d2b9f24eb [DOC] applied small fixes from early readers
(cherry picked from commit d2a4aa2c098dce23900b5cafa7df393209755cfc)
2008-03-08 21:48:06 +01:00
Willy Tarreau
ab884621f8 [DOC] fix erroneous "useallbackups" option in the doc
(cherry picked from commit af85d944ea8233c83b0bc66cb0ed2f2eddec8ced)
2008-03-08 21:47:58 +01:00
Willy Tarreau
9cfb4a7b3e [BUILD] update MacOS Makefile to build on newer versions
This update from Dan Zinngrabe enables building on MacOS 10.4 and 10.5.
(cherry picked from commit 7ad15da522fc3579ba88e8496baacd5dd2409389)
2008-03-08 21:47:48 +01:00
Krzysztof Piotr Oledzki
e620478b4b [DOC] Update a "contrib" file with a hint about a scheme used for formathing subjects
With each new patch I had to search for the e-mail from Willy
describing the schem used for formathing subjects. No more. ;)
(cherry picked from commit 4ad3b40a2d7c78bcdbf16a853647833cad78b050)
2008-03-08 21:47:25 +01:00
Willy Tarreau
8c1e6c98f3 [MINOR] report correct section type for unknown keywords.
An unknown keyword was always reported in section "listen" for any
section type (defaults, listen, frontend, backend, ...).
(cherry picked from commit 6daf34352f325699efa8f731e5525275523786b9)
2008-03-08 21:47:10 +01:00
Krzysztof Piotr Oledzki
89cacf7007 [BUG]: Restore clearing t->logs.bytes
Commit 8b3977ffe36190e45fb974bf813bfbd935ac99a1 removed "t->logs.bytes_in = 0;"
but instead it should change it into "t->logs.bytes_out = 0;" as since
583bc966064e248771e75c253dddec7351afd8a2 counters are incremented not set.

It should be incremented in session_process_counters while sending data to a
client:
        bytes = s->rep->total - s->logs.bytes_out;
        s->logs.bytes_out = s->rep->total;

However, if we increment (set) s->logs.bytes_out while processing
"logasap", statistics get wrong values added for headers: 0 or even
negative if haproxy adds some headers itself.

To test it, please enable logasap and download one empty file and look at
stats. Without my fix information available on that page are invalid, for
example:

# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,
www,b,0,0,0,1,,1,24,-92,,0,,0,0,0,,UP,1,1,0,0,0,3121,0,,1,2,1,,1,
www,BACKEND,0,0,0,1,0,1,24,-92,0,0,,0,0,0,0,UP,1,1,0,,0,3121,0,,1,2,0,,1,
2008-01-22 10:26:27 +01:00
Willy Tarreau
532bf552e1 [RELEASE] Released version 1.3.14.2
Released version 1.3.14.2 with the following main changes :
    - bug: increment server connections for each connect()
    - bug: fix typo in redispatched connection
    - bug: connect_server: server might not exist when sending error report
    - bug: use backend's source and not server's source with tproxy
    - bug: fix overlapping server flags
    - bug: log response byte count, not request
    - bug: fix truncated responses with sepoll
    - large update to the configuration manual
    - major rework of the GNU Makefile
    - provide inversion for some options
    - add support for "show info" on the unix socket
    - add support for the "backlog" parameter
    - introduce global parameter "tune.maxaccept"
    - introduce "timeout http-request" in frontends
    - tarpit timeout is also allowed in backends
    - code did not build in full debug mode
    - fix configuration hint about timeouts
v1.3.14.2
2008-01-21 00:06:34 +01:00
Willy Tarreau
160d7ca123 [MINOR] fix configuration hint about timeouts
Do not talk about "clitimeout", "contimeout" or "srvtimeout"
anymore.
2008-01-20 23:56:51 +01:00
Willy Tarreau
4489d003d1 [BUG] fix truncated responses with sepoll
Due to the way Linux delivers EPOLLIN and EPOLLHUP, a closed connection
received after some server data sometimes results in truncated responses
if the client disconnects before server starts to respond. The reason
is that the EPOLLHUP flag is processed as an indication of end of
transfer while some data may remain in the system's socket buffers.

This problem could only be triggered with sepoll, although nothing should
prevent it from happening with normal epoll. In fact, the work factoring
performed by sepoll increases the risk that this bug appears.

The fix consists in making FD_POLL_HUP and FD_POLL_ERR sticky and that
they are only checked if FD_POLL_IN is not set, meaning that we have
read all pending data.

That way, the problem is definitely fixed and sepoll still remains about
17% faster than epoll since it can take into account all information
returned by the kernel.
2008-01-20 23:56:15 +01:00
Willy Tarreau
f5e62d371f [BUILD] code did not build in full debug mode 2008-01-20 23:56:06 +01:00
Willy Tarreau
77288d1dc2 [BUG] log response byte count, not request
Due to a shameless copy-paste typo, the number of bytes logged was
from the request and not the response. This bug has been present
for a long time.
2008-01-20 23:55:54 +01:00
Willy Tarreau
8f2dfdfb43 [DOC] added documentation about HTTP header manipulations
This section has been inserted before the logging section.
2008-01-20 23:55:35 +01:00
Willy Tarreau
a5951dce43 [DOC] document all req* and rsp* keywords. 2008-01-20 23:55:32 +01:00
Willy Tarreau
e3cab85c32 [DOC] all server parameters have been documented 2008-01-20 23:55:27 +01:00
Willy Tarreau
c7b4b8cfa0 [DOC] added "server", "source" and "stats" keywords
The documentation now lists all keywords except the req* and rsp*. The
"server" keyword has been documented for mandatory parameters. Specific
settings are still waiting to be written in a dedicated section.
2008-01-20 23:54:55 +01:00
Willy Tarreau
fb626180f7 [BUG] fix overlapping server flags
Server flags SRV_GOINGDOWN, SRV_WARMINGUP were overlapping
SRV_TPROXY_*.
2008-01-20 23:54:02 +01:00
Willy Tarreau
a6b2f3f2ac [BUG] use backend's source and not server's source with tproxy
Checks were using server's source even when only backend's was
defined using tproxy.
2008-01-20 23:53:08 +01:00
Willy Tarreau
75db60e3ff [BUG] connect_server: server might not exist when sending error report
In connect_server(), we may send an alert with the server name while
the server might not exist, eg in dispatch mode.
2008-01-20 23:48:22 +01:00
Willy Tarreau
842ebd8d2d [DOC] added documentation for "option tcplog" to "use_backend"
- options tcplog, tcpsplice and transparent have been documented.
- keywords "srvtimeout", "timeout queue", "timeout server" and
  "timeout tarpit" have been documented
- keywords "transparent" and "use_backend" have been documented

Only "server", "source" and "stats *" remain undocumented
2008-01-20 23:48:02 +01:00
Willy Tarreau
2807689c47 [DOC] document options nolinger to ssl-hello-chk
Options nolinger, persist, smtpchk and ssl-hello-chk have been
documented. All keywords and options up to and including option
tcpka are now documented.
2008-01-20 23:47:14 +01:00
Willy Tarreau
32f680ee2d [BUG] fix typo in redispatched connection
a copy-paste typo was present in the reconnection code responsible
for respatching. The client's FSM would not be re-evaluated if an
error occurred. It looks harmless but better fix it.
2008-01-20 23:45:43 +01:00
Willy Tarreau
cfa2a209aa [BUG] increment server connections for each connect()
It was abnormal to see more connect errors than connect attempts.
This was caused by the fact that the server's connection count was
not incremented for failed connect() attempts.

Now the per-server connections are correctly incremented for each
connect() attempt. This includes the retries too. The number of
connections effectively served by a server will then be :

   srv->cum_sess - srv->errors - srv->warnings
2008-01-20 23:43:37 +01:00
Willy Tarreau
9aca958d3f [MINOR] tarpit timeout is also allowed in backends
Since the tarpit action may be set in backends too, its timeout
must be configurable there.
2008-01-20 23:43:31 +01:00
Willy Tarreau
5a14f18f50 [MEDIUM] introduce "timeout http-request" in frontends
In order to offer DoS protection, it may be required to lower the maximum
accepted time to receive a complete HTTP request without affecting the client
timeout. This helps protecting against established connections on which
nothing is sent. The client timeout cannot offer a good protection against
this abuse because it is an inactivity timeout, which means that if the
attacker sends one character every now and then, the timeout will not
trigger. With the HTTP request timeout, no matter what speed the client
types, the request will be aborted if it does not complete in time.
2008-01-20 23:43:28 +01:00
Willy Tarreau
544c4cca69 [OPTIM] introduce global parameter "tune.maxaccept"
This new parameter makes it possible to override the default
number of consecutive incoming connections which can be
accepted on a socket. By default it is not limited on single
process mode, and limited to 8 in multi-process mode.
2008-01-20 23:43:15 +01:00
Willy Tarreau
41f6aa77c5 [MINOR] add support for the "backlog" parameter
Add the "backlog" parameter to frontends, to give hints to
the system about the approximate listen backlog desired size.

In order to protect against SYN flood attacks, one solution is
to increase the system's SYN backlog size. Depending on the
system, sometimes it is just tunable via a system parameter,
sometimes it is not adjustable at all, and sometimes the system
relies on hints given by the application at the time of the
listen() syscall. By default, HAProxy passes the frontend's
maxconn value to the listen() syscall. On systems which can
make use of this value, it can sometimes be useful to be able
to specify a different value, hence this backlog parameter.
2008-01-20 23:43:11 +01:00
Willy Tarreau
4cd71fd920 [DOC] document options forwardfor to logasap
Options forwardfor, http_proxy, httpchk, httpclose, httplog and logasap
have been documented.
2008-01-20 23:43:01 +01:00
Willy Tarreau
b94872f4d9 [STATS] add support for "show info" on the unix socket
It is sometimes required to know some informations such as the
process uptime when consulting statistics. This patch adds the
"show info" command to query those informations on the UNIX
socket.
2008-01-20 23:42:56 +01:00
Willy Tarreau
b75d2deb48 [BUILD] major rework of the GNU Makefile
The build process was getting annoying under some conditions,
especially on platforms which are used to set CFLAGS, as well
as those which set a lot of complex defines. The new Makefile
takes care of this situation by not mixing TARGET, CPU and user
values, and by making privileging the pre-setting of common
variables with the ability to override them.

Now CFLAGS and LDFLAGS are set by default and may be overridden
without the risk of breaking useful defines. Options are better
dealt with, and as a bonus, it was possible to merge the FreeBSD
and OpenBSD targets into the common GNU Makefile.

The report of build options by "haproxy -vv" has been slightly
adapted to the new mode. Options implied by architecture are not
reported, only user-specified options are. It is also possible to
add options which will not be reported in order not to mangle the
output when specifying dirty informations such as URLs...

The Makefile was copiously documented and it should be easier to
build for any target now. Backwards compatibility with older
build processes was kept, and warnings are emitted for deprecated
build options.
2008-01-20 23:42:45 +01:00
Willy Tarreau
0492fb6110 [DOC] document more options
All options up to and including "forceclose" have been documented.
2008-01-20 23:42:40 +01:00
Willy Tarreau
20d4184a54 [DOC] large update to the configuration manual
Keywords from "errorloc" to "monitor-uri" inclusive have been added.
Some fixes applied too.
2008-01-20 23:42:36 +01:00