]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
15 years ago[MEDIUM] http: don't switch to tunnel mode upon close
Willy Tarreau [Sat, 16 Jan 2010 22:19:39 +0000 (23:19 +0100)] 
[MEDIUM] http: don't switch to tunnel mode upon close

The close mode of a transaction would be switched to tunnel mode
at the end of the processing, letting a lot of pending data pass
in the other direction if any. Let's fix that by checking for the
close mode during state resync too.

15 years ago[BUG] http: don't count req errors on client resets or t/o during keep-alive
Willy Tarreau [Sat, 16 Jan 2010 09:26:19 +0000 (10:26 +0100)] 
[BUG] http: don't count req errors on client resets or t/o during keep-alive

We must set the error flags when detecting that a client has reset
a connection or timed out while waiting for a new request on a keep-alive
connection, otherwise process_session() sets it itself and counts one
request error.

That explains why some sites were showing an increase in request errors
with the keep-alive.

15 years ago[OPTIM] stream_sock: don't shutdown(write) when the socket is in error
Willy Tarreau [Sat, 16 Jan 2010 09:03:45 +0000 (10:03 +0100)] 
[OPTIM] stream_sock: don't shutdown(write) when the socket is in error

We get a lot of those, especially with web crawlers :

recv(2, 0x810b610, 7000, 0)             = -1 ECONNRESET (Connection reset by peer)
shutdown(2, 1 /* send */)               = -1 ENOTCONN (Transport endpoint is not connected)
close(2)                                = 0

There's no need to perform the shutdown() here, the socket is already
in error so it is down.

15 years ago[BUG] buffers: remove remains of wrong obsolete length check
Willy Tarreau [Fri, 15 Jan 2010 22:38:27 +0000 (23:38 +0100)] 
[BUG] buffers: remove remains of wrong obsolete length check

A check was performed in buffer_replace2() to compare buffer
length with its read pointer. This has been wrong for a long
time, though it only has an impact when dealing with keep-alive
requests/responses. In theory this should be backported but
the check has no impact without keep-alive.

15 years ago[BUG] check: we must not check for error before reading a response
Willy Tarreau [Fri, 15 Jan 2010 09:35:58 +0000 (10:35 +0100)] 
[BUG] check: we must not check for error before reading a response

We can receive data with a notification of socket error. But we
must not check for the error before reading the data, because it
may be an asynchronous error notification that we check too early
while the response we're waiting for is available. If there is an
error, recv() will get it.

This should help with servers that close very fast after the response
and should also slightly lower the CPU usage during very fast checks
on massive amounts of servers since we eliminate one system call.

This should probably be backported to 1.3.

15 years ago[CLEANUP] stream_sock: MSG_NOSIGNAL is only for send(), not recv()
Willy Tarreau [Fri, 15 Jan 2010 09:26:13 +0000 (10:26 +0100)] 
[CLEANUP] stream_sock: MSG_NOSIGNAL is only for send(), not recv()

We must not set this flag on recv(), it's not used, it's just for
send().

15 years ago[BUG] checks: chars are unsigned on AIX, check was always true
Willy Tarreau [Thu, 14 Jan 2010 10:41:31 +0000 (11:41 +0100)] 
[BUG] checks: chars are unsigned on AIX, check was always true

Use '\xff' instead of -1 for a character test.

15 years ago[BUILD] remove a warning in standard.h on AIX
Willy Tarreau [Thu, 14 Jan 2010 10:40:12 +0000 (11:40 +0100)] 
[BUILD] remove a warning in standard.h on AIX

15 years ago[MINOR] acl: add fe_id/so_id to match frontend's and socket's id
Krzysztof Piotr Oledzki [Tue, 12 Jan 2010 20:59:30 +0000 (21:59 +0100)] 
[MINOR] acl: add fe_id/so_id to match frontend's and socket's id

15 years ago[DOC] add the doc about stickiness
Willy Tarreau [Tue, 12 Jan 2010 14:27:54 +0000 (15:27 +0100)] 
[DOC] add the doc about stickiness

15 years ago[MEDIUM] Add stick and store rules analysers.
Emeric Brun [Mon, 4 Jan 2010 14:47:17 +0000 (15:47 +0100)] 
[MEDIUM] Add stick and store rules analysers.

15 years ago[MEDIUM] Add stick table configuration and init.
Emeric Brun [Mon, 4 Jan 2010 14:45:53 +0000 (15:45 +0100)] 
[MEDIUM] Add stick table configuration and init.

15 years ago[MEDIUM] Add src dst and dport pattern fetches.
Emeric Brun [Mon, 4 Jan 2010 14:47:45 +0000 (15:47 +0100)] 
[MEDIUM] Add src dst and dport pattern fetches.

15 years ago[MEDIUM] Add pattern fetch management types and functions
Emeric Brun [Mon, 4 Jan 2010 15:16:05 +0000 (16:16 +0100)] 
[MEDIUM] Add pattern fetch management types and functions

15 years ago[MEDIUM] Add stick table (persistence) management functions and types
Emeric Brun [Mon, 4 Jan 2010 14:23:48 +0000 (15:23 +0100)] 
[MEDIUM] Add stick table (persistence) management functions and types

15 years ago[MINOR] Add function to parse a size in configuration
Emeric Brun [Mon, 4 Jan 2010 13:57:24 +0000 (14:57 +0100)] 
[MINOR] Add function to parse a size in configuration

15 years ago[DOC] remove several trailing spaces
Willy Tarreau [Tue, 12 Jan 2010 09:42:19 +0000 (10:42 +0100)] 
[DOC] remove several trailing spaces

15 years ago[DOC] fix various too large lines
Willy Tarreau [Mon, 11 Jan 2010 17:42:06 +0000 (18:42 +0100)] 
[DOC] fix various too large lines

15 years ago[MINOR] add option "mysql-check" to use MySQL health checks
Hervé COMMOWICK [Tue, 12 Jan 2010 08:25:13 +0000 (09:25 +0100)] 
[MINOR] add option "mysql-check" to use MySQL health checks

This patch adds support for MySQL health checks. Those are
enabled using the new option "mysql-check".

15 years ago[BUG] checks: fix newline termination
Krzysztof Piotr Oledzki [Mon, 11 Jan 2010 12:16:27 +0000 (13:16 +0100)] 
[BUG] checks: fix newline termination

We can't put a newline in server_status_printf() as there might be
something added later.

15 years ago[OPTIM] remove SSP_O_VIA and SSP_O_STATUS
Krzysztof Piotr Oledzki [Mon, 11 Jan 2010 10:13:39 +0000 (11:13 +0100)] 
[OPTIM] remove SSP_O_VIA and SSP_O_STATUS

There is a smarter way to do this, so both options are no longer
necessary.

15 years ago[BUG] health checks: fix requeued message
Krzysztof Piotr Oledzki [Sun, 10 Jan 2010 20:12:58 +0000 (21:12 +0100)] 
[BUG] health checks: fix requeued message

Dummy copy&past is not a good idea. :( Also, we shoud
check "s->state & SRV_RUNNING" instead of xferred.

15 years ago[MINOR] config: remove undocumented and buggy 'timeout appsession'
Willy Tarreau [Sun, 10 Jan 2010 16:48:11 +0000 (17:48 +0100)] 
[MINOR] config: remove undocumented and buggy 'timeout appsession'

This one has never really worked and is not documented.

15 years ago[MINOR] config: don't accept 'appsession' in defaults section
Cyril Bonté [Sun, 10 Jan 2010 16:01:47 +0000 (17:01 +0100)] 
[MINOR] config: don't accept 'appsession' in defaults section

Maybe appsession should be forbidden in the 'defaults' section as it
will not work in the backends.

15 years ago[MINOR] http: add a separate "http-keep-alive" timeout
Willy Tarreau [Sun, 10 Jan 2010 13:46:16 +0000 (14:46 +0100)] 
[MINOR] http: add a separate "http-keep-alive" timeout

This one is used to wait for next request after a response was sent
to the client.

15 years ago[MINOR] http: differentiate waiting for new request and waiting for a complete requst
Willy Tarreau [Sun, 10 Jan 2010 13:21:19 +0000 (14:21 +0100)] 
[MINOR] http: differentiate waiting for new request and waiting for a complete requst

While waiting in a keep-alive state for a request, we want to silently
close if we don't get anything. However if we get a partial request it's
different because that means the client has started to send something.
This requires a new transaction flag. It will be used to implement a
distinct timeout for keep-alive and requests.

15 years ago[OPTIM] reorder http_txn to optimize cache lines placement
Willy Tarreau [Sun, 10 Jan 2010 10:31:22 +0000 (11:31 +0100)] 
[OPTIM] reorder http_txn to optimize cache lines placement

This re-ordering brings about 3% of performance boost on x86_64
on pipeline intensive requests, which means it mainly benefits
the parsers.

15 years ago[MINOR] http: move appsession 'sessid' from session to http_txn
Willy Tarreau [Sun, 10 Jan 2010 09:49:11 +0000 (10:49 +0100)] 
[MINOR] http: move appsession 'sessid' from session to http_txn

This change, suggested by Cyril Bonté, makes a lot of sense and
would have made it obvious that sessid was not properly initialized
while switching to keep-alive. The code is now cleaner.

15 years ago[MINOR] http redirect: don't explicitly state keep-alive on 1.1
Willy Tarreau [Sun, 10 Jan 2010 09:35:01 +0000 (10:35 +0100)] 
[MINOR] http redirect: don't explicitly state keep-alive on 1.1

Do not set the "connection: keep-alive" header when the request is in
HTTP 1.1, it's implicit.

15 years ago[BUG] stream_interface: fix retnclose and remove cond_close
Willy Tarreau [Sun, 10 Jan 2010 09:21:21 +0000 (10:21 +0100)] 
[BUG] stream_interface: fix retnclose and remove cond_close

The stream_int_cond_close() function was added to preserve the
contents of the response buffer because stream_int_retnclose()
was buggy. It flushed the response instead of flushing the
request. This caused issues with pipelined redirects followed
by error messages which ate the previous response.

This might even have caused object truncation on pipelined
requests followed by an error or by a server redirection.

Now that this is fixed, simply get rid of the now useless
function.

15 years ago[BUG] appsession: possible memory leak in case of out of memory condition
Cyril Bonté [Sat, 9 Jan 2010 23:30:14 +0000 (00:30 +0100)] 
[BUG] appsession: possible memory leak in case of out of memory condition

I've tried to follow all the pool_alloc2/pool_free2 calls in the code
to track memory leaks. I've found one which only happens when there's
already no more memory when allocating a new appsession cookie.

15 years ago[MINOR] http redirect: add the ability to append a '/' to the URL
Willy Tarreau [Sat, 9 Jan 2010 23:42:19 +0000 (00:42 +0100)] 
[MINOR] http redirect: add the ability to append a '/' to the URL

Sometimes it can be desired to return a location which is the same
as the request with a slash appended when there was not one in the
request. A typical use of this is for sending a 301 so that people
don't reference links without the trailing slash. The name of the
new option is "append-slash" and it can be used on "redirect"
statements in prefix mode.

15 years ago[MINOR] http: fix double slash prefix with server redirect
Willy Tarreau [Sat, 9 Jan 2010 23:24:22 +0000 (00:24 +0100)] 
[MINOR] http: fix double slash prefix with server redirect

When using server redirection, it is possible to specify a path
consisting of only one slash. While this is discouraged (risk of
loop) it may sometimes be useful combined with content switching.
The prefixing of a '/' then causes two slashes to be returned in
the response. So we now do as with the other redirects, don't
prepend a slash if it's alone.

15 years ago[MEDIUM] http: fix handling of message pointers
Willy Tarreau [Sat, 9 Jan 2010 23:15:35 +0000 (00:15 +0100)] 
[MEDIUM] http: fix handling of message pointers

Some message pointers were not usable once the message reached the
HTTP_MSG_DONE state. This is the case for ->som which points to the
body because it is needed to parse chunks. There is one case where
we need the beginning of the message : server redirect. We have to
call http_get_path() after the request has been parsed. So we rely
on ->sol without counting on ->som. In order to achieve this, we're
making ->rq.{u,v} relative to the beginning of the message instead
of the buffer. That simplifies the code and makes it cleaner.

Preliminary tests show this is OK.

15 years ago[BUG] server redirection used an uninitialized string.
Willy Tarreau [Sat, 9 Jan 2010 20:29:23 +0000 (21:29 +0100)] 
[BUG] server redirection used an uninitialized string.

This might have been introduced with chunk extensions. Note that
the server redirect still does not work because http_get_path()
cannot get the correct path once the request message is in the
HTTP_MSG_DONE state (->som does not point to the start of message
anymore).

15 years ago[BUILD] appsession did not build anymore under gcc-2.95
Willy Tarreau [Sat, 9 Jan 2010 18:23:06 +0000 (19:23 +0100)] 
[BUILD] appsession did not build anymore under gcc-2.95

15 years ago[BUG] appsession's sessid must be reset at end of transaction
Willy Tarreau [Sat, 9 Jan 2010 12:57:26 +0000 (13:57 +0100)] 
[BUG] appsession's sessid must be reset at end of transaction

If we don't do that, we may corrupt the pools in keep-alive sessions.

15 years ago[RELEASE] Released version 1.4-dev6 v1.4-dev6
Willy Tarreau [Fri, 8 Jan 2010 06:49:44 +0000 (07:49 +0100)] 
[RELEASE] Released version 1.4-dev6

Released version 1.4-dev6 with the following main changes :
    - [BUILD] warning in stream_interface.h
    - [BUILD] warning ultoa_r returns char *
    - [MINOR] hana: only report stats if it is enabled
    - [MINOR] stats: add "a link" & "a href" for sockets
    - [MINOR]: stats: add show-legends to report additional informations
    - [MEDIUM] default-server support
    - [BUG]: add 'observer', 'on-error', 'error-limit' to supported options list
    - [MINOR] stats: add href to tracked server
    - [BUG] stats: show UP/DOWN status also in tracking servers
    - [DOC] Restore ability to search a keyword at the beginning of a line
    - [BUG] stats: cookie should be reported under backend not under proxy
    - [BUG] cfgparser/stats: fix error message
    - [BUG] http: disable auto-closing during chunk analysis
    - [BUG] http: fix hopefully last closing issue on data forwarding
    - [DEBUG] add an http_silent_debug function to debug HTTP states
    - [MAJOR] http: fix again the forward analysers
    - [BUG] http_process_res_common() must not skip the forward analyser
    - [BUG] http: some possible missed close remain in the forward chain
    - [BUG] http: redirect needed to be updated after recent changes
    - [BUG] http: don't set no-linger on response in case of forced close
    - [MEDIUM] http: restore the original behaviour of option httpclose
    - [TESTS] add a file to test various connection modes
    - [BUG] http: check options before the connection header
    - [MAJOR] session: fix the order by which the analysers are run
    - [MEDIUM] session: also consider request analysers added during response
    - [MEDIUM] http: make safer use of the DONT_READ and AUTO_CLOSE flags
    - [BUG] http: memory leak with captures when using keep-alive
    - [BUG] http: fix for capture memory leak was incorrect
    - [MINOR] http redirect: use proper call to return last response
    - [MEDIUM] http: wait for some flush of the response buffer before a new request
    - [MEDIUM] session: limit the number of analyser loops

15 years ago[MEDIUM] session: limit the number of analyser loops
Willy Tarreau [Thu, 7 Jan 2010 23:32:27 +0000 (00:32 +0100)] 
[MEDIUM] session: limit the number of analyser loops

The initial code's intention was to loop on the analysers as long
as an analyser is added by another one. [This code was wrong due to
the while(0) which breaks even on a continue statement, but the
initial intention must be changed too]. In fact we should limit the
number of times we loop on analysers in order to limit latency.
Using maxpollevents as a limit makes sense since this tunable is
used for the exact same purposes. We may add another tunable later
if that ever makes sense, so it's very unlikely.

15 years ago[MEDIUM] http: wait for some flush of the response buffer before a new request
Willy Tarreau [Thu, 7 Jan 2010 23:30:20 +0000 (00:30 +0100)] 
[MEDIUM] http: wait for some flush of the response buffer before a new request

If we accept a new request and that request produces an immediate
response (error, redirect, ...), then we may fail to send it in
case of pipelined requests if the response buffer is full. To avoid
this, we check the availability of at least maxrewrite bytes in the
response buffer before accepting a new pipelined request.

15 years ago[MINOR] http redirect: use proper call to return last response
Willy Tarreau [Thu, 7 Jan 2010 23:26:50 +0000 (00:26 +0100)] 
[MINOR] http redirect: use proper call to return last response

During a redirect, we used to send the last chunk of response with
stream_int_cond_close(). But this is wrong in case of pipeline,
because if the response already contains something, this function
will refrain from touching the buffer. Use a concatenation function
instead.

Also, this call might still fail when the buffer is full, we need
a second fix to refrain from parsing an HTTP request as long as the
response buffer is full, otherwise we may not even be able to return
a pending redirect or an error code.

15 years ago[BUG] http: fix for capture memory leak was incorrect
Willy Tarreau [Thu, 7 Jan 2010 21:51:47 +0000 (22:51 +0100)] 
[BUG] http: fix for capture memory leak was incorrect

That patch was incorrect because under some circumstances, the
capture memory could be freed by session_free() and then again
by http_end_txn(), causing a double free and an eventual segfault.
The pool use count was also reported wrong due to this bug.

The cleanup code was removed from session_free() to remain only
in http_end_txn().

15 years ago[BUG] http: memory leak with captures when using keep-alive
Willy Tarreau [Thu, 7 Jan 2010 12:35:21 +0000 (13:35 +0100)] 
[BUG] http: memory leak with captures when using keep-alive

Hank A. Paulson reported a massive memory leak when using keep-alive
mode. The information he provided made it easy to find that captured
request and response headers were erased but not released when renewing
a request.

15 years ago[BUG] cfgparser/stats: fix error message
Krzysztof Piotr Oledzki [Wed, 6 Jan 2010 15:25:05 +0000 (16:25 +0100)] 
[BUG] cfgparser/stats: fix error message

Fix the error message by unification and goto, previously we had
two independent lists of supported keywords and were raporting 'stats'
instead of a wrong keyword.

Code:
 stats wrong-keyword
 stats

Before:
 [ALERT] 005/163032 (27175) : parsing [haproxy.cfg:248] : unknown stats parameter 'stats' (expects 'hide-version', 'uri', 'realm', 'auth' or 'enable').
 [ALERT] 005/163032 (27175) : parsing [haproxy.cfg:249] : 'stats' expects 'uri', 'realm', 'auth', 'scope' or 'enable', 'hide-version', 'show-node', 'show-desc', 'show-legends'.

After:
 [ALERT] 005/162841 (22710) : parsing [haproxy.cfg:248]: unknown stats parameter 'wrong-keyword', expects 'uri', 'realm', 'auth', 'scope', 'enable', 'hide-version', 'show-node', 'show-desc' or 'show-legends'.
 [ALERT] 005/162841 (22710) : parsing [haproxy.cfg:249]: missing keyword in 'stats', expects 'uri', 'realm', 'auth', 'scope', 'enable', 'hide-version', 'show-node', 'show-desc' or 'show-legends'.

15 years ago[BUG] stats: cookie should be reported under backend not under proxy
Krzysztof Piotr Oledzki [Wed, 6 Jan 2010 14:03:18 +0000 (15:03 +0100)] 
[BUG] stats: cookie should be reported under backend not under proxy

15 years ago[DOC] Restore ability to search a keyword at the beginning of a line
Krzysztof Piotr Oledzki [Wed, 6 Jan 2010 09:50:42 +0000 (10:50 +0100)] 
[DOC] Restore ability to search a keyword at the beginning of a line

15 years ago[MEDIUM] http: make safer use of the DONT_READ and AUTO_CLOSE flags
Willy Tarreau [Wed, 6 Jan 2010 23:20:41 +0000 (00:20 +0100)] 
[MEDIUM] http: make safer use of the DONT_READ and AUTO_CLOSE flags

Several HTTP analysers used to set those flags to values that
were useful but without considering the possibility that they
were not called again to clean what they did. First, replace
direct flag manipulation with more explicit macros. Second,
enforce a rule stating that any buffer which changes one of
these flags from the default must restore it after completion,
so that other analysers see correct flags.

With both this fix and the previous one about analyser bits,
we should not see any more stuck sessions.

15 years ago[MEDIUM] session: also consider request analysers added during response
Willy Tarreau [Wed, 6 Jan 2010 23:09:04 +0000 (00:09 +0100)] 
[MEDIUM] session: also consider request analysers added during response

A request analyser may very well be added while processing a response
(eg: end of an HTTP keep-alive response). It's very dangerous to only
rely on flags that ought to change in order to loop back, so let's
correctly detect a possible new analyser addition instead of guessing.

15 years ago[MAJOR] session: fix the order by which the analysers are run
Willy Tarreau [Wed, 6 Jan 2010 22:53:24 +0000 (23:53 +0100)] 
[MAJOR] session: fix the order by which the analysers are run

With the introduction of keep-alive, we have created situations
where an analyser can add other analysers to the current list,
which are behind it, which have already been processed once, and
which are needed immediately because without them there will be
no more I/O activity. This is typically the case for enabling
reading of a new request after preparing for a new request.

Instead of creating specific cases for some analysers (there was
already one such before), we now use a little bit of algorithmics
to create an ordered bit chain supporting priorities and fast
operations.

Another advantage of this new construction is that it's not a
real loop anymore, so if an analyser is unknown, it will not
loop but just ignore it.

Note that it is easy to skip multiple analysers at once now in
order to speed up the checking a bit. Some test code has shown
a minor gain though.

This change has been carefully re-read and has no direct reason
of causing a regression. However it has been tagged "major"
because the fact that it runs the analysers correctly might
trigger an old sleeping bug somewhere in one of the analysers.

15 years ago[BUG] stats: show UP/DOWN status also in tracking servers
Krzysztof Piotr Oledzki [Tue, 5 Jan 2010 17:44:44 +0000 (18:44 +0100)] 
[BUG] stats: show UP/DOWN status also in tracking servers

It was broken since 0960541e496167f4cc5f89f114e027bf8f7f1ff0:
 [MEDIUM] Collect & show information about last health check, v3

15 years ago[MINOR] stats: add href to tracked server
Krzysztof Piotr Oledzki [Tue, 5 Jan 2010 17:33:01 +0000 (18:33 +0100)] 
[MINOR] stats: add href to tracked server

Each server has now a dedicated "a link" tag, so let's use it.

15 years ago[BUG]: add 'observer', 'on-error', 'error-limit' to supported options list
Krzysztof Piotr Oledzki [Tue, 5 Jan 2010 15:44:17 +0000 (16:44 +0100)] 
[BUG]: add 'observer', 'on-error', 'error-limit' to supported options list

15 years ago[MEDIUM] default-server support
Krzysztof Piotr Oledzki [Tue, 5 Jan 2010 15:38:49 +0000 (16:38 +0100)] 
[MEDIUM] default-server support

This patch implements default-server support allowing to change
default server options. It can be used in [defaults] or [backend]/[listen]
sections. Currently the following options are supported:

 - error-limit
 - fall
 - inter
 - fastinter
 - downinter
 - maxconn
 - maxqueue
 - minconn
 - on-error
 - port
 - rise
 - slowstart
 - weight

15 years ago[MINOR]: stats: add show-legends to report additional informations
Krzysztof Piotr Oledzki [Mon, 4 Jan 2010 15:03:09 +0000 (16:03 +0100)] 
[MINOR]: stats: add show-legends to report additional informations

Supported informations, available via "tr/td title":
  - cap: capabilities (proxy)
  - mode: one of tcp, http or health (proxy)
  - id: SNMP ID (proxy, socket, server)
  - IP (socket, server)
  - cookie (backend, server)

15 years ago[MINOR] stats: add "a link" & "a href" for sockets
Krzysztof Piotr Oledzki [Mon, 4 Jan 2010 10:33:32 +0000 (11:33 +0100)] 
[MINOR] stats: add "a link" & "a href" for sockets

This patch adds add "a link" & "a href" html tags for sockets.
As sockets may have the same name like servers, I decided to
add "+" char (forbidden in names assigned to servers), as a prefix.

15 years ago[MINOR] hana: only report stats if it is enabled
Krzysztof Piotr Oledzki [Sun, 3 Jan 2010 23:48:43 +0000 (00:48 +0100)] 
[MINOR] hana: only report stats if it is enabled

It is useless to report statistics if the feature was not enabled.

It also makes possible to distinguish if health analyses is
enabled or not only by looking at the stats page.

15 years ago[BUILD] warning ultoa_r returns char *
Emeric Brun [Mon, 4 Jan 2010 13:54:38 +0000 (14:54 +0100)] 
[BUILD] warning ultoa_r returns char *

ultoa_r modifies its output, it returns a char *.

15 years ago[BUILD] warning in stream_interface.h
Emeric Brun [Mon, 4 Jan 2010 13:47:58 +0000 (14:47 +0100)] 
[BUILD] warning in stream_interface.h

On some platforms, gcc complains about struct sockaddr.

15 years ago[BUG] http: check options before the connection header
Willy Tarreau [Tue, 5 Jan 2010 22:12:12 +0000 (23:12 +0100)] 
[BUG] http: check options before the connection header

Commit 0dfdf19b6438c2cea47b1dea0442d65bacfc77cf introduced a
regression because the connection header is now parsed and checked
depending on the configured options, but the options are set after
calling it instead of being set before.

15 years ago[TESTS] add a file to test various connection modes
Willy Tarreau [Tue, 5 Jan 2010 13:35:03 +0000 (14:35 +0100)] 
[TESTS] add a file to test various connection modes

15 years ago[MEDIUM] http: restore the original behaviour of option httpclose
Willy Tarreau [Tue, 5 Jan 2010 10:33:11 +0000 (11:33 +0100)] 
[MEDIUM] http: restore the original behaviour of option httpclose

Historically, "option httpclose" has always worked the same way. It
only mangles the "Connection" header in the request and the response
if needed, but does not affect the connection by itself, and ignores
any further data. It is dangerous to change this behaviour without
leaving any other alternative. If an active close is desired, it's
better to make use of "option forceclose" which does exactly what
it intends to do.

So as of now, "option httpclose" will only mangle the headers as
before, and will only affect the connection by itself when combined
with another connection-related option (eg: keepalive or server-close).

15 years ago[BUG] http: don't set no-linger on response in case of forced close
Willy Tarreau [Tue, 5 Jan 2010 10:06:20 +0000 (11:06 +0100)] 
[BUG] http: don't set no-linger on response in case of forced close

This is a copy-paste error, it must only apply to the request.

15 years ago[BUG] http: redirect needed to be updated after recent changes
Willy Tarreau [Mon, 4 Jan 2010 23:58:24 +0000 (00:58 +0100)] 
[BUG] http: redirect needed to be updated after recent changes

The data forwarding fixes broke http redirection which relied on
tricks.

15 years ago[BUG] http: some possible missed close remain in the forward chain
Willy Tarreau [Mon, 4 Jan 2010 22:13:26 +0000 (23:13 +0100)] 
[BUG] http: some possible missed close remain in the forward chain

We basically have to mimmic the code of process_session() here, so
when the remote output is closed, we must abort otherwise we'll end
up with data which cannot leave the buffer.

15 years ago[BUG] http_process_res_common() must not skip the forward analyser
Willy Tarreau [Mon, 4 Jan 2010 21:57:43 +0000 (22:57 +0100)] 
[BUG] http_process_res_common() must not skip the forward analyser

By default this function returned 0 indicating an end of analysis.
This was not a problem as long as it was the last analyser in the
chain but becomes quite a big one now since it skips the forwarder
with auto_close enabled, causing some data to pass under the nose
of the last one undetected.

15 years ago[MAJOR] http: fix again the forward analysers
Willy Tarreau [Mon, 4 Jan 2010 20:15:02 +0000 (21:15 +0100)] 
[MAJOR] http: fix again the forward analysers

There were still several situations leading to CLOSE_WAIT sockets
remaining there forever because some complex transitions were
obviously not caught due to the impossibility to resync changes
between the request and response FSMs.

This patch now centralizes the global transaction state and feeds
it from both request and response transitions. That way, whoever
finishes first, there will be no issue for converging to the correct
state.

Some heavy use of the new debugging function has helped a lot. Maybe
those calls could be removed after some time. First tests are very
positive.

15 years ago[DEBUG] add an http_silent_debug function to debug HTTP states
Willy Tarreau [Mon, 4 Jan 2010 20:13:14 +0000 (21:13 +0100)] 
[DEBUG] add an http_silent_debug function to debug HTTP states

This function outputs to fd #-1 the status of request and response
buffers, the transaction states, the stream interface states, etc...
That way, it's easy to find that output in an strace report, correctly
placed WRT the other syscalls.

15 years ago[BUG] http: fix hopefully last closing issue on data forwarding
Willy Tarreau [Mon, 4 Jan 2010 06:10:34 +0000 (07:10 +0100)] 
[BUG] http: fix hopefully last closing issue on data forwarding

The data forwarders are analysers. As such, the have to check for
various situations on which they have to abort, one of them being
the lack of data with closed input. Now we don't leave the functions
anymore without performing these checks. This has solved the new
CLOSE_WAIT issue that became more noticeable since last patch.

15 years ago[BUG] http: disable auto-closing during chunk analysis
Willy Tarreau [Mon, 4 Jan 2010 01:02:25 +0000 (02:02 +0100)] 
[BUG] http: disable auto-closing during chunk analysis

It may happen that we forward a close just after we sent the last
chunk, because we forgot to clear the AUTO_CLOSE flag.

This issue caused some pages to be truncated depending on some
timing races. Issue initially reported by Cyril Bonté.

15 years ago[RELEASE] Released version 1.4-dev5 v1.4-dev5
Willy Tarreau [Sun, 3 Jan 2010 22:23:36 +0000 (23:23 +0100)] 
[RELEASE] Released version 1.4-dev5

Released version 1.4-dev5 with the following main changes :
    - [MINOR] server tracking: don't care about the tracked server's mode
    - [MEDIUM] appsession: add "len", "prefix" and "mode" options
    - [MEDIUM] appsession: add the "request-learn" option
    - [BUG] Configuration parser bug when escaping characters
    - [MINOR] CSS & HTML fun
    - [MINOR] Collect & provide http response codes received from servers
    - [BUG] Fix silly typo: hspr_other -> hrsp_other
    - [MINOR] Add "a name" to stats page
    - [MINOR] add additional "a href"s to stats page
    - [MINOR] Collect & provide http response codes for frontends, fix backends
    - [DOC] some small spell fixes and unifications
    - [MEDIUM] Decrease server health based on http responses / events, version 3
    - [BUG] format '%d' expects type 'int', but argument 5 has type 'long int'
    - [BUG] config: fix erroneous check on cookie domain names, again
    - [BUG] Healthchecks: get a proper error code if connection cannot be completed immediately
    - [DOC] trivial fix for man page
    - [MINOR] config: report all supported options for the "bind" keyword
    - [MINOR] tcp: add support for the defer_accept bind option
    - [MINOR] unix socket: report the socket path in case of bind error
    - [CONTRIB] halog: support searching by response time
    - [DOC] add a reminder about obsolete documents
    - [DOC] point to 1.4 doc, not 1.3
    - [DOC] option tcp-smart-connect was missing from index
    - [MINOR] http: detect connection: close earlier
    - [CLEANUP] sepoll: clean up the fd_clr/fd_set functions
    - [OPTIM] move some rarely used fields out of fdtab
    - [MEDIUM] fd: merge fd_list into fdtab
    - [MAJOR] buffer: flag BF_DONT_READ to disable reads when not required
    - [MINOR] http: add new transaction flags for keep-alive and content-length
    - [MEDIUM] http request: parse connection, content-length and transfer-encoding
    - [MINOR] http request: update the TX_SRV_CONN_KA flag on rewrite
    - [MINOR] http request: simplify the test of no-data
    - [MEDIUM] http request: simplify POST length detection
    - [MEDIUM] http request: make use of pre-parsed transfer-encoding header
    - [MAJOR] http: create the analyser which waits for a response
    - [MINOR] http: pre-set the persistent flags in the transaction
    - [MEDIUM] http response: check body length and set transaction flags
    - [MINOR] http response: update the TX_CLI_CONN_KA flag on rewrite
    - [MINOR] http: remove the last call to stream_int_return
    - [IMPORT] import ebtree v5.0 into directory ebtree/
    - [MEDIUM] build: switch ebtree users to use new ebtree version
    - [CLEANUP] ebtree: remove old unused files
    - [BUG] definitely fix regparm issues between haproxy core and ebtree
    - [CLEANUP] ebtree: cast to char * to get rid of gcc warning
    - [BUILD] missing #ifndef in ebmbtree.h
    - [BUILD] missing #ifndef in ebsttree.h
    - [MINOR] tools: add hex2i() function to convert hex char to int
    - [MINOR] http: create new MSG_BODY sub-states
    - [BUG] stream_sock: BUF_INFINITE_FORWARD broke splice on 64-bit platforms
    - [DOC] option is "defer-accept", not "defer_accept"
    - [MINOR] http: keep pointer to beginning of data
    - [BUG] x-original-to: name was not set in default instance
    - [MINOR] http: detect tunnel mode and set it in the session
    - [BUG] config: fix error message when config file is not found
    - [BUG] config: fix wrong handling of too large argument count
    - [BUG] config: disable 'option httplog' on TCP proxies
    - [BUG] config: fix erroneous check on cookie domain names
    - [BUG] config: cookie domain was ignored in defaults sections
    - [MINOR] config: support passing multiple "domain" statements to cookies
    - [MINOR] ebtree: add functions to lookup non-null terminated strings
    - [MINOR] config: don't report error on all subsequent files on failure
    - [BUG] second fix for the printf format warning
    - [BUG] check_post: limit analysis to the buffer length
    - [MEDIUM] http: process request body in a specific analyser
    - [MEDIUM] backend: remove HTTP POST parsing from get_server_ph_post()
    - [MAJOR] http: completely process the "connection" header
    - [MINOR] http: only consider chunk encoding with HTTP/1.1
    - [MAJOR] buffers: automatically compute the maximum buffer length
    - [MINOR] http: move the http transaction init/cleanup code to proto_http
    - [MINOR] http: move 1xx handling earlier to eliminate a lot of ifs
    - [MINOR] http: introduce a new synchronisation state : HTTP_MSG_DONE
    - [MEDIUM] http: rework chunk-size parser
    - [MEDIUM] http: add a new transaction flags indicating if we know the transfer length
    - [MINOR] buffers: add buffer_ignore() to skip some bytes
    - [BUG] http: offsets are relative to the buffer, not to ->som
    - [MEDIUM] http: automatically re-aling request buffer
    - [BUG] http: body parsing must consider the start of message
    - [MINOR] new function stream_int_cond_close()
    - [MAJOR] http: implement body parser
    - [BUG] http: typos on several unlikely() around header insertion
    - [BUG] stream_sock: wrong max computation on recv
    - [MEDIUM] http: rework the buffer alignment logic
    - [BUG] buffers: wrong size calculation for displaced data
    - [MINOR] stream_sock: prepare for closing when all pending data are sent
    - [MEDIUM] http: add two more states for the closing period
    - [MEDIUM] http: properly handle "option forceclose"
    - [MINOR] stream_sock: add SI_FL_NOLINGER for faster close
    - [MEDIUM] http: make forceclose use SI_FL_NOLINGER
    - [MEDIUM] session: set SI_FL_NOLINGER when aborting on write timeouts
    - [MEDIUM] http: add some SI_FL_NOLINGER around server errors
    - [MINOR] config: option forceclose is valid in frontends too
    - [BUILD] halog: insufficient include path in makefile
    - [MEDIUM] http: make the analyser not rely on msg being initialized anymore
    - [MEDIUM] http: make the parsers able to wait for a buffer flush
    - [MAJOR] http: add support for option http-server-close
    - [BUG] http: ensure we abort data transfer on write error
    - [BUG] last fix was overzealous and disabled server-close
    - [BUG] http: fix erroneous trailers size computation
    - [MINOR] stream_sock: enable MSG_MORE when forwarding finite amount of data
    - [OPTIM] http: set MSG_MORE on response when a pipelined request is pending
    - [BUG] http: redirects were broken by chunk changes
    - [BUG] http: the request URI pointer is relative to the buffer
    - [OPTIM] http: don't immediately enable reading on request
    - [MINOR] http: move redirect messages to HTTP/1.1 with a content-length
    - [BUG] http: take care of errors, timeouts and aborts during the data phase
    - [MINOR] http: don't wait for sending requests to the server
    - [MINOR] http: make the conditional redirect support keep-alive
    - [BUG] http: fix cookie parser to support spaces and commas in values
    - [MINOR] config: some options were missing for "redirect"
    - [MINOR] redirect: add support for unconditional rules
    - [MINOR] config: centralize proxy struct initialization
    - [MEDIUM] config: remove the limitation of 10 reqadd/rspadd statements
    - [MEDIUM] config: remove the limitation of 10 config files
    - [CLEANUP] http: remove a remaining impossible condition
    - [OPTIM] http: optimize a bit the construct of the forward loops

15 years ago[OPTIM] http: optimize a bit the construct of the forward loops
Willy Tarreau [Sun, 3 Jan 2010 22:08:28 +0000 (23:08 +0100)] 
[OPTIM] http: optimize a bit the construct of the forward loops

By adjusting a few states and direct branches, we can save a few
percents of CPU, increasing by as much the resulting data rate.

15 years ago[CLEANUP] http: remove a remaining impossible condition
Willy Tarreau [Sun, 3 Jan 2010 21:13:35 +0000 (22:13 +0100)] 
[CLEANUP] http: remove a remaining impossible condition

This test was there before we had the CLOSING and CLOSED states.
It makes no sense now.

15 years ago[MEDIUM] config: remove the limitation of 10 config files
Willy Tarreau [Sun, 3 Jan 2010 20:12:30 +0000 (21:12 +0100)] 
[MEDIUM] config: remove the limitation of 10 config files

Now we use a linked list, there is no limit anymore.

15 years ago[MEDIUM] config: remove the limitation of 10 reqadd/rspadd statements
Willy Tarreau [Sun, 3 Jan 2010 20:03:22 +0000 (21:03 +0100)] 
[MEDIUM] config: remove the limitation of 10 reqadd/rspadd statements

Now we use a linked list, there is no limit anymore.

15 years ago[MINOR] config: centralize proxy struct initialization
Willy Tarreau [Sun, 3 Jan 2010 19:23:58 +0000 (20:23 +0100)] 
[MINOR] config: centralize proxy struct initialization

15 years ago[MINOR] redirect: add support for unconditional rules
Willy Tarreau [Sun, 3 Jan 2010 19:03:03 +0000 (20:03 +0100)] 
[MINOR] redirect: add support for unconditional rules

Sometimes it's useful to be able to specify an unconditional redirect
rule without adding "if TRUE".

15 years ago[MINOR] config: some options were missing for "redirect"
Willy Tarreau [Sun, 3 Jan 2010 18:47:39 +0000 (19:47 +0100)] 
[MINOR] config: some options were missing for "redirect"

Those options were missing in the parser error message :
  set-cookie, clear-cookie, drop-query

15 years ago[BUG] http: fix cookie parser to support spaces and commas in values
Willy Tarreau [Sun, 3 Jan 2010 18:45:54 +0000 (19:45 +0100)] 
[BUG] http: fix cookie parser to support spaces and commas in values

The cookie parser could be fooled by spaces or commas in cookie names
and values, causing the persistence cookie not to be matched if located
just after such a cookie. Now spaces found in values are considered as
part of the value, and spaces, commas and semi-colons found in values
or names, are skipped till next cookie name.

This fix must be backported to 1.3.

15 years ago[BUG] Healthchecks: get a proper error code if connection cannot be completed immediately
Krzysztof Piotr Oledzki [Sat, 2 Jan 2010 21:03:01 +0000 (22:03 +0100)] 
[BUG] Healthchecks: get a proper error code if connection cannot be completed immediately

In case of a non-blocking socket, used for connecting to a remote
server (not localhost), the error reported by the health check
was most of a time one of EINPROGRESS/EAGAIN/EALREADY.

This patch adds a getsockopt(..., SO_ERROR, ...) call so now
the proper error message is reported.

15 years ago[MINOR] http: make the conditional redirect support keep-alive
Willy Tarreau [Sun, 3 Jan 2010 16:32:57 +0000 (17:32 +0100)] 
[MINOR] http: make the conditional redirect support keep-alive

It makes sense to permit a client to keep its connection when
performing a redirect to the same host. We only detect the fact
that the redirect location begins with a slash to use the keep-alive
(if the client supports it).

15 years ago[MINOR] http: don't wait for sending requests to the server
Willy Tarreau [Sun, 3 Jan 2010 16:24:51 +0000 (17:24 +0100)] 
[MINOR] http: don't wait for sending requests to the server

By default we automatically wait for enough data to fill large
packets if buf->to_forward is not null. This causes a problem
with POST/Expect requests which have a data size but no data
immediately available. Instead of causing noticeable delays on
such requests, simply add a flag to disable waiting when sending
requests.

15 years ago[BUG] http: take care of errors, timeouts and aborts during the data phase
Willy Tarreau [Sun, 3 Jan 2010 16:07:49 +0000 (17:07 +0100)] 
[BUG] http: take care of errors, timeouts and aborts during the data phase

In server-close mode particularly, the response buffer is marked for
no-auto-close after a response passed through. This prevented a POST
request from being aborted on errors, timeouts or anything if the
response was received before the request was complete.

15 years ago[MINOR] http: move redirect messages to HTTP/1.1 with a content-length
Willy Tarreau [Sun, 3 Jan 2010 14:09:36 +0000 (15:09 +0100)] 
[MINOR] http: move redirect messages to HTTP/1.1 with a content-length

This is cleaner and this tells clients we support 1.1.

15 years ago[OPTIM] http: don't immediately enable reading on request
Willy Tarreau [Sun, 3 Jan 2010 13:38:03 +0000 (14:38 +0100)] 
[OPTIM] http: don't immediately enable reading on request

If we enable reading of a request immediately after completing
another one, we end up performing small reads until the request
buffer is complete. This takes time and makes it harder to realign
the buffer when needed. Just enable reading when we need to.

15 years ago[BUG] http: the request URI pointer is relative to the buffer
Willy Tarreau [Sun, 3 Jan 2010 12:04:35 +0000 (13:04 +0100)] 
[BUG] http: the request URI pointer is relative to the buffer

The rq.u field is relative to buf->data, not to msg->sol. We have
to subtract msg->som everywhere this error was made. Maybe it will
be simpler to have a pointer to the buffer in the message and find
appropriate data there.

15 years ago[BUG] http: redirects were broken by chunk changes
Willy Tarreau [Sun, 3 Jan 2010 11:24:37 +0000 (12:24 +0100)] 
[BUG] http: redirects were broken by chunk changes

Redirects used to initialize a chunk whose size was not set (0).
Also, the return code of chunk_strcpy() is 1 in case of success.

15 years ago[OPTIM] http: set MSG_MORE on response when a pipelined request is pending
Willy Tarreau [Sun, 3 Jan 2010 10:37:54 +0000 (11:37 +0100)] 
[OPTIM] http: set MSG_MORE on response when a pipelined request is pending

Many times we see a lot of short responses in HTTP (typically 304 on a
reload). It is a waste of network bandwidth to send that many small packets
when we know we can merge them. When we know that another HTTP request is
following a response, we set BF_EXPECT_MORE on the response buffer, which
will turn MSG_MORE on exactly once. That way, multiple short responses can
leave pipelined if their corresponding requests were also pipelined.

15 years ago[MINOR] stream_sock: enable MSG_MORE when forwarding finite amount of data
Willy Tarreau [Sun, 3 Jan 2010 10:18:34 +0000 (11:18 +0100)] 
[MINOR] stream_sock: enable MSG_MORE when forwarding finite amount of data

While it could be dangerous to enable MSG_MORE on infinite data (eg:
interactive sessions), it makes sense to enable it when we know the
chunk to be sent is just a part of a larger one.

15 years ago[BUG] http: fix erroneous trailers size computation
Willy Tarreau [Sun, 3 Jan 2010 06:42:04 +0000 (07:42 +0100)] 
[BUG] http: fix erroneous trailers size computation

We used to forward more trailers than required, causing a
desynchronization of the output. Now we schedule all for forwarding
as soon as we encounter them.

15 years ago[BUG] last fix was overzealous and disabled server-close
Willy Tarreau [Sat, 2 Jan 2010 23:19:31 +0000 (00:19 +0100)] 
[BUG] last fix was overzealous and disabled server-close

we must not close on remote shutdown but on remote error only.

15 years ago[BUG] http: ensure we abort data transfer on write error
Willy Tarreau [Sat, 2 Jan 2010 22:58:04 +0000 (23:58 +0100)] 
[BUG] http: ensure we abort data transfer on write error

When a write error is encountered during a data phase, we must
absolutely abort the pending data transfer, otherwise it will
never complete.

15 years ago[MAJOR] http: add support for option http-server-close
Willy Tarreau [Sat, 2 Jan 2010 21:47:18 +0000 (22:47 +0100)] 
[MAJOR] http: add support for option http-server-close

This option enables HTTP keep-alive on the client side and close mode
on the server side. This offers the best latency on the slow client
side, and still saves as many resources as possible on the server side
by actively closing connections. Pipelining is supported on both requests
and responses, though there is currently no reason to get pipelined
responses.

15 years ago[MEDIUM] http: make the parsers able to wait for a buffer flush
Willy Tarreau [Sat, 2 Jan 2010 21:04:45 +0000 (22:04 +0100)] 
[MEDIUM] http: make the parsers able to wait for a buffer flush

When too large a message lies in a buffer before parsing a new
request/response, we can now wait for previous outgoing data to
leave the buffer before attempting to parse again. After that
we can consider the opportunity to realign the buffer if needed.

15 years ago[MEDIUM] http: make the analyser not rely on msg being initialized anymore
Willy Tarreau [Sat, 2 Jan 2010 20:59:16 +0000 (21:59 +0100)] 
[MEDIUM] http: make the analyser not rely on msg being initialized anymore

The HTTP parser needed the msg structure to hold pre-initialized pointers.
This causes a trouble with keep-alive because if some data is still in the
buffer, the pointers can be anywhere after the data and later become invalid
when the buffer gets realigned.

It was not needed to rely on that since we have two valid information
in the buffer itself :

  - buf->lr : last visited place
  - buf->w + buf->send_max : beginning of next message

So by doing the maths only on those values, we can avoid doing tricks
on msg->som.

15 years ago[BUILD] halog: insufficient include path in makefile
Willy Tarreau [Sat, 2 Jan 2010 11:23:30 +0000 (12:23 +0100)] 
[BUILD] halog: insufficient include path in makefile

15 years ago[MINOR] config: option forceclose is valid in frontends too
Willy Tarreau [Wed, 30 Dec 2009 00:10:35 +0000 (01:10 +0100)] 
[MINOR] config: option forceclose is valid in frontends too

This option was disabled for frontends in the configuration because
it was useless in its initial implementation, though it was still
checked in the code. Let's officially enable it now.

15 years ago[MEDIUM] http: add some SI_FL_NOLINGER around server errors
Willy Tarreau [Tue, 29 Dec 2009 13:56:36 +0000 (14:56 +0100)] 
[MEDIUM] http: add some SI_FL_NOLINGER around server errors

When we catch an error from the server, speed up the connection
abort since we don't want to remain long with pending data in the
socket, and we want to be able to reuse our source port ASAP.

15 years ago[MEDIUM] session: set SI_FL_NOLINGER when aborting on write timeouts
Willy Tarreau [Tue, 29 Dec 2009 13:49:56 +0000 (14:49 +0100)] 
[MEDIUM] session: set SI_FL_NOLINGER when aborting on write timeouts

Doing this helps us flush the system buffers from all unread data. This
avoids having orphans when clients suddenly get off the net without
reading their entire response.

15 years ago[MEDIUM] http: make forceclose use SI_FL_NOLINGER
Willy Tarreau [Tue, 29 Dec 2009 13:39:48 +0000 (14:39 +0100)] 
[MEDIUM] http: make forceclose use SI_FL_NOLINGER

Option forceclose is not limited to the shortage of source ports
anymore thanks to this flag.

15 years ago[MINOR] stream_sock: add SI_FL_NOLINGER for faster close
Willy Tarreau [Tue, 29 Dec 2009 13:36:34 +0000 (14:36 +0100)] 
[MINOR] stream_sock: add SI_FL_NOLINGER for faster close

This new flag may be set by any user on a stream interface to tell
the underlying protocol that there is no need for lingering on the
socket since we know the other side either received everything or
does not care about what we sent.

This will typically be used with forced server close in HTTP mode,
where we want to quickly close a server connection after receiving
its response. Otherwise the system would prevent us from reusing
the same port for some time.