Commit Graph

1631 Commits

Author SHA1 Message Date
Emeric Brun
107ca30d54 [MEDIUM] Add pattern fetch management types and functions 2010-01-12 16:01:19 +01:00
Emeric Brun
3bd697e071 [MEDIUM] Add stick table (persistence) management functions and types 2010-01-12 11:23:15 +01:00
Emeric Brun
39132b2165 [MINOR] Add function to parse a size in configuration 2010-01-12 11:23:15 +01:00
Willy Tarreau
d72758ded1 [DOC] remove several trailing spaces 2010-01-12 10:42:19 +01:00
Willy Tarreau
983e01ed86 [DOC] fix various too large lines 2010-01-12 10:38:50 +01:00
Hervé COMMOWICK
698ae00fc2 [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".
2010-01-12 10:37:39 +01:00
Krzysztof Piotr Oledzki
9f2b9d5bf7 [BUG] checks: fix newline termination
We can't put a newline in server_status_printf() as there might be
something added later.
2010-01-11 21:13:43 +01:00
Krzysztof Piotr Oledzki
5f5b7d2c1d [OPTIM] remove SSP_O_VIA and SSP_O_STATUS
There is a smarter way to do this, so both options are no longer
necessary.
2010-01-11 21:13:12 +01:00
Krzysztof Piotr Oledzki
b16a607997 [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.
2010-01-11 21:13:12 +01:00
Willy Tarreau
76bfc95aa5 [MINOR] config: remove undocumented and buggy 'timeout appsession'
This one has never really worked and is not documented.
2010-01-10 17:48:11 +01:00
Cyril Bont
3b7a369baa [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.
2010-01-10 17:47:28 +01:00
Willy Tarreau
b16a5746b7 [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.
2010-01-10 14:46:16 +01:00
Willy Tarreau
fcffa6911c [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.
2010-01-10 14:24:53 +01:00
Willy Tarreau
520bbb2b85 [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.
2010-01-10 11:31:22 +01:00
Willy Tarreau
a3377eeeff [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.
2010-01-10 10:49:11 +01:00
Willy Tarreau
75661457f7 [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.
2010-01-10 10:35:01 +01:00
Willy Tarreau
148d099406 [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.
2010-01-10 10:21:21 +01:00
Cyril Bont
41689c22da [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.
2010-01-10 00:50:14 +01:00
Willy Tarreau
81e3b4f48d [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.
2010-01-10 00:42:19 +01:00
Willy Tarreau
dcb75c4a83 [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.
2010-01-10 00:24:22 +01:00
Willy Tarreau
962c3f4aab [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.
2010-01-10 00:15:35 +01:00
Willy Tarreau
59e0b0f972 [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).
2010-01-09 21:29:23 +01:00
Willy Tarreau
1fac75385a [BUILD] appsession did not build anymore under gcc-2.95 2010-01-09 19:23:06 +01:00
Willy Tarreau
762a23618e [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.
2010-01-09 13:57:26 +01:00
Willy Tarreau
11f8f5458f [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
2010-01-08 07:49:44 +01:00
Willy Tarreau
e34070e1be [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.
2010-01-08 00:36:57 +01:00
Willy Tarreau
065e8338e8 [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.
2010-01-08 00:36:57 +01:00
Willy Tarreau
ea65e68cc8 [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.
2010-01-08 00:36:57 +01:00
Willy Tarreau
4602363f6a [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().
2010-01-07 22:51:47 +01:00
Willy Tarreau
6fe60182aa [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.
2010-01-07 13:35:21 +01:00
Krzysztof Piotr Oledzki
260a3bb17b [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'.
2010-01-07 00:34:27 +01:00
Krzysztof Piotr Oledzki
c0f0c8605b [BUG] stats: cookie should be reported under backend not under proxy 2010-01-07 00:34:27 +01:00
Krzysztof Piotr Oledzki
c53601c878 [DOC] Restore ability to search a keyword at the beginning of a line 2010-01-07 00:34:27 +01:00
Willy Tarreau
90deb18916 [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.
2010-01-07 00:20:41 +01:00
Willy Tarreau
576507f4c5 [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.
2010-01-07 00:09:04 +01:00
Willy Tarreau
1e0bbafcbe [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.
2010-01-07 00:01:03 +01:00
Krzysztof Piotr Oledzki
034550b742 [BUG] stats: show UP/DOWN status also in tracking servers
It was broken since 0960541e49:
 [MEDIUM] Collect & show information about last health check, v3
2010-01-06 00:28:07 +01:00
Krzysztof Piotr Oledzki
88a14af5d2 [MINOR] stats: add href to tracked server
Each server has now a dedicated "a link" tag, so let's use it.
2010-01-06 00:28:07 +01:00
Krzysztof Piotr Oledzki
a9389b1a37 [BUG]: add 'observer', 'on-error', 'error-limit' to supported options list 2010-01-06 00:28:07 +01:00
Krzysztof Piotr Oledzki
c6df066980 [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
2010-01-06 00:28:06 +01:00
Krzysztof Piotr Oledzki
15514c21a2 [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)
2010-01-06 00:28:06 +01:00
Krzysztof Piotr Oledzki
2ec025d9a5 [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.
2010-01-06 00:28:06 +01:00
Krzysztof Piotr Oledzki
748196e94b [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.
2010-01-06 00:28:05 +01:00
Emeric Brun
3a7fce5383 [BUILD] warning ultoa_r returns char *
ultoa_r modifies its output, it returns a char *.
2010-01-05 23:47:00 +01:00
Emeric Brun
129c59014c [BUILD] warning in stream_interface.h
On some platforms, gcc complains about struct sockaddr.
2010-01-05 23:46:08 +01:00
Willy Tarreau
8db1c17634 [BUG] http: check options before the connection header
Commit 0dfdf19b64 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.
2010-01-05 23:12:12 +01:00
Willy Tarreau
f1f0683510 [TESTS] add a file to test various connection modes 2010-01-05 14:35:03 +01:00
Willy Tarreau
0dfdf19b64 [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).
2010-01-05 11:33:11 +01:00
Willy Tarreau
2832d63874 [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.
2010-01-05 11:06:20 +01:00
Willy Tarreau
9300fb2c01 [BUG] http: redirect needed to be updated after recent changes
The data forwarding fixes broke http redirection which relied on
tricks.
2010-01-05 00:58:24 +01:00