]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
15 years ago[MAJOR] struct chunk rework
Krzysztof Piotr Oledzki [Sun, 27 Sep 2009 11:23:20 +0000 (13:23 +0200)] 
[MAJOR] struct chunk rework

Add size to struct chunk and simplify the code as there is
no longer required to pass sizeof in chunk_printf().

15 years ago[MINOR] backend: uninline some LB functions
Willy Tarreau [Thu, 1 Oct 2009 07:21:55 +0000 (09:21 +0200)] 
[MINOR] backend: uninline some LB functions

There is no reason to inline functions which are used to grab a server
depending on an LB algo. They are large and used at several places.
Uninlining them saves 400 bytes of code.

15 years ago[MINOR] backend: export some functions to recount servers
Willy Tarreau [Thu, 1 Oct 2009 07:17:05 +0000 (09:17 +0200)] 
[MINOR] backend: export some functions to recount servers

Those functions will be used by new LB algorithms.

15 years ago[BUG] http stats: large outputs sometimes got some parts chopped off
Willy Tarreau [Thu, 24 Sep 2009 20:22:18 +0000 (22:22 +0200)] 
[BUG] http stats: large outputs sometimes got some parts chopped off

Due to a misplaced call to stream_int_retnclose(), the stats output
buffer was erased before each call to produce_content(), resulting
in missing pieces in the stats output if the connection was not
fast enough between haproxy and the client.

15 years ago[DOC] add missing rate_lim and rate_max
Krzysztof Piotr Oledzki [Mon, 31 Aug 2009 19:23:27 +0000 (21:23 +0200)] 
[DOC] add missing rate_lim and rate_max

15 years ago[RELEASE] Released version 1.4-dev3 v1.4-dev3
Willy Tarreau [Wed, 23 Sep 2009 22:12:50 +0000 (00:12 +0200)] 
[RELEASE] Released version 1.4-dev3

Released version 1.4-dev3 with the following main changes :
    - [BUILD] compilation of haproxy-1.4-dev2 on FreeBSD
    - [MEDIUM] Collect & show information about last health check, v3
    - [MINOR] export the hostname variable so that all the code can access it
    - [MINOR] stats: add a new node-name setting
    - [MEDIUM] remove old experimental tcpsplice option
    - [BUILD] fix build for systems without SOL_TCP
    - [MEDIUM] move connection establishment from backend to the SI.
    - [MEDIUM] make the global stats socket part of a frontend
    - [MEDIUM] session: account per-listener connections
    - [MINOR] session: switch to established state if no connect function
    - [MEDIUM] make the unix stats sockets use the generic session handler
    - [CLEANUP] unix: remove uxst_process_session()
    - [CLEANUP] move remaining stats sockets code to dumpstats
    - [MINOR] move the initial task's nice value to the listener
    - [MINOR] cleanup set_session_backend by using pre-computed analysers
    - [MINOR] set s->srv_error according to the analysers
    - [MEDIUM] set rep->analysers from fe and be analysers
    - [MEDIUM] replace BUFSIZE with buf->size in computations
    - [MEDIUM] make it possible to change the buffer size in the configuration
    - [MEDIUM] report error on buffer writes larger than buffer size
    - [MEDIUM] stream_interface: add and use ->update function to resync
    - [CLEANUP] remove ifdef MSG_NOSIGNAL and define it instead
    - [MEDIUM] remove TCP_CORK and make use of MSG_MORE instead
    - [BUG] tarpit did not work anymore
    - [MINOR] acl: add support for hdr_ip to match IP addresses in headers
    - [MAJOR] buffers: fix misuse of the BF_SHUTW_NOW flag
    - [MINOR] buffers: provide more functions to handle buffer data
    - [MEDIUM] buffers: provide new buffer_feed*() function
    - [MINOR] buffers: add peekchar and peekline functions for stream interfaces
    - [MINOR] buffers: provide buffer_si_putchar() to send a char from a stream interface
    - [BUG] buffer_forward() would not correctly consider data already scheduled
    - [MINOR] buffers: add buffer_cut_tail() to cut only unsent data
    - [MEDIUM] stream_interface: make use of buffer_cut_tail() to report errors
    - [MAJOR] http: add support for HTTP 1xx informational responses
    - [MINOR] buffers: inline buffer_si_putchar()
    - [MAJOR] buffers: split BF_WRITE_ENA into BF_AUTO_CONNECT and BF_AUTO_CLOSE
    - [MAJOR] buffers: fix the BF_EMPTY flag's meaning
    - [BUG] stream_interface: SI_ST_CLO must have buffers SHUT
    - [MINOR] stream_sock: don't set SI_FL_WAIT_DATA if BF_SHUTW_NOW is set
    - [MEDIUM] add support for infinite forwarding
    - [BUILD] stream_interface: fix conflicting declaration
    - [BUG] buffers: buffer_forward() must not always clear BF_OUT_EMPTY
    - [BUG] variable buffer size ignored at initialization time
    - [MINOR] ensure that buffer_feed() and buffer_skip() set BF_*_PARTIAL
    - [BUG] fix buffer_skip() and buffer_si_getline() to correctly handle wrap-arounds
    - [MINOR] stream_interface: add SI_FL_DONT_WAKE flag
    - [MINOR] stream_interface: add iohandler callback
    - [MINOR] stream_interface: add functions to support running as internal/external tasks
    - [MEDIUM] session: call iohandler for embedded tasks (applets)
    - [MINOR] add a ->private member to the stream_interface
    - [MEDIUM] stats: prepare the connection for closing before dumping
    - [MEDIUM] stats: replace the stats socket analyser with an SI applet

15 years ago[MEDIUM] stats: replace the stats socket analyser with an SI applet
Willy Tarreau [Tue, 22 Sep 2009 17:31:03 +0000 (19:31 +0200)] 
[MEDIUM] stats: replace the stats socket analyser with an SI applet

We can get rid of the stats analyser by moving all the stats code
to a stream interface applet. Above being cleaner, it provides new
advantages such as the ability to process requests and responses
from the same function and work only with simple state machines.
There's no need for any hijack hack anymore.

The direct advantage for the user are the interactive mode and the
ability to chain several commands delimited by a semi-colon. Now if
the user types "prompt", he gets a prompt from which he can send
as many requests as he wants. All outputs are terminated by a
blank line followed by a new prompt, so this can be used from
external tools too.

The code is not very clean, it needs some rework, but some part
of the dirty parts are due to the remnants of the hijack mode used
in the old functions we call.

The old AN_REQ_STATS_SOCK analyser flag is now unused and has been
removed.

15 years ago[MEDIUM] stats: prepare the connection for closing before dumping
Willy Tarreau [Tue, 22 Sep 2009 17:27:35 +0000 (19:27 +0200)] 
[MEDIUM] stats: prepare the connection for closing before dumping

We will need to modify the stats dump functions so that they can
be used in interactive mode. For this, we want their caller to
prepare the connection for a close, not themselves to do it.
Let's simply move the stream_int_retnclose() out.

15 years ago[MINOR] add a ->private member to the stream_interface
Willy Tarreau [Sun, 20 Sep 2009 19:43:50 +0000 (21:43 +0200)] 
[MINOR] add a ->private member to the stream_interface

iohandlers will need to store some form of context and for this will
need a way to find their call context. We add the ->private as well
as ->st0 and ->st1 for that purpose. Most likely ->private will be
initialized to the current session and ->st0 and ->st1 will be used
to maintain any form of internal state between calls.

15 years ago[MEDIUM] session: call iohandler for embedded tasks (applets)
Willy Tarreau [Sat, 5 Sep 2009 18:57:35 +0000 (20:57 +0200)] 
[MEDIUM] session: call iohandler for embedded tasks (applets)

Currently, it's up to process_session() to call the internal tasks
if any are associated to the task being processed. If such a task
is referenced, we don't use ->update() in process_session(), but
only ->iohandler(), which itself is free to use ->update() to
complete its work.

It it also important to understand that an I/O handler may wake the
task up again, for instance because it tries to send data to the
other stream interface, which itself will wake the task up. So
after returning from ->iohandler(), we must check if the task has
been sent back to the runqueue, and if so, immediately return.

15 years ago[MINOR] stream_interface: add functions to support running as internal/external tasks
Willy Tarreau [Sat, 5 Sep 2009 18:57:35 +0000 (20:57 +0200)] 
[MINOR] stream_interface: add functions to support running as internal/external tasks

It will soon be necessary to have stream interfaces running as part of
the current task, or as independant tasks. For instance when we want to
implement compression or SSL. It will also be used for applets running
as stream interfaces.

These new functions are used to perform exactly that. Note that it's
still not easy to write a simple echo applet and more functions will
likely be needed.

15 years ago[MINOR] stream_interface: add iohandler callback
Willy Tarreau [Sat, 5 Sep 2009 18:57:35 +0000 (20:57 +0200)] 
[MINOR] stream_interface: add iohandler callback

When stream interfaces will embedded applets running as part as their
holding task, we'll need a new callback to process them from the
session processor.

15 years ago[MINOR] stream_interface: add SI_FL_DONT_WAKE flag
Willy Tarreau [Sat, 5 Sep 2009 18:57:35 +0000 (20:57 +0200)] 
[MINOR] stream_interface: add SI_FL_DONT_WAKE flag

We had to add a new stream_interface flag : SI_FL_DONT_WAKE. This flag
is used to indicate that a stream interface is being updated and that
no wake up should be sent to its owner. This will be required for tasks
embedded into stream interfaces. Otherwise, we could have the
owner task send wakeups to itself during status updates, thus
preventing the state from converging. As long as a stream_interface's
status is being monitored and adjusted, there is no reason to wake it
up again, as we know its changes will be seen and considered.

15 years ago[BUG] fix buffer_skip() and buffer_si_getline() to correctly handle wrap-arounds
Willy Tarreau [Wed, 23 Sep 2009 20:56:07 +0000 (22:56 +0200)] 
[BUG] fix buffer_skip() and buffer_si_getline() to correctly handle wrap-arounds

Those two functions did not correctly deal with full buffers and/or
buffers that wrapped around. Buffer_skip() was even able to incorrectly
set buf->w further than the end of buffer if its len argument was wrong,
and buffer_si_getline() was able to incorrectly return a length larger
than the effective buffer data available.

15 years ago[MINOR] ensure that buffer_feed() and buffer_skip() set BF_*_PARTIAL
Willy Tarreau [Wed, 23 Sep 2009 21:47:55 +0000 (23:47 +0200)] 
[MINOR] ensure that buffer_feed() and buffer_skip() set BF_*_PARTIAL

It's important that these functions set these flags themselves, otherwise
the callers will always have to do this, and there is no valid reason for
not doing it.

15 years ago[BUG] variable buffer size ignored at initialization time
Willy Tarreau [Wed, 23 Sep 2009 21:37:52 +0000 (23:37 +0200)] 
[BUG] variable buffer size ignored at initialization time

Commit 27a674efb84bde8c045b87c9634f123e2f8925dc introduced the ability
to configure buffer sizes. Unfortunately, the pool was created before
the conf was read, so that is was always set to the default size.

In order to fix that, we delay the call to init_buffer(), which is not
a problem since nothing uses it during the initialization.

15 years ago[MEDIUM] Collect & show information about last health check, v3
Krzysztof Piotr Oledzki [Wed, 23 Sep 2009 20:09:24 +0000 (22:09 +0200)] 
[MEDIUM] Collect & show information about last health check, v3

Collect information about last health check result,
including L7 code if possible (for example http or smtp
return code) and time took to finish last check.

Health check info is provided on both stats pages (html & csv)
and logged when a server is marked UP or DOWN. Currently active
check are marked with an asterisk, but only in html mode.

Currently there are 14 status codes:
  UNK     -> unknown

  INI     -> initializing
  SOCKERR -> socket error

  L4OK    -> check passed on layer 4, no upper layers testing enabled
  L4TOUT  -> layer 1-4 timeout
  L4CON   -> layer 1-4 connection problem, for example "Connection refused"
              (tcp rst) or "No route to host" (icmp)

  L6OK    -> check passed on layer 6
  L6TOUT  -> layer 6 (SSL) timeout
  L6RSP   -> layer 6 invalid response - protocol error

  L7OK    -> check passed on layer 7
  L7OKC   -> check conditionally passed on layer 7, for example
               404 with disable-on-404
  L7TOUT  -> layer 7 (HTTP/SMTP) timeout
  L7RSP   -> layer 7 invalid response - protocol error
  L7STS   -> layer 7 response error, for example HTTP 5xx

15 years ago[BUG] buffers: buffer_forward() must not always clear BF_OUT_EMPTY
Willy Tarreau [Sun, 20 Sep 2009 20:56:25 +0000 (22:56 +0200)] 
[BUG] buffers: buffer_forward() must not always clear BF_OUT_EMPTY

This flag was unconditionally cleared, which is wrong because we
can enable forwarding on an empty buffer.

15 years ago[BUILD] stream_interface: fix conflicting declaration
Willy Tarreau [Sun, 20 Sep 2009 18:14:49 +0000 (20:14 +0200)] 
[BUILD] stream_interface: fix conflicting declaration

stream_int_check_timeouts was declared void while it's an int.

15 years ago[MEDIUM] add support for infinite forwarding
Willy Tarreau [Sun, 20 Sep 2009 10:07:52 +0000 (12:07 +0200)] 
[MEDIUM] add support for infinite forwarding

In TCP, we don't want to forward chunks of data, we want to forward
indefinitely. This patch introduces a special value for the amount
of data to be forwarded. When buffer_forward() is called with
BUF_INFINITE_FORWARD, it configures the buffer to never stop
forwarding until the end.

15 years ago[MINOR] stream_sock: don't set SI_FL_WAIT_DATA if BF_SHUTW_NOW is set
Willy Tarreau [Sun, 20 Sep 2009 09:13:40 +0000 (11:13 +0200)] 
[MINOR] stream_sock: don't set SI_FL_WAIT_DATA if BF_SHUTW_NOW is set

Don't ask for more data when we know we're about to close. This is
harmless but better have it cleaned up.

15 years ago[BUG] stream_interface: SI_ST_CLO must have buffers SHUT
Willy Tarreau [Sun, 20 Sep 2009 06:19:25 +0000 (08:19 +0200)] 
[BUG] stream_interface: SI_ST_CLO must have buffers SHUT

An abort during a connect would go to the SI_ST_CLO state without
the buffers shut. This was causing some sessions to never end if
they would abort before the connect request was initiated. This
bug has been introduced after 1.4-dev2.

The doc has been extended to reflect that too.

15 years ago[MAJOR] buffers: fix the BF_EMPTY flag's meaning
Willy Tarreau [Sun, 20 Sep 2009 06:09:44 +0000 (08:09 +0200)] 
[MAJOR] buffers: fix the BF_EMPTY flag's meaning

The BF_EMPTY flag was once used to indicate an empty buffer. However,
it was used half the time as meaning the buffer is empty for the reader,
and half the time as meaning there is nothing left to send.

"nothing to send" is only indicated by "->send_max=0 && !pipe". Once
we fix this, we discover that the flag is not used anymore. So the
flags has been renamed BF_OUT_EMPTY and means exactly the condition
above, ie, there is nothing to send.

Doing so has allowed us to remove some unused tests for emptiness,
but also to uncover a certain amount of situations where the flag
was not correctly set or tested.

15 years ago[MAJOR] buffers: split BF_WRITE_ENA into BF_AUTO_CONNECT and BF_AUTO_CLOSE
Willy Tarreau [Sat, 19 Sep 2009 19:04:57 +0000 (21:04 +0200)] 
[MAJOR] buffers: split BF_WRITE_ENA into BF_AUTO_CONNECT and BF_AUTO_CLOSE

The BF_WRITE_ENA buffer flag became very complex to deal with, because
it was used to :
  - enable automatic connection
  - enable close forwarding
  - enable data forwarding

The last point was not very true anymore since we introduced ->send_max,
but still the test remained everywhere. This was causing issues such as
impossibility to connect without forwarding data, impossibility to prevent
closing when data was forwarded, etc...

This patch clarifies the situation by getting rid of this multi-purpose
flag and replacing it with :
  - data forwarding based only on ->send_max || ->pipe ;
  - a new BF_AUTO_CONNECT flag to allow automatic connection and only
    that ;
  - ability to perform an automatic connection when ->send_max or ->pipe
    indicate that data is waiting to leave the buffer ;
  - a new BF_AUTO_CLOSE flag to let the producer automatically set the
    BF_SHUTW_NOW flag when it gets a BF_SHUTR.

During this cleanup, it was discovered that some tests were performed
twice, or that the BF_HIJACK flag was still tested, which is not needed
anymore since ->send_max replcaed it. These places have been fixed too.

These cleanups have also revealed a few areas where the other flags
such as BF_EMPTY are not cleanly used. This will be an opportunity for
a second patch.

15 years ago[MINOR] buffers: inline buffer_si_putchar()
Willy Tarreau [Sun, 13 Sep 2009 12:58:00 +0000 (14:58 +0200)] 
[MINOR] buffers: inline buffer_si_putchar()

By inlining this function and slightly reordering it, we can double
the getchar/putchar test throughput, and reduce its footprint by about
40 bytes. Also, it was the only non-inlined char-based function, which
now makes it more consistent this time.

15 years ago[MAJOR] http: add support for HTTP 1xx informational responses
Willy Tarreau [Tue, 15 Sep 2009 19:25:21 +0000 (21:25 +0200)] 
[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.

15 years ago[MEDIUM] stream_interface: make use of buffer_cut_tail() to report errors
Willy Tarreau [Tue, 15 Sep 2009 19:23:54 +0000 (21:23 +0200)] 
[MEDIUM] stream_interface: make use of buffer_cut_tail() to report errors

The stream_int_return() function used to call buffer_erase() on the response
buffer, which completely wipes it without taking care about whatever could
have been there. Now we more carefully strip only data not scheduled to be
sent.

15 years ago[MINOR] buffers: add buffer_cut_tail() to cut only unsent data
Willy Tarreau [Tue, 15 Sep 2009 19:22:24 +0000 (21:22 +0200)] 
[MINOR] buffers: add buffer_cut_tail() to cut only unsent data

This function is used to cut the "tail" of a buffer, which means strip it
to the length of unsent data only, and kill any remaining unsent data. Any
scheduled forwarding is stopped. This is mainly to be used to send error
messages after existing data. It does the same as buffer_erase() for buffers
without pending outgoing data.

15 years ago[BUG] buffer_forward() would not correctly consider data already scheduled
Willy Tarreau [Tue, 15 Sep 2009 18:32:30 +0000 (20:32 +0200)] 
[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.

15 years ago[MINOR] buffers: provide buffer_si_putchar() to send a char from a stream interface
Willy Tarreau [Thu, 3 Sep 2009 05:13:50 +0000 (07:13 +0200)] 
[MINOR] buffers: provide buffer_si_putchar() to send a char from a stream interface

This function works like a traditional putchar() except that it
can return 0 if the output buffer is full.

Now a basic character-based echo function would look like this, from
a stream interface :

while (1) {
c = buffer_si_peekchar(req);
if (c < 0)
break;
if (!buffer_si_putchar(res, c)) {
si->flags |= SI_FL_WAIT_ROOM;
break;
}
buffer_skip(req, 1);
req->flags |= BF_WRITE_PARTIAL;
res->flags |= BF_READ_PARTIAL;
}

15 years ago[MINOR] buffers: add peekchar and peekline functions for stream interfaces
Willy Tarreau [Tue, 1 Sep 2009 04:41:32 +0000 (06:41 +0200)] 
[MINOR] buffers: add peekchar and peekline functions for stream interfaces

The buffer_si_peekline() function is sort of a fgets() to be used from a
stream interface. It returns a complete line whenever possible, and does
not update the buffer's pointer, so that the reader is free to consume
what it wants to.

buffer_si_peekchar() only returns one character, and also needs a call
to buffer_skip() once the character is definitely consumed.

15 years ago[MEDIUM] buffers: provide new buffer_feed*() function
Willy Tarreau [Mon, 31 Aug 2009 06:09:57 +0000 (08:09 +0200)] 
[MEDIUM] buffers: provide new buffer_feed*() function

This functions act like their buffer_write*() counter-parts,
except that they're specifically designed to be used from a
stream interface handler, as they carefully check size limits
and automatically advance the read pointer depending on the
to_forward attribute.

buffer_feed_chunk() is an inline calling buffer_feed() as both
are the sames. For this reason, buffer_write_chunk() has also
been turned into an inline which calls buffer_write().

15 years ago[MINOR] buffers: provide more functions to handle buffer data
Willy Tarreau [Mon, 31 Aug 2009 05:37:22 +0000 (07:37 +0200)] 
[MINOR] buffers: provide more functions to handle buffer data

buffer_contig_space(), buffer_contig_data() and buffer_skip()
provide easy methods to extract/insert data from/into a buffer.

buffer_write() and buffer_write_chunk() currently do not check
max_len nor to_forward, so they will quickly become embarrassing
to use or will need an equivalent. The reason is that they are
used to build error messages which currently are not subject to
analysis.

15 years ago[MAJOR] buffers: fix misuse of the BF_SHUTW_NOW flag
Willy Tarreau [Sun, 6 Sep 2009 19:37:23 +0000 (21:37 +0200)] 
[MAJOR] buffers: fix misuse of the BF_SHUTW_NOW flag

This flag was incorrectly used as meaning "close immediately",
while it needs to say "close ASAP". ASAP here means when unsent
data pending in the buffer are sent. This helps cleaning up some
dirty tricks where the buffer output was checking the BF_SHUTR
flag combined with EMPTY and other such things. Now we have a
clearly defined semantics :

  - producer sets SHUTR and *may* set SHUTW_NOW if WRITE_ENA is
    set, otherwise leave it to the session processor to set it.
  - consumer only checks SHUTW_NOW to decide whether or not to
    call shutw().

This also induced very minor changes at some locations which were
not protected against buffer changes while the SHUTW_NOW flag was
set. Now we prevent send_max from changing when the flag is set.

Several tests have been run without any unexpected behaviour detected.

Some more cleanups are needed, as it clearly appears that some tests
could be removed with stricter semantics.

15 years ago[MINOR] acl: add support for hdr_ip to match IP addresses in headers
Willy Tarreau [Sat, 19 Sep 2009 05:54:16 +0000 (07:54 +0200)] 
[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.

15 years ago[BUG] tarpit did not work anymore
Willy Tarreau [Sun, 30 Aug 2009 22:17:18 +0000 (00:17 +0200)] 
[BUG] tarpit did not work anymore

Tarpit was broken by recent splitting of analysers. It would still
let the connection go to the server due to a missing buffer_write_dis().
Also, it was performed too late (after content switching rules).

15 years ago[BUILD] compilation of haproxy-1.4-dev2 on FreeBSD
Dmitry Sivachenko [Mon, 24 Aug 2009 11:11:06 +0000 (15:11 +0400)] 
[BUILD] compilation of haproxy-1.4-dev2 on FreeBSD

Please consider the following patches. They are required to
compile haproxy-1.4-dev2 on FreeBSD.

Summary:
1) include <sys/types.h> before <netinet/tcp.h>
2) Use IPPROTO_TCP instead of SOL_TCP
(they are both defined as 6, TCP protocol number)

15 years ago[MEDIUM] remove TCP_CORK and make use of MSG_MORE instead
Willy Tarreau [Wed, 19 Aug 2009 09:14:11 +0000 (11:14 +0200)] 
[MEDIUM] remove TCP_CORK and make use of MSG_MORE instead

send() supports the MSG_MORE flag on Linux, which does the same
as TCP_CORK except that we don't have to remove TCP_NODELAY before
and we don't need any syscall to set/remove it. This can save up
to 4 syscalls around a send() (two for setting it, two for removing
it), and it's much cleaner since it is not persistent. So make use
of it instead.

15 years ago[CLEANUP] remove ifdef MSG_NOSIGNAL and define it instead
Willy Tarreau [Wed, 19 Aug 2009 09:22:33 +0000 (11:22 +0200)] 
[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.

15 years ago[MEDIUM] stream_interface: add and use ->update function to resync
Willy Tarreau [Tue, 18 Aug 2009 05:38:19 +0000 (07:38 +0200)] 
[MEDIUM] stream_interface: add and use ->update function to resync

We used to call stream_sock_data_finish() directly at the end of
a session update, but if we want to support non-socket interfaces,
we need to have this function configurable. Now we access it via
->update().

15 years ago[MEDIUM] report error on buffer writes larger than buffer size
Willy Tarreau [Tue, 18 Aug 2009 05:19:39 +0000 (07:19 +0200)] 
[MEDIUM] report error on buffer writes larger than buffer size

Since it's now possible to change the buffer size by configuration,
we have to take special measures against writes that are larger than
the buffer size. Before this patch, the writers would indefinitely
block, waiting for some space to free up.

With this patch, the functions simply reject the data with an
appropriate code so that the writers can either detect and process
the error or go on, but never remain blocked.

This has been tested on the stats page which does no longer hang
with buffer sizes smaller than 2.5 kB (256 bytes is even OK for
the CSV version).

15 years ago[MEDIUM] make it possible to change the buffer size in the configuration
Willy Tarreau [Mon, 17 Aug 2009 05:23:33 +0000 (07:23 +0200)] 
[MEDIUM] make it possible to change the buffer size in the configuration

The new tune.bufsize and tune.maxrewrite global directives allow one to
change the buffer size and the maxrewrite size. Right now, setting bufsize
too low will block stats sockets which will not be able to write at all.
An error checking must be added to buffer_write_chunk() so that if it
cannot write its message to an empty buffer, it causes the caller to abort.

15 years ago[MEDIUM] replace BUFSIZE with buf->size in computations
Willy Tarreau [Sun, 16 Aug 2009 21:27:46 +0000 (23:27 +0200)] 
[MEDIUM] replace BUFSIZE with buf->size in computations

The first step towards dynamic buffer size consists in removing
all static definitions of the buffer size. Instead, we store a
buffer's size in itself. Right now they're all preinitialized
to BUFSIZE, but we will change that.

15 years ago[MEDIUM] set rep->analysers from fe and be analysers
Willy Tarreau [Sun, 16 Aug 2009 20:57:50 +0000 (22:57 +0200)] 
[MEDIUM] set rep->analysers from fe and be analysers

sess_establish() used to resort to protocol-specific guesses
in order to set rep->analysers. This is no longer needed as it
gets set from the frontend and the backend as a copy of what
was defined in the configuration.

15 years ago[MINOR] set s->srv_error according to the analysers
Willy Tarreau [Sun, 16 Aug 2009 20:45:38 +0000 (22:45 +0200)] 
[MINOR] set s->srv_error according to the analysers

s->srv_error was set depending on the frontend's protocol. Now it is
set by the HTTP analyser, so that even when switching from a TCP
frontend to an HTTP backend, we can have HTTP error messages.

15 years ago[MINOR] cleanup set_session_backend by using pre-computed analysers
Willy Tarreau [Sun, 16 Aug 2009 20:37:44 +0000 (22:37 +0200)] 
[MINOR] cleanup set_session_backend by using pre-computed analysers

Analyser bitmaps are now stored in the frontend and backend, and
combined at configuration time. That way, set_session_backend()
does not need to perform any protocol-specific combinations.

15 years ago[MINOR] move the initial task's nice value to the listener
Willy Tarreau [Sun, 16 Aug 2009 17:12:36 +0000 (19:12 +0200)] 
[MINOR] move the initial task's nice value to the listener

Since the listener is the one indicating what analyser and session
handlers to call, it makes sense that it also sets the task's nice
value. This also helps getting rid of the last trace of the stats
in the proto_uxst file.

15 years ago[CLEANUP] move remaining stats sockets code to dumpstats
Willy Tarreau [Sun, 16 Aug 2009 17:06:42 +0000 (19:06 +0200)] 
[CLEANUP] move remaining stats sockets code to dumpstats

The remains of the stats socket code has nothing to do in proto_uxst
anymore and must move to dumpstats. The code is much cleaner and more
structured. It was also an opportunity to rename AN_REQ_UNIX_STATS
as AN_REQ_STATS_SOCK as the stats socket is no longer unix-specific
either.

The last item refering to stats in proto_uxst is the setting of the
task's nice value which should in fact come from the listener.

15 years ago[CLEANUP] unix: remove uxst_process_session()
Willy Tarreau [Sun, 16 Aug 2009 16:54:47 +0000 (18:54 +0200)] 
[CLEANUP] unix: remove uxst_process_session()

This one is not used anymore.

15 years ago[MEDIUM] make the unix stats sockets use the generic session handler
Willy Tarreau [Sun, 16 Aug 2009 16:51:29 +0000 (18:51 +0200)] 
[MEDIUM] make the unix stats sockets use the generic session handler

process_session() is now ready to handle unix stats sockets. This
first step works and old code has not been removed. A cleanup is
required. The stats handler is not unix socket-centric anymore and
should move to dumpstats.c.

15 years ago[MINOR] session: switch to established state if no connect function
Willy Tarreau [Sun, 16 Aug 2009 16:27:24 +0000 (18:27 +0200)] 
[MINOR] session: switch to established state if no connect function

When a stream interface has no connect() function, it means it is
immediately connected, so we don't need any connection request.
This will be used with unix sockets.

15 years ago[MEDIUM] session: account per-listener connections
Willy Tarreau [Sun, 16 Aug 2009 16:20:44 +0000 (18:20 +0200)] 
[MEDIUM] session: account per-listener connections

In order to merge the unix session handling code, we have to maintain
the number of per-listener connections in the session. This was only
performed for unix sockets till now.

15 years ago[MEDIUM] make the global stats socket part of a frontend
Willy Tarreau [Sun, 16 Aug 2009 15:41:45 +0000 (17:41 +0200)] 
[MEDIUM] make the global stats socket part of a frontend

Creating a frontend for the global stats socket will help merge
unix sockets management with the other socket management. Since
frontends are huge structs, we only allocate it if required.

15 years ago[MEDIUM] move connection establishment from backend to the SI.
Willy Tarreau [Sun, 16 Aug 2009 12:02:45 +0000 (14:02 +0200)] 
[MEDIUM] move connection establishment from backend to the SI.

The connection establishment was completely handled by backend.c which
normally just handles LB algos. Since it's purely TCP, it must move to
proto_tcp.c. Also, instead of calling it directly, we now call it via
the stream interface, which will later help us unify session handling.

15 years ago[BUILD] fix build for systems without SOL_TCP
Willy Tarreau [Sun, 16 Aug 2009 12:13:47 +0000 (14:13 +0200)] 
[BUILD] fix build for systems without SOL_TCP

Andrew Azarov reported that haproxy-1.4-dev1 does not build
under FreeBSD 7.2 because SOL_TCP is not defined. So add a
check for its definition before using it. This only impacts
network optimisations anyway.

15 years ago[MEDIUM] remove old experimental tcpsplice option
Willy Tarreau [Sun, 16 Aug 2009 11:20:32 +0000 (13:20 +0200)] 
[MEDIUM] remove old experimental tcpsplice option

This Linux-specific option was never really used in production and
has since been superseded by new splicing options brought by recent
Linux kernels.

It caused several particular cases in the code because the kernel
would take care of the session without haproxy being able to do
anything on it, which became hard to handle in the new architecture.

Let's simply get rid of it now that there is a replacement available.

15 years ago[MINOR] stats: add a new node-name setting
Willy Tarreau [Sun, 16 Aug 2009 08:29:18 +0000 (10:29 +0200)] 
[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.

15 years ago[MINOR] export the hostname variable so that all the code can access it
Willy Tarreau [Sun, 16 Aug 2009 08:08:02 +0000 (10:08 +0200)] 
[MINOR] export the hostname variable so that all the code can access it

The hostname variable will be used later, export it.

15 years ago[RELEASE] Released version 1.4-dev2 v1.4-dev2
Willy Tarreau [Sun, 9 Aug 2009 20:57:09 +0000 (22:57 +0200)] 
[RELEASE] Released version 1.4-dev2

Released version 1.4-dev2 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

15 years ago[BUG] log: option tcplog would log to global if no logger was defined
Willy Tarreau [Sun, 9 Aug 2009 08:11:45 +0000 (10:11 +0200)] 
[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.

15 years ago[BUG] task: fix possible crash when some timeouts are not configured
Willy Tarreau [Sun, 9 Aug 2009 07:09:54 +0000 (09:09 +0200)] 
[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 !

15 years ago[RELEASE] Released version 1.4-dev1 v1.4-dev1
Willy Tarreau [Wed, 29 Jul 2009 20:38:32 +0000 (22:38 +0200)] 
[RELEASE] Released version 1.4-dev1

Released version 1.4-dev1 with the following main changes :
    - [MINOR] acl: add support for matching of RDP cookies
    - [MEDIUM] add support for RDP cookie load-balancing
    - [MEDIUM] add support for RDP cookie persistence
    - [MINOR] add a new CLF log format
    - [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
    - [MINOR] config: track "no option"/"option" changes
    - [MINOR] config: support resetting options do default values
    - [MEDIUM] implement option tcp-smart-accept at the frontend
    - [MEDIUM] stream_sock: implement tcp-cork for use during shutdowns on Linux
    - [MEDIUM] implement tcp-smart-connect option at the backend
    - [MEDIUM] add support for TCP MSS adjustment for listeners
    - [MEDIUM] support setting a server weight to zero
    - [MINOR] make DEFAULT_MAXCONN user-configurable at build time
    - [MAJOR] session: don't clear buffer status flags anymore
    - [MAJOR] session: only check for timeouts when they have just occurred.
    - [MAJOR] session: simplify buffer error handling
    - [MEDIUM] config: split parser and checker in two functions
    - [MEDIUM] config: support loading multiple configuration files
    - [MEDIUM] stream_sock: don't close prematurely when nolinger is set
    - [MEDIUM] session: rework buffer analysis to permit permanent analysers
    - [MEDIUM] splice: set the capability on each stream_interface
    - [BUG] http: redirect rules were processed too early
    - [CLEANUP] remove unused DEBUG_PARSE_NO_SPEEDUP define
    - [MEDIUM] http: split request waiter from request processor
    - [MEDIUM] session: tell analysers what bit they were called for
    - [MAJOR] http: complete splitting of the remaining stages
    - [MINOR] report in the proxies the requirements for ACLs
    - [MINOR] http: rely on proxy->acl_requires to allocate hdr_idx
    - [MINOR] acl: add HTTP protocol detection (req_proto_http)
    - [MINOR] prepare callers of session_set_backend to handle errors
    - [BUG] default ACLs did not properly set the ->requires flag
    - [MEDIUM] allow a TCP frontend to switch to an HTTP backend
    - [MINOR] ensure we can jump from swiching rules to http without data
    - [MINOR] http: take http request timeout from the backend
    - [MINOR] allow TCP inspection rules to make use of HTTP ACLs
    - [BUILD] report commit date and not author's date as build date
    - [MINOR] acl: don't complain anymore when using L7 acls in TCP
    - [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] apply tcp-smart-connect option for the checks too
    - [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

15 years ago[BUG] fix random pauses on last segment of a series
Willy Tarreau [Mon, 27 Jul 2009 18:08:06 +0000 (20:08 +0200)] 
[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.

15 years ago[BUILD] fix incorrect printf arg count with tcp_splice
Willy Tarreau [Sun, 26 Jul 2009 18:40:05 +0000 (20:40 +0200)] 
[BUILD] fix incorrect printf arg count with tcp_splice

remove an extra arg.

15 years ago[MINOR] acl: detect and report potential mistakes in ACLs
Willy Tarreau [Sun, 26 Jul 2009 17:40:40 +0000 (19:40 +0200)] 
[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.

15 years ago[MINOR] print usage on the stats sockets upon invalid commands
Willy Tarreau [Sun, 26 Jul 2009 16:16:43 +0000 (18:16 +0200)] 
[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.

15 years ago[CLEANUP] report 2009 not 2008 in the copyright banner.
Willy Tarreau [Thu, 23 Jul 2009 11:45:47 +0000 (13:45 +0200)] 
[CLEANUP] report 2009 not 2008 in the copyright banner.

15 years ago[BUILD] use "git cmd" instead of "git-cmd"
Willy Tarreau [Thu, 23 Jul 2009 11:43:33 +0000 (13:43 +0200)] 
[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".

15 years ago[BUILD] fix a minor build warning on AIX
Willy Tarreau [Thu, 23 Jul 2009 11:40:20 +0000 (13:40 +0200)] 
[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'

15 years ago[MINOR] config: improve error reporting when checking configuration
Willy Tarreau [Thu, 23 Jul 2009 11:36:36 +0000 (13:36 +0200)] 
[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.

15 years ago[MINOR] config: the "capture" keyword is not allowed in backends
Willy Tarreau [Thu, 23 Jul 2009 11:24:23 +0000 (13:24 +0200)] 
[MINOR] config: the "capture" keyword is not allowed in backends

The "capture" keyword is only supported by frontends, fix the check.

15 years ago[MINOR] config: improve error reporting in listen sections
Willy Tarreau [Thu, 23 Jul 2009 11:19:11 +0000 (13:19 +0200)] 
[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.

15 years ago[MINOR] config: improve error reporting in global section
Willy Tarreau [Mon, 20 Jul 2009 07:30:05 +0000 (09:30 +0200)] 
[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.

16 years ago[MINOR] stats: better displaying in MSIE
Willy Tarreau [Wed, 15 Jul 2009 08:07:05 +0000 (10:07 +0200)] 
[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.

16 years ago[MINOR] apply tcp-smart-connect option for the checks too
Willy Tarreau [Wed, 15 Jul 2009 05:16:31 +0000 (07:16 +0200)] 
[MINOR] apply tcp-smart-connect option for the checks too

We should respect tcp-smart-connect for checks too. First it reduces
the traffic, and second it ensures that the checks see the same thing
as the production traffic, which is better for debugging.

16 years ago[BUG] task: fix possible timer drift after update
Willy Tarreau [Tue, 14 Jul 2009 21:48:55 +0000 (23:48 +0200)] 
[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.

16 years ago[BUG] config: tcp-request content only accepts "if" or "unless"
Willy Tarreau [Tue, 14 Jul 2009 19:17:05 +0000 (21:17 +0200)] 
[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".

16 years ago[BUG] stream_sock: don't stop reading when the poller reports an error
Willy Tarreau [Tue, 14 Jul 2009 17:55:05 +0000 (19:55 +0200)] 
[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.

16 years ago[BUG] stream_sock: always shutdown(SHUT_WR) before closing
Willy Tarreau [Tue, 14 Jul 2009 17:21:50 +0000 (19:21 +0200)] 
[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.

16 years ago[MINOR] acl: don't complain anymore when using L7 acls in TCP
Willy Tarreau [Tue, 14 Jul 2009 11:53:17 +0000 (13:53 +0200)] 
[MINOR] acl: don't complain anymore when using L7 acls in TCP

Since TCP can now check contents using L7 acls, we must not
complain anymore.

16 years ago[BUILD] report commit date and not author's date as build date
Willy Tarreau [Tue, 14 Jul 2009 11:24:16 +0000 (13:24 +0200)] 
[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.

16 years ago[MINOR] add a new CLF log format
Emeric Brun [Tue, 30 Jun 2009 16:26:00 +0000 (18:26 +0200)] 
[MINOR] add a new CLF log format

Appending the "clf" word after "option httplog" turns the HTTP log
format into a CLF format, more suited for certain tools.

16 years ago[MEDIUM] add support for RDP cookie persistence
Emeric Brun [Tue, 30 Jun 2009 15:57:00 +0000 (17:57 +0200)] 
[MEDIUM] add support for RDP cookie persistence

The new statement "persist rdp-cookie" enables RDP cookie
persistence. The RDP cookie is then extracted from the RDP
protocol, and compared against available servers. If a server
matches the RDP cookie, then it gets the connection.

16 years ago[MEDIUM] add support for RDP cookie load-balancing
Emeric Brun [Tue, 30 Jun 2009 15:56:00 +0000 (17:56 +0200)] 
[MEDIUM] add support for RDP cookie load-balancing

This patch adds support for hashing RDP cookies in order to
use them as a load-balancing key. The new "rdp-cookie(name)"
load-balancing metric has to be used for this. It is still
mandatory to wait for an RDP cookie in the frontend, otherwise
it will randomly work.

16 years ago[MINOR] acl: add support for matching of RDP cookies
Emeric Brun [Tue, 30 Jun 2009 15:54:00 +0000 (17:54 +0200)] 
[MINOR] acl: add support for matching of RDP cookies

The RDP protocol is quite simple and documented, which permits
an easy detection and extraction of cookies. It can be useful
to match the MSTS cookie which can contain the username specified
by the client.

16 years ago[MINOR] allow TCP inspection rules to make use of HTTP ACLs
Willy Tarreau [Sun, 12 Jul 2009 08:10:05 +0000 (10:10 +0200)] 
[MINOR] allow TCP inspection rules to make use of HTTP ACLs

Since we can call the HTTP parser from TCP inspection rules, it makes
sense to be able to use the HTTP ACLs with it. That way, we can decide
from a TCP frontend to take a switching decision based on full layer7
decoding. This might be useful to perform layer7 content switching from
a layer4 frontend in fact. For instance, we might want to be able to
detect http/https on a frontend, but still switch to backend X or Y
depending on the Host header. Note that it is mandatory to wait for
an HTTP request otherwise the ACLs will randomly match.

16 years ago[MINOR] http: take http request timeout from the backend
Willy Tarreau [Sun, 12 Jul 2009 08:03:17 +0000 (10:03 +0200)] 
[MINOR] http: take http request timeout from the backend

Since we can now switch from TCP to HTTP, we need to be able to apply
the HTTP request timeout after switching. That means we need to take
it from the backend and not from the frontend. Since the backend points
to the frontend before switching, that changes nothing for the normal
case.

16 years ago[MINOR] ensure we can jump from swiching rules to http without data
Willy Tarreau [Sun, 12 Jul 2009 07:55:41 +0000 (09:55 +0200)] 
[MINOR] ensure we can jump from swiching rules to http without data

In case of switching from TCP to HTTP, we want the HTTP request timeout
to be properly initialized. For this, we have to jump to the analyser
without breaking out of the loop nor waiting for incoming data. The way
it is done right now is not particularly clean but it works.

A cleaner method might involve pushing function pointers into a circular
list.

16 years ago[MEDIUM] allow a TCP frontend to switch to an HTTP backend
Willy Tarreau [Sun, 12 Jul 2009 07:47:04 +0000 (09:47 +0200)] 
[MEDIUM] allow a TCP frontend to switch to an HTTP backend

This patch allows a TCP frontend to switch to an HTTP backend.
During the switch, missing structures are automatically allocated.
The HTTP parser is enabled so that the backend first waits for a
full HTTP request.

16 years ago[BUG] default ACLs did not properly set the ->requires flag
Willy Tarreau [Sun, 12 Jul 2009 07:21:30 +0000 (09:21 +0200)] 
[BUG] default ACLs did not properly set the ->requires flag

This bug caused session initialization not to always allocate
the hdr_idx struct for default ACLs involving HTTP content.

16 years ago[MINOR] prepare callers of session_set_backend to handle errors
Willy Tarreau [Sun, 12 Jul 2009 06:27:39 +0000 (08:27 +0200)] 
[MINOR] prepare callers of session_set_backend to handle errors

session_set_backend will soon have to allocate areas for HTTP
headers. We must ensure that the callers can handle an allocation
error.

16 years ago[MINOR] acl: add HTTP protocol detection (req_proto_http)
Willy Tarreau [Fri, 10 Jul 2009 22:06:00 +0000 (00:06 +0200)] 
[MINOR] acl: add HTTP protocol detection (req_proto_http)

Now that we can perform TCP-based content switching, it makes sense
to be able to detect HTTP traffic and act accordingly. We already
have an HTTP decoder, we just have to call it in order to detect HTTP
protocol. Note that since the decoder will automatically fill in the
interesting fields of the HTTP transaction, it would make sense to
use this parsing to extend HTTP matching to TCP.

16 years ago[MINOR] http: rely on proxy->acl_requires to allocate hdr_idx
Willy Tarreau [Fri, 10 Jul 2009 21:52:51 +0000 (23:52 +0200)] 
[MINOR] http: rely on proxy->acl_requires to allocate hdr_idx

Right now only HTTP proxies may use HTTP headers in ACLs, but
when this evolves, we'll need to be able to allocate the hdr_idx
on demand. The solution consists in allocating it only when it is
certain that at least one ACL requires HTTP parsing, regardless
of the mode the proxy is in. This is what is achieved by this
patch.

16 years ago[MINOR] report in the proxies the requirements for ACLs
Willy Tarreau [Fri, 10 Jul 2009 18:53:53 +0000 (20:53 +0200)] 
[MINOR] report in the proxies the requirements for ACLs

This patch propagates the ACL conditions' "requires" bitfield
to the proxies. This makes it possible to know exactly what a
proxy might have to support for any request, which helps knowing
whether we have to allocate some space for certain types of
structures or not (eg: the hdr_idx struct).

The concept might be extended to a lot more types of information,
such as detecting whether we need to allocate some space for some
request ACLs which need a result in the response, etc...

16 years ago[MAJOR] http: complete splitting of the remaining stages
Willy Tarreau [Tue, 7 Jul 2009 13:10:31 +0000 (15:10 +0200)] 
[MAJOR] http: complete splitting of the remaining stages

The HTTP processing has been splitted into 7 steps, one of which
is not anymore HTTP-specific (content-switching). That way, it
becomes possible to use "use_backend" rules in TCP mode. A new
"use_server" directive should follow soon.

16 years ago[MEDIUM] session: tell analysers what bit they were called for
Willy Tarreau [Tue, 7 Jul 2009 08:55:49 +0000 (10:55 +0200)] 
[MEDIUM] session: tell analysers what bit they were called for

Some stream analysers might become generic enough to be called
for several bits. So we cannot have the analyser bit hard coded
into the analyser itself. Let's make the caller inform the callee.

16 years ago[MEDIUM] http: split request waiter from request processor
Willy Tarreau [Tue, 7 Jul 2009 08:14:51 +0000 (10:14 +0200)] 
[MEDIUM] http: split request waiter from request processor

We want to split several steps in HTTP processing so that
we can call individual analysers depending on what processing
we want to perform. The first step consists in splitting the
part that waits for a request from the rest.

16 years ago[CLEANUP] remove unused DEBUG_PARSE_NO_SPEEDUP define
Willy Tarreau [Tue, 7 Jul 2009 06:56:15 +0000 (08:56 +0200)] 
[CLEANUP] remove unused DEBUG_PARSE_NO_SPEEDUP define

This one has become useless with the new HTTP parser.

16 years ago[BUG] http: redirect rules were processed too early
Willy Tarreau [Mon, 6 Jul 2009 14:34:52 +0000 (16:34 +0200)] 
[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.

16 years ago[MEDIUM] splice: set the capability on each stream_interface
Willy Tarreau [Sun, 28 Jun 2009 21:10:19 +0000 (23:10 +0200)] 
[MEDIUM] splice: set the capability on each stream_interface

The splice code did not consider compatibility between both ends
of the connection. Now we set different capabilities on each
stream interface, depending on what the protocol can splice to/from.
Right now, only TCP is supported. Thanks to this, we're now able to
automatically detect when splice() is not implemented and automatically
disable it on one end instead of reporting errors to the upper layer.