1133 Commits

Author SHA1 Message Date
Willy Tarreau
0140f79c4c [RELEASE] Released version 1.3.21
Released version 1.3.21 with the following main changes :
    - [DOC] add missing rate_lim and rate_max
    - [BUG] check if rise/fall has an argument and it is > 0
    - [MINOR] add "description", "node" and show-node"/"show-desc", remove "node-name", v2
    - [DOC] Add information about http://haproxy.1wt.eu/contrib.html
    - [MINOR] acl: don't report valid acls as potential mistakes
    - [BUG] task.c: don't assing last_timer to node-less entries
    - [MINOR] export the hostname variable so that all the code can access it
    - [MINOR] stats: add a new node-name setting
    - [MINOR] acl: add support for hdr_ip to match IP addresses in headers
    - [CLEANUP] remove ifdef MSG_NOSIGNAL and define it instead
    - [BUG] buffer_forward() would not correctly consider data already scheduled
    - [MAJOR] http: add support for HTTP 1xx informational responses
    - [BUILD] stream_interface: fix conflicting declaration
    - [CLEANUP] include time.h from freq_ctr.h as it uses "now".
    - [MINOR] report list of supported pollers with -vv
    - [MEDIUM] new option "independant-streams" to stop updating read timeout on writes
    - [BUG] don't refresh timeouts late after detected activity
    - [MINOR] acl: add fe_conn, be_conn, queue, avg_queue
    - [BUILD] add a 'make tags' target (cherry picked from commit ebe0af4b77bca2042565a3f15fc1f597f5862874)
v1.3.21
2009-10-12 06:20:09 +02:00
Willy Tarreau
1fbfed4748 [BUILD] add a 'make tags' target
(cherry picked from commit ebe0af4b77bca2042565a3f15fc1f597f5862874)
2009-10-12 06:13:36 +02:00
SaVaGe
22c0257059 [BUG] task.c: don't assing last_timer to node-less entries
I noticed that in __eb32_insert , if the tree is empty
(root->b[EB_LEFT] == NULL) , the node.bit is not defined.
However in __task_queue there are checks:

- if (last_timer->node.bit < 0)
- if (task->wq.node.bit < last_timer->node.bit)

which might rely upon an undefined value.

This is how I see it:

1. We insert eb32_node in an empty wait queue tree for a task (called by
process_runnable_tasks() ):
Inserting into empty wait queue  &task->wq = 0x72a87c8, last_timer
pointer: (nil)

2. Then, we set the last timer to the same address:
Setting last_timer: (nil) to: 0x72a87c8

3. We get a new task to be inserted in the queue (again called by
process_runnable_tasks()) , before the __task_unlink_wq() is called for
the previous task.

4. At this point, we still have last_timer set to 0x72a87c8 , but since
it was inserted in an empty tree, it doesn't have node.bit and the
values above get dereferenced with undefined value.

The bug has no effect right now because the check for equality is still
made, so the next timer will still be queued at the right place anyway,
without any possible side-effect. But it's a pending bug waiting for a
small change somewhere to strike.

Iliya Polihronov
(cherry picked from commit 1d7a420c84cfd19bfeaedfc1dc971fb13dfc8a1f)
2009-10-12 06:12:58 +02:00
Willy Tarreau
59f4a5bd64 [MINOR] acl: add fe_conn, be_conn, queue, avg_queue
These ACLs are used to check the number of active connections on the
frontend, backend or in a backend's queue. The avg_queue returns the
average number of queued connections per server, and for this, divides
the total number of queued connections by the number of alive servers.

The dst_conn ACL has been slightly changed to more reflect its name and
original usage, which is to return the number of connections on the
destination address/port (the socket) and not the whole frontend.
(cherry picked from commit a36af91951539ee7b24afd1dee58216979efeaea)
2009-10-12 06:12:34 +02:00
Krzysztof Piotr Oledzki
59dd3fc338 [MINOR] acl: don't report valid acls as potential mistakes
Commit 404e8ab4615d564a74f92a0d3822b0292dd6224f introduced
smart checking for stupid acl typos. However, now haproxy shows
the warning even for valid acls, like this one:
	acl Cookie-X-NoAccel    hdr_reg(cookie) (^|\ |;)X-NoAccel=1(;|$)
(cherry picked from commit 4cdd8314e949f1c31f86331a1122c3ec9ff7c233)
2009-10-08 07:06:49 +02:00
Krzysztof Piotr Oledzki
5bf03c33fd [DOC] Add information about http://haproxy.1wt.eu/contrib.html
Add information about http://haproxy.1wt.eu/contrib.html in
the CONTRIB file and remove one useless comment.
(cherry picked from commit 6d45fcd7198300b1744c04398a49724aff729b75)
2009-10-08 07:03:38 +02:00
Willy Tarreau
1932d372d5 [BUG] don't refresh timeouts late after detected activity
In old versions, before 1.3.16, we had to refresh the timeouts after
each call to process_session() because the stream socket handler did
not do it. Now that the sockets can exchange data for a long period
without calling process_session(), we can detect an old activity and
refresh a timeout long after the last activity, causing too late a
detection of some timeouts.

The fix simply consists in not checking for activity anymore in
stream_sock_data_finish() but only set a timeout if it was not
previously set.
(cherry picked from commit fe8903cc76184ef20109d9ec9729a88368b2ccd7)
2009-10-04 11:00:41 +02:00
Willy Tarreau
a3e0e0767f [MEDIUM] new option "independant-streams" to stop updating read timeout on writes
By default, when data is sent over a socket, both the write timeout and the
read timeout for that socket are refreshed, because we consider that there is
activity on that socket, and we have no other means of guessing if we should
receive data or not.

While this default behaviour is desirable for almost all applications, there
exists a situation where it is desirable to disable it, and only refresh the
read timeout if there are incoming data. This happens on sessions with large
timeouts and low amounts of exchanged data such as telnet session. If the
server suddenly disappears, the output data accumulates in the system's
socket buffers, both timeouts are correctly refreshed, and there is no way
to know the server does not receive them, so we don't timeout. However, when
the underlying protocol always echoes sent data, it would be enough by itself
to detect the issue using the read timeout. Note that this problem does not
happen with more verbose protocols because data won't accumulate long in the
socket buffers.

When this option is set on the frontend, it will disable read timeout updates
on data sent to the client. There probably is little use of this case. When
the option is set on the backend, it will disable read timeout updates on
data sent to the server. Doing so will typically break large HTTP posts from
slow lines, so use it with caution.

(cherry picked from commit f27b5ea8dc615bd2a9ffaba90ba3dda66567dbc4)
2009-10-03 22:11:50 +02:00
Willy Tarreau
ac317992c9 [MINOR] report list of supported pollers with -vv
During troubleshooting, it's often useful to get the list of supported
pollers but until now it was required to have a working configuration
first. Since the pollers are known before main() is called, let's list
them with the build options.

Also report the default MAXCONN setting.

(cherry picked from commit be5b68584e09b7760230a4ba54278af17e0455f3)
2009-10-03 20:06:16 +02:00
Krzysztof Piotr Oledzki
4f9290afb3 [MINOR] add "description", "node" and show-node"/"show-desc", remove "node-name", v2
This patch implements "description" (proxy and global) and "node" (global)
options, removes "node-name" and adds "show-node" & "show-desc" options
for "stats". It also changes the way the header lines (with proxy name) and
the statistics are displayed, so stats no longer look so clumsy with very
long names.

Instead of "node-name" it is possible to use show-node/show-desc with
an optional parameter that overrides a default node/description.

backend cust-0045
        # report specific values for this customer
        stats show-node Europe
        stats show-desc Master node for Europe, Asia, Africa

(cherry picked from commit 48cb2aed5aab2dec7af77055a3cd9a158727527a)
2009-10-03 20:01:52 +02:00
Willy Tarreau
0a64b062e7 [CLEANUP] include time.h from freq_ctr.h as it uses "now".
(cherry picked from commit 78ff5d0a9e62b0aa4c31f18859d2a0de71bb9da6)
2009-10-03 19:32:26 +02:00
Krzysztof Piotr Oledzki
5e947894af [BUG] check if rise/fall has an argument and it is > 0
Check if rise/fall has an argument and it is > 0  or bad things may happen
in the health checks. ;)

Now it is verified and the code no longer allows for such condition:

backend bad
	(...)
        server o-f0 192.168.129.27:80 check inter 4000 source 0.0.0.0 rise 0
        server o-r0 192.168.129.27:80 check inter 4000 source 0.0.0.0 fall 0
        server o-f1 192.168.129.27:80 check inter 4000 source 0.0.0.0 rise
        server o-r1 192.168.129.27:80 check inter 4000 source 0.0.0.0 fall

[ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:98]: 'rise' has to be > 0.
[ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:99]: 'fall' has to be > 0.
[ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:100]: 'rise' expects an integer argument.
[ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:101]: 'fall' expects an integer argument.

Also add endline in the custom id checking code.

(cherry picked from commit 08ff959c3eaaac89efb38f249f095a8b0d04ef47)
2009-10-03 19:31:36 +02:00
Krzysztof Piotr Oledzki
974b12d7ed [DOC] add missing rate_lim and rate_max
(cherry picked from commit db57c6b293051ed45eb5dc7f9fcc307bedd486eb)
2009-10-03 19:30:40 +02:00
Willy Tarreau
0130006460 [BUILD] stream_interface: fix conflicting declaration
stream_int_check_timeouts was declared void while it's an int.

(cherry picked from commit 269358db93458d343584581239cd7118a09a52a0)
2009-10-03 19:25:25 +02:00
Willy Tarreau
28e118ce8a [MAJOR] http: add support for HTTP 1xx informational responses
HTTP supports status codes 100 and 101 to report protocol indications,
which are followed by the requests's response. Till now, haproxy would
only see those responses without parsing subsequent ones. That means
that cookie additions were only performed on 1xx messages for instance,
which does not work since headers must be ignored with 1xx messages.
Also, logs were not terribly useful with the common 100 status code
in response to "Expect: 100-continue" during POST some requests.

This change adds support for such messages. Now haproxy sees them,
forwards them and skips them until it finds a correct response, which
it logs and processes. As an exception, header removal/rewriting still
work on 1xx responses in order to be able to strip out sensible
information that may have accidentely been left by another equipment
(possibly an older haproxy itself). But headers addition are disabled
however.

This change brings the ability to loop on response without data, which
is a starting point to support keepalive. The change is marked as major
as a few fixes had to be performed in the HTTP message parser.

Note: this change is sensible for version 1.3 but it appears correct
      and has extensively been tested. Also it fixes a real misbehaviour.

(cherry picked from commit 816b97997772524e974b18a165af8f4f803192c6)
2009-10-03 19:18:47 +02:00
Willy Tarreau
db95cd94c0 [BUG] buffer_forward() would not correctly consider data already scheduled
The computations in buffer_forward() were only valid if buffer_forward()
was used on a buffer which had no more data scheduled for forwarding.
This is always the case right now so this bug is not yet triggered but
it will soon be. Now we correctly discount the bytes to be forwarded
from the data already present in the buffer.
(cherry picked from commit 91aa577b1f0483c50bfa72b3198cf1a1ff835163)
2009-10-03 19:16:22 +02:00
Willy Tarreau
29b366dcdd [CLEANUP] remove ifdef MSG_NOSIGNAL and define it instead
ifdefs are really annoying in the code. Define MSG_NOSIGNAL to zero
when undefined and remove associated ifdefs.

(cherry picked from commit d6d06909dae55bd594f5a9d6bf54dad04eae382f)
2009-10-03 19:12:12 +02:00
Willy Tarreau
21d761b3f9 [MINOR] acl: add support for hdr_ip to match IP addresses in headers
For x-forwarded-for and such headers, it's sometimes needed to match
based on network addresses. Let's use hdr_ip() for that.
2009-09-19 07:54:16 +02:00
Willy Tarreau
6eb3cb98f6 [MINOR] stats: add a new node-name setting
The new "node-name" stats setting enables reporting of a node ID on
the stats page. It is possible to return the system's host name as
well as a specific name.
(cherry picked from commit 1d45b7cbaeeed0426165521fbd9dab4be55b14a4)
2009-08-16 11:06:16 +02:00
Willy Tarreau
bf55b08e39 [MINOR] export the hostname variable so that all the code can access it
The hostname variable will be used later, export it.
(cherry picked from commit 3ad6a7640ba6bfbac6987dfa581c345bdc03100b)
2009-08-16 11:06:13 +02:00
Willy Tarreau
87dda9a99c [RELEASE] Released version 1.3.20
Released version 1.3.20 with the following main changes :
    - [BUG] task: fix possible crash when some timeouts are not configured
    - [BUG] log: option tcplog would log to global if no logger was defined
v1.3.20
2009-08-09 22:53:49 +02:00
Willy Tarreau
3456c4491b [BUG] log: option tcplog would log to global if no logger was defined
Romuald du Song reported a strange bug causing "option tcplog" to
unexpectedly use global log parameters if no log server was declared.

Eventhough it can be useful in some circumstances, it only hides
configuration bugs and can even cause traffic logs to be sent to
the wrong logger, since global settings are just for the process.

This has been fixed and a warning has been added for configurations
where tcplog or httplog are set without any logger. This fix must
be backported to 1.3.20, but not to 1.3.15.X in order not to risk
any regression on old configurations.
(cherry picked from commit e7ded1f8698ab954656106baae9cc8da00567511)
2009-08-09 16:16:38 +02:00
Willy Tarreau
734c3d3177 [BUG] task: fix possible crash when some timeouts are not configured
Cristian Ditoiu reported a major regression when testing 1.3.19 at
transfer.ro. It would crash within a few minutes while 1.3.15.10
was OK. He offered to help so we could run gdb and debug the crash
live. We finally found that the crash was the result of a regression
introduced by recent fix 814c978fb67782ceeaf1db74abfe7083938bedff
(task: fix possible timer drift after update) which makes it possible
for a tree walk to start from a detached task if this task has got
its timeout disabled due to a missing timeout.

The trivial fix below has been extensively tested and confirmed not
to crash anymore.

Special thanks to Cristian who spontaneously provided a lot of help
and trust to debug this issue which at first glance looked impossible
after reading the code and traces, but took less than an hour to spot
and fix when caught live in gdb ! That's really appreciated !
(cherry picked from commit 34e98ea70d09195e8e047b3ea22c23506598687d)
2009-08-09 09:27:56 +02:00
Willy Tarreau
06700118d0 [RELEASE] Released version 1.3.19
Released version 1.3.19 with the following main changes :
    - [MINOR] startup: don't imply -q with -D
    - [BUG] ensure that we correctly re-start old process in case of error
    - [MEDIUM] add support for binding to source port ranges during connect
    - [MEDIUM] support setting a server weight to zero
    - [MINOR] make DEFAULT_MAXCONN user-configurable at build time
    - [MEDIUM] config: split parser and checker in two functions
    - [MEDIUM] config: support loading multiple configuration files
    - [BUG] http: redirect rules were processed too early
    - [CLEANUP] remove unused DEBUG_PARSE_NO_SPEEDUP define
    - [BUG] default ACLs did not properly set the ->requires flag
    - [BUILD] report commit date and not author's date as build date
    - [BUG] stream_sock: always shutdown(SHUT_WR) before closing
    - [BUG] stream_sock: don't stop reading when the poller reports an error
    - [BUG] config: tcp-request content only accepts "if" or "unless"
    - [BUG] task: fix possible timer drift after update
    - [MINOR] stats: better displaying in MSIE
    - [MINOR] config: improve error reporting in global section
    - [MINOR] config: improve error reporting in listen sections
    - [MINOR] config: the "capture" keyword is not allowed in backends
    - [MINOR] config: improve error reporting when checking configuration
    - [BUILD] fix a minor build warning on AIX
    - [BUILD] use "git cmd" instead of "git-cmd"
    - [CLEANUP] report 2009 not 2008 in the copyright banner.
    - [MINOR] print usage on the stats sockets upon invalid commands
    - [MINOR] acl: detect and report potential mistakes in ACLs
    - [BUILD] fix incorrect printf arg count with tcp_splice
    - [BUG] fix random pauses on last segment of a series
    - [BUILD] add support for build under Cygwin
v1.3.19
2009-07-27 21:39:21 +02:00
Willy Tarreau
d28022b894 [BUG] fix random pauses on last segment of a series
During a direct data transfer from the server to the client, if the
system did not have enough buffers anymore, haproxy would not enable
write polling again if it could write at least one data chunk. Under
normal conditions, this would remain undetected because the remaining
data would be pushed by next data chunks.

However, when this happens on the last chunk of a session, or the last
in a series in an interactive bidirectional TCP transfer, haproxy would
only start sending again when the read timeout was reached on the side
it stopped writing, causing long pauses on some protocols such as SQL.

This bug was reported by an Exceliance customer who generously offered
to help us by sending large amounts of traces and running various tests
on production systems.

It is quite hard to trigger it but it becomes easier with a ping-pong
TCP service which transfers random data sizes, with a modified version
of send() able to send packets smaller than the average transfer size.

A cleaner fix would imply only updating the write timeout when data
transfers are *attempted*, not succeeded, but that requires more
sensible code changes without fixing the result. It is a candidate
for a later patch though.
(cherry picked from commit c54aef3180c00abc5abe33136f4cfbaa1328bdb1)
2009-07-27 20:20:36 +02:00
Willy Tarreau
9d4108b390 [BUILD] fix incorrect printf arg count with tcp_splice
remove an extra arg.
(cherry picked from commit bc69d8bbcf80ab8721449636e274a691f117680f)
2009-07-26 20:41:36 +02:00
Willy Tarreau
5e7d34606a [MINOR] acl: detect and report potential mistakes in ACLs
I've discovered a configuration with lots of occurrences of the
following :

    acl xxx hdr_beg (host) xxx

The problem is that hdr_beg will match every header against patterns
(host) and xxx due to the space between both, which certainly is not
what the user wanted. Now we detect such ACLs and report a warning
with a suggestion to add "--" between "hdr_beg" and "(host)" if this
is definitely what is wanted.
(cherry picked from commit 404e8ab4615d564a74f92a0d3822b0292dd6224f)
2009-07-26 19:43:20 +02:00
Willy Tarreau
90a6c0f1ac [MINOR] print usage on the stats sockets upon invalid commands
When issuing commands on the unix socket, there's no way to
know if the result is empty or if the command is wrong. This
patch makes invalid command return a help message.
(cherry picked from commit 43e0e3997870e39b78b87d3050f260571e5a7de9)
2009-07-26 18:18:59 +02:00
Willy Tarreau
b98fd68179 [CLEANUP] report 2009 not 2008 in the copyright banner.
(cherry picked from commit b455691af393f831ab44c70b605fd45e7ca0967b)
2009-07-26 17:43:45 +02:00
Willy Tarreau
e68f64fd01 [BUILD] use "git cmd" instead of "git-cmd"
Newer GIT versions do not support "git-cmd" anymore, so date and version
can be wrong during development builds. Use "git cmd" now. Also fix
git-tar to use "git archive" instead of "git-tar-tree".
(cherry picked from commit 63076b3f611803a9bf9e6012193f89d14ccc32d2)
2009-07-26 17:41:44 +02:00
Willy Tarreau
a16d36b34e [BUILD] fix a minor build warning on AIX
AIX wants string.h in signal.c (and is right to do so) :

gcc -Iinclude -Wall  -O2 -g       -DTPROXY -DENABLE_POLL  -DCONFIG_HAPROXY_VERSION=\"1.3.18\" -DCONFIG_HAPROXY_DATE=\"2009/05/10\" -c -o src/signal.o src/signal.c
src/signal.c: In function 'signal_init':
src/signal.c:32: warning: implicit declaration of function 'memset'
src/signal.c:32: warning: incompatible implicit declaration of built-in function 'memset'
(cherry picked from commit be8c736cca24f3981a3e9dee868605ae76b9565c)
2009-07-26 17:41:23 +02:00
Willy Tarreau
69510962ad [MINOR] config: improve error reporting when checking configuration
Do not exit early at the first error found while checking configuration
validity. This particularly helps spotting multiple wrong tracked server
names at once.
(cherry picked from commit bb9250104fdf1096b708181c82172df737341a95)
2009-07-26 17:41:10 +02:00
Willy Tarreau
914a788c07 [MINOR] config: the "capture" keyword is not allowed in backends
The "capture" keyword is only supported by frontends, fix the check.
(cherry picked from commit 3b6b1a984d6a587892afc88d03862c3fc3681bce)
2009-07-26 17:40:57 +02:00
Willy Tarreau
79c9046b8b [MINOR] config: improve error reporting in listen sections
Try not to immediately exit on non-fatal errors while parsing a
listen section, so that the user has a chance to get most of the
errors at once, which is quite convenient especially during config
checks with the -c argument.
(cherry picked from commit 9389379f608d0776988125e52cbac12a2a2ad165)
2009-07-26 17:40:35 +02:00
Willy Tarreau
e2b61b7bf0 [MINOR] config: improve error reporting in global section
Try not to immediately exit on non-fatal errors while parsing the
global section, so that the user has a chance to get most of the
errors at once, which is quite convenient especially during config
checks with the -c argument. Some other errors such as unresolved
server names also don't make the parser exit too early.
(cherry picked from commit 058e9074865abd23912127d8847cccb6b5f4eb8b)
2009-07-26 17:40:04 +02:00
Willy Tarreau
2d99640d85 [MINOR] stats: better displaying in MSIE
MSIE does not correctly display spaced digits. It requires a margin of
at least one pixel. Also, it does not correctly hide empty cells, so we
work around this by setting the background white. Last, the H1 font was
too large, so we reduce it by one size, which is still OK in other
browsers.
(cherry picked from commit da6721ba28d4c917e07ffa7fef1d8707c80c54b6)
2009-07-20 09:04:37 +02:00
Willy Tarreau
4de2dea807 [BUG] task: fix possible timer drift after update
When the scheduler detected that a task was misplaced in the timer
queue, it used to place it right again. Unfortunately, it did not
check whether it would still call the new task from its new place.
This resulted in some tasks not getting called on timeout once in
a while, causing a minor drift for repetitive timers. This effect
was only observable with slow health checks and without any activity
because no other task would cause the scheduler to be immediately
called again.

In practice, it does not affect any real-world configuration, but
it's still better to fix it.
(cherry picked from commit 814c978fb67782ceeaf1db74abfe7083938bedff)
2009-07-14 23:54:12 +02:00
Willy Tarreau
7cf930b2dd [BUG] config: tcp-request content only accepts "if" or "unless"
As reported by Maik Broemme, if something different from "if" or
"unless" was specified after "tcp-request content accept", the
condition would silently remain void. The parser must obviously
complain since this typically corresponds to a forgotten "if".
(cherry picked from commit 606ad73e73600275aae944f00bda4af9976c0be8)
2009-07-14 21:19:04 +02:00
Willy Tarreau
53c802f682 [BUG] stream_sock: don't stop reading when the poller reports an error
As reported by Jean-Baptiste Quenot and Robbie Aelter, sometimes a
backend server error is converted to a 502 error if the backend stops
before reading all the request. The reason is that the remote system
sends a TCP RST packet because there are still unread data pending in
the socket buffer. This RST is translated as a socket error on the
local system, and this error is reported by the poller.

However, most of the time, it's a write error, but the system is
still able to read the remaining pending data, such as in the trace
below :

send(7, "GET /aaa HTTP/1.0\r\nUser-Agent: Mo"..., 1123, MSG_DONTWAIT|MSG_NOSIGNAL) = 1123
epoll_ctl(3, EPOLL_CTL_ADD, 7, {EPOLLIN, {u32=7, u64=7}}) = 0
epoll_wait(3, {{EPOLLIN|EPOLLERR|EPOLLHUP, {u32=7, u64=7}}}, 8, 1000) = 1
gettimeofday({1247593958, 643572}, NULL) = 0
recv(7, "HTTP/1.0 400 Bad request\r\nCache-C"..., 7000, MSG_NOSIGNAL) = 187
setsockopt(6, SOL_TCP, TCP_NODELAY, [0], 4) = 0
setsockopt(6, SOL_TCP, TCP_CORK, [1], 4) = 0
send(6, "HTTP/1.0 400 Bad request\r\nCache-C"..., 187, MSG_DONTWAIT|MSG_NOSIGNAL) = 187
shutdown(6, 1 /* send */)               = 0

The recv succeeded while epoll_wait() reported an error.

Note: This case is very hard to reproduce and requires that the backend
server is reached via the loopback in order to minimise latency and
reduce the risk of sent data being ACKed.
(cherry picked from commit 7154365cc60b124b543db4e98faedc75c0f3a2cb)
2009-07-14 20:25:02 +02:00
Willy Tarreau
77cb067142 [BUG] stream_sock: always shutdown(SHUT_WR) before closing
When we close a socket with unread data in the buffer, or when the
nolinger option is set, we regularly lose the last fragment, which
often contains the error message. This typically occurs when sending
too large a request. Only the RST is seen due to the close() (since
not all data were read) and the output message never reaches the
network.

Doing a shutdown() before the close() solves this annoying issue
because the data are really pushed before the system sends the RST.
(cherry picked from commit 720058cdcbd5285dc4e4a48216b10c9b96000141)
2009-07-14 20:24:27 +02:00
Willy Tarreau
b6b8f478e2 [BUILD] report commit date and not author's date as build date
By default, when building from a git tree, haproxy's release date is
set to the last commit's date. But it was the wrong date which was
used, the initial patch's date, which can cause time jumps in the
past when an old patch gets merged. What we want is the commit date,
which reflects the correct code history.
(cherry picked from commit 446024e7fb5faef86cd6e2c0aba3c4524ad77705)
2009-07-14 20:23:11 +02:00
Willy Tarreau
7313a7e604 [BUG] default ACLs did not properly set the ->requires flag
This bug caused TCP proxies not to report incorrect use of some
aliases of HTTP ACLs.
(cherry picked from commit a55b7dc52877ee81609db688f327e7e9586498f0)
2009-07-14 20:20:54 +02:00
Willy Tarreau
d720927951 [CLEANUP] remove unused DEBUG_PARSE_NO_SPEEDUP define
This one has become useless with the new HTTP parser.
(cherry picked from commit 571ec98baaacd68205ada1cda898ae359a41bc83)
2009-07-14 20:20:18 +02:00
Willy Tarreau
5011355cfd [BUG] http: redirect rules were processed too early
redirect rules are documented as being processed last before
use_backend but were mistakenly processed before block rules.
Fortunately very few people use a mix of block and redirect
rules, so this bug has never been reported yet.
(cherry picked from commit 06b917c7abcd7313263d551eaecda1b31b9c03b1)
2009-07-14 20:19:03 +02:00
Willy Tarreau
e09c51b707 [MEDIUM] config: support loading multiple configuration files
We now support up to 10 distinct configuration files. They are
all loaded in the order defined by -f <file1> -f <file2> ...

This can be useful in order to store global, private, public,
etc... configurations in distinct files.
(cherry picked from commit 5d01a63b7862235fdd3119cb29d5a0cfd04edb91)
2009-07-14 20:17:13 +02:00
Willy Tarreau
b2bec3ad3d [MEDIUM] config: split parser and checker in two functions
This is a first step towards support of multiple configuration files.
Now readcfgfile() only reads a file in memory and performs very minimal
parsing. The checks are performed afterwards.
(cherry picked from commit 915e1ebe63b2137fa1634ebc9553f5b73ae2fd75)
2009-07-14 20:17:07 +02:00
Willy Tarreau
e7345f355d [MINOR] make DEFAULT_MAXCONN user-configurable at build time
The only way to set this previously was to set SYSTEM_MAXCONN
which serves a different purpose.
(cherry picked from commit c9fe4562c24ebacdfdf55631636e5a5a0395e43c)
2009-07-14 20:15:37 +02:00
Willy Tarreau
1c2f47166c [MEDIUM] support setting a server weight to zero
Sometimes it is useful to be able to set a server's weight to zero.
It allows the server to receive only persistent traffic but never
normal traffic.
(cherry picked from commit 6704d67d656574a602ddf81a603cdb4f482f90a9)
2009-07-14 20:15:27 +02:00
Yitzhak Sapir
de5ba00c9a [BUILD] add support for build under Cygwin
After considering various possibilities, we compiled haproxy under cygwin.
Attached is an updated full diff that also has the TARGET=cygwin documented.
The whole thing compiles and installs with this diff only.

In cygwin 1.7 (now in beta), there is apparently support for ipv6.  Cygwin
1.5 (later versions, anyway) already includes some support in the form of a
define USE_IPV6.  When defined, it declares the sockaddr_in6 struct and
possibly other things.  The above definition AF_INET6=23 is taken from
their /usr/include/socket.h file (where it is #if 0'd out).

We are running into a socket limit.  It appears that Cygwin (running on
Windows 2003 Server) will only allow us to set ulimit -n (maximum open
files) to 3200, which means we're a little short of 1600 connections.

The limit of 3200 is an internal Cygwin limit.  Perhaps they can raise it in
the future.  Using the nbproc option, I was able to bring up 10 servers.  It
seems to me that they were able to handle over 2000 connections (even though
each had maxconn 1500 set, and the hard Cygwin fd limit).
(cherry picked from commit 32087312e3a4ad483440d371b0b1769db23946d3)
2009-07-14 20:14:54 +02:00
Willy Tarreau
16401e8162 [MEDIUM] add support for binding to source port ranges during connect
Some users are already hitting the 64k source port limit when
connecting to servers. The system usually maintains a list of
unused source ports, regardless of the source IP they're bound
to. So in order to go beyond the 64k concurrent connections, we
have to manage the source ip:port lists ourselves.

The solution consists in assigning a source port range to each
server and use a free port in that range when connecting to that
server, either for a proxied connection or for a health check.
The port must then be put back into the server's range when the
connection is closed.

This mechanism is used only when a port range is specified on
a server. It makes it possible to reach 64k connections per
server, possibly all from the same IP address. Right now it
should be more than enough even for huge deployments.
(cherry picked from commit c6f4ce8fc4a9da9f4c31e8d088fab1ed4f631ed0)
2009-07-14 20:13:26 +02:00