]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
15 years ago[BUG] uri_auth: do not attemp to convert uri_auth -> http-request more than once
Krzysztof Piotr Oledzki [Mon, 22 Feb 2010 19:27:23 +0000 (20:27 +0100)] 
[BUG] uri_auth: do not attemp to convert uri_auth -> http-request more than once

Bug reported by Laurent Dolosor.

15 years ago[BUG] uri_auth: ST_SHLGNDS should be 0x00000008 not 0x0000008
Krzysztof Piotr Oledzki [Mon, 22 Feb 2010 18:29:40 +0000 (19:29 +0100)] 
[BUG] uri_auth: ST_SHLGNDS should be 0x00000008 not 0x0000008

15 years ago[DOC] fix a typo about timeout check and clarify the explanation.
Willy Tarreau [Wed, 10 Feb 2010 04:10:19 +0000 (05:10 +0100)] 
[DOC] fix a typo about timeout check and clarify the explanation.

15 years ago[BUILD] fix build breakage with DEBUG_FULL
Willy Tarreau [Tue, 9 Feb 2010 19:55:44 +0000 (20:55 +0100)] 
[BUILD] fix build breakage with DEBUG_FULL

Paul Hirose reported a build error when DEBUG_FULL is set.

15 years ago[BUG] config: report unresolvable host names as errors
Willy Tarreau [Tue, 9 Feb 2010 19:50:45 +0000 (20:50 +0100)] 
[BUG] config: report unresolvable host names as errors

When a host name could not be resolved, an alert was emitted but the
service used to start with 0.0.0.0 for the IP address, because the
address parsing functions could not report an error. This is now
changed. This fix must be backported to 1.3 as it was first discovered
there.

15 years ago[EXAMPLES] add auth.cfg
Krzysztof Piotr Oledzki [Sun, 7 Feb 2010 15:50:08 +0000 (16:50 +0100)] 
[EXAMPLES] add auth.cfg

15 years ago[DOC] Documentation cleanups
Cyril Bonté [Sat, 6 Feb 2010 13:44:47 +0000 (14:44 +0100)] 
[DOC] Documentation cleanups

Hi Willy,

This patch make some cleanups on the documentation :
- strictly respect the 80 columns constraint
- use space indentation everywhere
- add some missing "(deprecated)"
- fix the "monitor fail" keyword syntax
- fix a keyword in a "See Also" line (interval instead of inter)
- the "no" prefix of "option http-use-proxy-header" is displayed as the others

I've also noticed that 3 keywords are missing from the keywords reference (I don't know what to do for that) :
- dispatch
- reqsetbe
- reqisetbe

--
Cyril Bonté

15 years ago[BUG] pxid/puid/luid: don't shift IDs when some of them are forced
Krzysztof Piotr Oledzki [Fri, 5 Feb 2010 19:58:27 +0000 (20:58 +0100)] 
[BUG] pxid/puid/luid: don't shift IDs when some of them are forced

[WT: it was not a bug, I did it on purpose to leave no hole between IDs,
 though it's not very practical when admins want to force some entries
 after they have been used, because they'd rather leave a hole than
 renumber everything ]

Forcing some of IDs should not shift others.

Regression introduced in 53fb4ae261b6e0e33e618f5cabbacc1657c19cc5

---cut here---
global
        stats socket /home/ole/haproxy.stat user ole group ole mode 660

frontend F1
        bind 127.0.0.1:9999
        mode http

backend B1
        mode http

backend B2
        mode http
        id 9999

backend B3
        mode http

backend B4
        mode http
---cut here---

Before 53fb4ae261b6e0e33e618f5cabbacc1657c19cc5:
$ echo "show stat" | socat unix-connect:/home/ole/haproxy.stat stdio|cut -d , -f 28
iid
1
2
9999
4
5

After 53fb4ae261b6e0e33e618f5cabbacc1657c19cc5:
$ echo "show stat" | socat unix-connect:/home/ole/haproxy.stat stdio|cut -d , -f 28
iid
1
2
9999
3
4

With this patch:
$ echo "show stat" | socat unix-connect:/home/ole/haproxy.stat stdio|cut -d , -f 28
iid
1
2
9999
4
5

15 years ago[BUG] cfgparse memory leak and missing free calls in deinit()
Krzysztof Piotr Oledzki [Fri, 5 Feb 2010 19:31:44 +0000 (20:31 +0100)] 
[BUG] cfgparse memory leak and missing free calls in deinit()

Thich patch fixes cfgparser not to leak memory on each
default server statement and adds several missing free
calls in deinit():
 - free(l->name)
 - free(l->counters)
 - free(p->desc);
 - free(p->fwdfor_hdr_name);

None of them are critical, hopefully.

15 years ago[DOC] fix summary to add pattern extraction
Cyril Bonté [Wed, 3 Feb 2010 19:41:26 +0000 (20:41 +0100)] 
[DOC] fix summary to add pattern extraction

15 years ago[MINOR] stats: report maint state for tracking servers too
Cyril Bonté [Tue, 2 Feb 2010 23:26:28 +0000 (00:26 +0100)] 
[MINOR] stats: report maint state for tracking servers too

This is to avoid confusing a real server failure and a tracking server
which is marked down because the tracked server was switched to MAINT.

15 years ago[BUILD] auth: don't use unnamed unions
Willy Tarreau [Tue, 2 Feb 2010 10:28:20 +0000 (11:28 +0100)] 
[BUILD] auth: don't use unnamed unions

unnamed unions are not compatible with older compilers (eg: gcc 2.95) so
name it "u" instead.

15 years ago[RELEASE] Released version 1.4-rc1 v1.4-rc1
Willy Tarreau [Tue, 2 Feb 2010 09:18:28 +0000 (10:18 +0100)] 
[RELEASE] Released version 1.4-rc1

Released version 1.4-rc1 with the following main changes :
    - [MEDIUM] add a maintenance mode to servers
    - [MINOR] http-auth: last fix was wrong
    - [CONTRIB] add base64rev-gen.c that was used to generate the base64rev table.
    - [MINOR] Base64 decode
    - [MINOR] generic auth support with groups and encrypted passwords
    - [MINOR] add ACL_TEST_F_NULL_MATCH
    - [MINOR] http-request: allow/deny/auth support for frontend/backend/listen
    - [MINOR] acl: add http_auth and http_auth_group
    - [MAJOR] use the new auth framework for http stats
    - [DOC] add info about userlists, http-request and http_auth/http_auth_group acls
    - [STATS] make it possible to change a CLI connection timeout
    - [BUG] patterns: copy-paste typo in type conversion arguments
    - [MINOR] pattern: make the converter more flexible by supporting void* and int args
    - [MINOR] standard: str2mask: string to netmask converter
    - [MINOR] pattern: add support for argument parsers for converters
    - [MINOR] pattern: add the "ipmask()" converting function
    - [MINOR] config: off-by-one in "stick-table" after list of converters
    - [CLEANUP] acl, patterns: make use of my_strndup() instead of malloc+memcpy
    - [BUG] restore accidentely removed line in last patch !
    - [MINOR] checks: make the HTTP check code add the CRLF itself
    - [MINOR] checks: add the server's status in the checks
    - [BUILD] halog: make without arch-specific optimizations
    - [BUG] halog: fix segfault in case of empty log in PCT mode (cherry picked from commit fe362fe4762151d209b9656639ee1651bc2b329d)
    - [MINOR] http: disable keep-alive when process is going down
    - [MINOR] acl: add build_acl_cond() to make it easier to add ACLs in config
    - [CLEANUP] config: use build_acl_cond() instead of parse_acl_cond()
    - [CLEANUP] config: use warnif_cond_requires_resp() to check for bad ACLs
    - [MINOR] prepare req_*/rsp_* to receive a condition
    - [CLEANUP] config: specify correct const char types to warnif_* functions
    - [MEDIUM] config: factor out the parsing of 20 req*/rsp* keywords
    - [MEDIUM] http: make the request filter loop check for optional conditions
    - [MEDIUM] http: add support for conditional request filter execution
    - [DOC] add some build info about the AIX platform (cherry picked from commit e41914c77edbc40aebf827b37542d37d758e371e)
    - [MEDIUM] http: add support for conditional request header addition
    - [MEDIUM] http: add support for conditional response header rewriting
    - [DOC] add some missing ACLs about response header matching
    - [MEDIUM] http: add support for proxy authentication
    - [MINOR] http-auth: make the 'unless' keyword work as expected
    - [CLEANUP] config: use build_acl_cond() to simplify http-request ACL parsing
    - [MEDIUM] add support for anonymous ACLs
    - [MEDIUM] http: switch to tunnel mode after status 101 responses
    - [MEDIUM] http: stricter processing of the CONNECT method
    - [BUG] config: reset check request to avoid double free when switching to ssl/sql
    - [MINOR] config: fix too large ssl-hello-check message.
    - [BUG] fix error response in case of server error

15 years ago[BUG] fix error response in case of server error
Willy Tarreau [Tue, 2 Feb 2010 08:57:24 +0000 (09:57 +0100)] 
[BUG] fix error response in case of server error

The fix below was incomplete :
    commit d5fd51c75be6479539228f84377622a986b23be2

    [BUG] http_server_error() must not purge a previous pending response

    This can cause parts of responses to be truncated in case of
    pipelined requests if the second request generates an error
    before the first request is completely flushed.

Pending response data being rejected was still sent, causing inappropriate
error responses in case of error while parsing a response header. We must
purge pending data from the response buffer that were not scheduled to be
sent (l - send_max).

15 years ago[DOC] add info about userlists, http-request and http_auth/http_auth_group acls
Krzysztof Piotr Oledzki [Mon, 1 Feb 2010 22:35:44 +0000 (23:35 +0100)] 
[DOC] add info about userlists, http-request and http_auth/http_auth_group acls

15 years ago[MINOR] config: fix too large ssl-hello-check message.
Willy Tarreau [Mon, 1 Feb 2010 15:38:17 +0000 (16:38 +0100)] 
[MINOR] config: fix too large ssl-hello-check message.

As reported by Cyril Bonté and Hervé Commowick, the ssl-hello-check
should use sizeof()-1 and not sizeof() for the message length.

15 years ago[BUG] config: reset check request to avoid double free when switching to ssl/sql
Willy Tarreau [Mon, 1 Feb 2010 15:31:14 +0000 (16:31 +0100)] 
[BUG] config: reset check request to avoid double free when switching to ssl/sql

SSL and SQL checks did only perform a free() of the request without replacing
it, so having multiple SSL/SQL check declarations after another check type
causes a double free condition during config parsing. This should be backported
although it's harmless.

15 years ago[MEDIUM] http: stricter processing of the CONNECT method
Willy Tarreau [Mon, 1 Feb 2010 15:20:08 +0000 (16:20 +0100)] 
[MEDIUM] http: stricter processing of the CONNECT method

Now we establish the tunnel only once the status 200 reponse is
received. That way we can still support an authentication request
in response to a CONNECT, then a client's authentication response.

15 years ago[MEDIUM] http: switch to tunnel mode after status 101 responses
Willy Tarreau [Mon, 1 Feb 2010 14:13:32 +0000 (15:13 +0100)] 
[MEDIUM] http: switch to tunnel mode after status 101 responses

A 101 response is accompanied with an Upgrade header indicating
a new protocol that is spoken on the connection after the exchange
completes. At least we should switch to tunnel mode after such a
response.

15 years ago[MEDIUM] add support for anonymous ACLs
Willy Tarreau [Mon, 1 Feb 2010 12:05:50 +0000 (13:05 +0100)] 
[MEDIUM] add support for anonymous ACLs

Anonymous ACLs allow the declaration of rules which rely directly on
ACL expressions without passing via the declaration of an ACL. Example :

   With named ACLs :

        acl site_dead nbsrv(dynamic) lt 2
        acl site_dead nbsrv(static)  lt 2
        monitor fail  if site_dead

   With anonymous ACLs :

        monitor fail if { nbsrv(dynamic) lt 2 } || { nbsrv(static) lt 2 }

15 years ago[MINOR] http-auth: last fix was wrong
Krzysztof Olędzki [Mon, 1 Feb 2010 11:36:53 +0000 (12:36 +0100)] 
[MINOR] http-auth: last fix was wrong

I'm not sure if the fix is correct:

- if (req_acl->cond)
-         ret = acl_exec_cond(req_acl->cond, px, s, txn, ACL_DIR_REQ);
+ if (!req_acl->cond)
+         continue;

Doesn't it ignore rules with no condition attached? I think that the
proper solution would be the following.

15 years ago[CLEANUP] config: use build_acl_cond() to simplify http-request ACL parsing
Willy Tarreau [Mon, 1 Feb 2010 09:43:44 +0000 (10:43 +0100)] 
[CLEANUP] config: use build_acl_cond() to simplify http-request ACL parsing

Now that we have this new function to make your life better, use it.

15 years ago[MINOR] http-auth: make the 'unless' keyword work as expected
Willy Tarreau [Mon, 1 Feb 2010 09:40:19 +0000 (10:40 +0100)] 
[MINOR] http-auth: make the 'unless' keyword work as expected

One check was missing for the 'polarity' of the test. Now 'unless'
works. BTW, 'unless' provides a nice way to perform one-line auth :

    acl valid-user http_auth(user-list)
    http-request auth unless valid-user

15 years ago[MEDIUM] add a maintenance mode to servers
Cyril Bonté [Sun, 31 Jan 2010 21:34:03 +0000 (22:34 +0100)] 
[MEDIUM] add a maintenance mode to servers

This is a first attempt to add a maintenance mode on servers, using
the stat socket (in admin level).

It can be done with the following command :
   - disable server <backend>/<server>
   - enable  server <backend>/<server>

In this mode, no more checks will be performed on the server and it
will be marked as a special DOWN state (MAINT).

If some servers were tracking it, they'll go DOWN until the server
leaves the maintenance mode. The stats page and the CSV export also
display this special state.

This can be used to disable the server in haproxy before doing some
operations on this server itself. This is a good complement to the
"http-check disable-on-404" keyword and works in TCP mode.

15 years ago[MEDIUM] http: add support for proxy authentication
Willy Tarreau [Sun, 31 Jan 2010 20:46:18 +0000 (21:46 +0100)] 
[MEDIUM] http: add support for proxy authentication

We're already able to know if a request is a proxy request or a
normal one, and we have an option "http-use-proxy-header" which states
that proxy headers must be checked. So let's switch to use the proxy
authentication headers and responses when this option is set and we're
facing a proxy request. That allows haproxy to enforce auth in front
of a proxy.

15 years ago[MAJOR] use the new auth framework for http stats
Krzysztof Piotr Oledzki [Fri, 29 Jan 2010 18:29:32 +0000 (19:29 +0100)] 
[MAJOR] use the new auth framework for http stats

Support the new syntax (http-request allow/deny/auth) in
http stats.

Now it is possible to use the same syntax is the same like in
the frontend/backend http-request access control:
 acl src_nagios src 192.168.66.66
 acl stats_auth_ok http_auth(L1)

 stats http-request allow if src_nagios
 stats http-request allow if stats_auth_ok
 stats http-request auth realm LB

The old syntax is still supported, but now it is emulated
via private acls and an aditional userlist.

15 years ago[MINOR] acl: add http_auth and http_auth_group
Krzysztof Piotr Oledzki [Fri, 29 Jan 2010 18:26:18 +0000 (19:26 +0100)] 
[MINOR] acl: add http_auth and http_auth_group

Add two acls to match http auth data:
 acl <name> http_auth(userlist)
 acl <name> http_auth_hroup(userlist) group1 group2 (...)

15 years ago[MINOR] http-request: allow/deny/auth support for frontend/backend/listen
Krzysztof Piotr Oledzki [Fri, 29 Jan 2010 16:58:21 +0000 (17:58 +0100)] 
[MINOR] http-request: allow/deny/auth support for frontend/backend/listen

Use the generic auth framework to control access to frontends/backends/listens

15 years ago[MINOR] add ACL_TEST_F_NULL_MATCH
Krzysztof Piotr Oledzki [Fri, 29 Jan 2010 16:55:53 +0000 (17:55 +0100)] 
[MINOR] add ACL_TEST_F_NULL_MATCH

Add ACL_TEST_F_NULL_MATCH so expr->kw->match can be called
even if expr->patterns is empty.

15 years ago[MINOR] generic auth support with groups and encrypted passwords
Krzysztof Piotr Oledzki [Fri, 29 Jan 2010 16:50:44 +0000 (17:50 +0100)] 
[MINOR] generic auth support with groups and encrypted passwords

Add generic authentication & authorization support.

Groups are implemented as bitmaps so the count is limited to
sizeof(int)*8 == 32.

Encrypted passwords are supported with libcrypt and crypt(3), so it is
possible to use any method supported by your system. For example modern
Linux/glibc instalations support MD5/SHA-256/SHA-512 and of course classic,
DES-based encryption.

15 years ago[MINOR] Base64 decode
Krzysztof Piotr Oledzki [Fri, 29 Jan 2010 12:36:23 +0000 (13:36 +0100)] 
[MINOR] Base64 decode

Implement Base64 decoding with a reverse table.

The function accepts and decodes classic base64 strings, which
can be composed from many streams as long each one is properly
padded, for example: SGVsbG8=IEhBUHJveHk=IQ==

15 years ago[CONTRIB] add base64rev-gen.c that was used to generate the base64rev table.
Krzysztof Piotr Oledzki [Tue, 26 Jan 2010 11:32:49 +0000 (12:32 +0100)] 
[CONTRIB] add base64rev-gen.c that was used to generate the base64rev table.

There is no offcial reverse table for base64, so a short
program is required to generate one.

15 years ago[DOC] add some missing ACLs about response header matching
Willy Tarreau [Sun, 31 Jan 2010 14:54:35 +0000 (15:54 +0100)] 
[DOC] add some missing ACLs about response header matching

15 years ago[MEDIUM] http: add support for conditional response header rewriting
Willy Tarreau [Sun, 31 Jan 2010 14:43:27 +0000 (15:43 +0100)] 
[MEDIUM] http: add support for conditional response header rewriting

Just as for the req* rules, we can now condition rsp* rules with ACLs.
ACLs match on response, so volatile request information cannot be used.
A warning is emitted if a configuration contains such an anomaly.

15 years ago[MEDIUM] http: add support for conditional request header addition
Willy Tarreau [Sun, 31 Jan 2010 13:30:44 +0000 (14:30 +0100)] 
[MEDIUM] http: add support for conditional request header addition

Now the reqadd rules also support ACLs. All req* rules are converted
now.

15 years ago[DOC] add some build info about the AIX platform
Willy Tarreau [Thu, 28 Jan 2010 19:52:05 +0000 (20:52 +0100)] 
[DOC] add some build info about the AIX platform
(cherry picked from commit e41914c77edbc40aebf827b37542d37d758e371e)

15 years ago[MEDIUM] http: add support for conditional request filter execution
Willy Tarreau [Thu, 28 Jan 2010 19:35:13 +0000 (20:35 +0100)] 
[MEDIUM] http: add support for conditional request filter execution

All the req* rules except the reqadd rules can now be specified with
an if/unless condition. If a condition is specified and does not match,
the filter is ignored. This is particularly useful with reqidel, reqirep
and reqtarpit.

15 years ago[MEDIUM] http: make the request filter loop check for optional conditions
Willy Tarreau [Thu, 28 Jan 2010 19:22:06 +0000 (20:22 +0100)] 
[MEDIUM] http: make the request filter loop check for optional conditions

From now on, if request filters have ACLs defined, these ACLs will be
evaluated to condition the filter. This will be used to conditionally
remove/rewrite headers based on ACLs.

15 years ago[MEDIUM] config: factor out the parsing of 20 req*/rsp* keywords
Willy Tarreau [Thu, 28 Jan 2010 18:33:49 +0000 (19:33 +0100)] 
[MEDIUM] config: factor out the parsing of 20 req*/rsp* keywords

A new function was added to take care of the common code between
all those keywords. This has saved 8 kB of object code and about
500 lines of source code. This has also permitted to spot and fix
minor bugs (allocated args that were never used).

The code could be factored even more but that would make it a bit
more complex which is not interesting at this stage.

Various tests have been performed, and the warnings and errors are
still correctly reported and everything seems to work as expected.

15 years ago[CLEANUP] config: specify correct const char types to warnif_* functions
Willy Tarreau [Thu, 28 Jan 2010 18:01:34 +0000 (19:01 +0100)] 
[CLEANUP] config: specify correct const char types to warnif_* functions

Also factor out a few declarations of acl_cond everywhere.

15 years ago[MINOR] prepare req_*/rsp_* to receive a condition
Willy Tarreau [Thu, 28 Jan 2010 17:10:50 +0000 (18:10 +0100)] 
[MINOR] prepare req_*/rsp_* to receive a condition

It will be very handy to be able to pass conditions to req_* and rsp_*.
For now, we just add the pointer to the condition in the affected
structs.

15 years ago[CLEANUP] config: use warnif_cond_requires_resp() to check for bad ACLs
Willy Tarreau [Thu, 28 Jan 2010 16:59:39 +0000 (17:59 +0100)] 
[CLEANUP] config: use warnif_cond_requires_resp() to check for bad ACLs

Factor out some repetitive copy-pasted code to check for request ACLs
validity.

15 years ago[CLEANUP] config: use build_acl_cond() instead of parse_acl_cond()
Willy Tarreau [Thu, 28 Jan 2010 16:12:36 +0000 (17:12 +0100)] 
[CLEANUP] config: use build_acl_cond() instead of parse_acl_cond()

This allows to clean up the code a little bit by moving some of the
ACL internals out of the config parser.

15 years ago[MINOR] acl: add build_acl_cond() to make it easier to add ACLs in config
Willy Tarreau [Thu, 28 Jan 2010 15:48:33 +0000 (16:48 +0100)] 
[MINOR] acl: add build_acl_cond() to make it easier to add ACLs in config

This function automatically builds a rule, considering the if/unless
statements, and automatically updates the proxy's acl_requires, the
condition's file and line.

15 years ago[MINOR] http: disable keep-alive when process is going down
Willy Tarreau [Thu, 28 Jan 2010 14:01:20 +0000 (15:01 +0100)] 
[MINOR] http: disable keep-alive when process is going down

Krzysztof Oledzki suggested to disable keep-alive when a process
is going down due to a reload, in order to avoid ever-lasting
sessions. This is a simple and very efficient solution as it
ensures that at most one more request will be handled on a
keep-alive connection after the process has received a SIGUSR1
signal.

15 years ago[BUG] halog: fix segfault in case of empty log in PCT mode
Willy Tarreau [Tue, 17 Nov 2009 09:16:19 +0000 (10:16 +0100)] 
[BUG] halog: fix segfault in case of empty log in PCT mode
(cherry picked from commit fe362fe4762151d209b9656639ee1651bc2b329d)

15 years ago[BUILD] halog: make without arch-specific optimizations
Willy Tarreau [Tue, 17 Nov 2009 09:08:17 +0000 (10:08 +0100)] 
[BUILD] halog: make without arch-specific optimizations

15 years ago[MINOR] checks: add the server's status in the checks
Willy Tarreau [Wed, 27 Jan 2010 10:53:01 +0000 (11:53 +0100)] 
[MINOR] checks: add the server's status in the checks

Now a server can check the contents of the header X-Haproxy-Server-State
to know how haproxy sees it. The same values as those reported in the stats
are provided :
  - up/down status + check counts
  - throttle
  - weight vs backend weight
  - active sessions vs backend sessions
  - queue length
  - haproxy node name

15 years ago[MINOR] checks: make the HTTP check code add the CRLF itself
Willy Tarreau [Wed, 27 Jan 2010 10:28:42 +0000 (11:28 +0100)] 
[MINOR] checks: make the HTTP check code add the CRLF itself

Currently we cannot easily add headers nor anything to HTTP checks
because the requests are pre-formatted with the last CRLF. Make the
check code add the CRLF itself so that we can later add useful info.

15 years ago[BUG] restore accidentely removed line in last patch !
Willy Tarreau [Wed, 27 Jan 2010 19:13:38 +0000 (20:13 +0100)] 
[BUG] restore accidentely removed line in last patch !

The test condition for the acl expression validity got dropped, and
only the error remained. Error reported by Krzysztof Oledzki.

15 years ago[CLEANUP] acl, patterns: make use of my_strndup() instead of malloc+memcpy
Willy Tarreau [Tue, 26 Jan 2010 18:02:46 +0000 (19:02 +0100)] 
[CLEANUP] acl, patterns: make use of my_strndup() instead of malloc+memcpy

This is simpler and more readable.

15 years ago[MINOR] config: off-by-one in "stick-table" after list of converters
Willy Tarreau [Tue, 26 Jan 2010 17:36:26 +0000 (18:36 +0100)] 
[MINOR] config: off-by-one in "stick-table" after list of converters

15 years ago[MINOR] pattern: add the "ipmask()" converting function
Willy Tarreau [Tue, 26 Jan 2010 17:01:41 +0000 (18:01 +0100)] 
[MINOR] pattern: add the "ipmask()" converting function

This converter can be applied on top of an IPv4-type pattern. It
applies a netmask which is suited for IP address storage and matching.
This can be used to make all hosts within a certain mask to share the
same table entries and as such use the same server.

The mask can be passed in dotted form (eg: 255.255.255.0) or in CIDR
form (eg: 24).

15 years ago[MINOR] pattern: add support for argument parsers for converters
Willy Tarreau [Tue, 26 Jan 2010 16:58:06 +0000 (17:58 +0100)] 
[MINOR] pattern: add support for argument parsers for converters

Some converters will need one or several arguments. It's not possible
to write a simple generic parser for that, so let's add the ability
for each converter to support its own argument parser, and call it
to get the arguments when it's specified. If unspecified, the arguments
are passed unmodified as string+len.

15 years ago[MINOR] standard: str2mask: string to netmask converter
Willy Tarreau [Tue, 26 Jan 2010 16:36:17 +0000 (17:36 +0100)] 
[MINOR] standard: str2mask: string to netmask converter

This function converts a dotted or CIDR value to a netmask.

15 years ago[MINOR] pattern: make the converter more flexible by supporting void* and int args
Willy Tarreau [Tue, 26 Jan 2010 16:17:56 +0000 (17:17 +0100)] 
[MINOR] pattern: make the converter more flexible by supporting void* and int args

The pattern type converters currently support a string arg and a length.
Sometimes we'll prefer to pass them a list or a structure. So let's convert
the string and length into a generic void* and int that each converter may
use as it likes.

15 years ago[BUG] patterns: copy-paste typo in type conversion arguments
Willy Tarreau [Tue, 26 Jan 2010 15:48:20 +0000 (16:48 +0100)] 
[BUG] patterns: copy-paste typo in type conversion arguments

15 years ago[STATS] make it possible to change a CLI connection timeout
Willy Tarreau [Tue, 26 Jan 2010 09:59:06 +0000 (10:59 +0100)] 
[STATS] make it possible to change a CLI connection timeout

Sometimes it helps to be able to change an interactive CLI connection
timeout. Now we just have to enter "set timeout cli <value>" to do that.

15 years ago[RELEASE] Released version 1.4-dev8 v1.4-dev8
Willy Tarreau [Mon, 25 Jan 2010 22:28:05 +0000 (23:28 +0100)] 
[RELEASE] Released version 1.4-dev8

Released version 1.4-dev8 with the following main changes :
    - [CLEANUP] Keep in sync "defaults" support between documentation and code
    - [MEDIUM] http: add support for Proxy-Connection header
    - [CRITICAL] buffers: buffer_insert_line2 must not change the ->w entry
    - [MINOR] http: remove a copy-paste typo in transaction cleaning
    - [BUG] http: trim any excess buffer data when recycling a connection

15 years ago[CLEANUP] Keep in sync "defaults" support between documentation and code
Cyril Bonté [Sun, 24 Jan 2010 22:29:44 +0000 (23:29 +0100)] 
[CLEANUP] Keep in sync "defaults" support between documentation and code

Hi Willy,

I've made a quick pass on the "defaults" column in the Proxy keywords matrix (chapter 4.1. in the documentation).
This patch resyncs the code and the documentation. I let you decide if some keywords that still work in the "defaults" section should be forbidden.

- default_backend : in the matrix, "defaults" was not supported but the keyword details say it is.
Tests also shows it works, then I've updated the matrix.

- capture cookie : in the keyword details, we can read `It is not possible to specify a capture in a "defaults" section.'.
Ok, even if the tests worked, I've added an alert in the configuration parser (as it is for capture request/response header).

- description : not supported in "defaults", I added an alert in the parser.
I've also noticed that this keyword doesn't appear in the documentation.
There's one "description" entry, but for the "global" section, which is for a different use (the patch doesn't update the documentation).

- grace : even if this is maybe useless, it works in "defaults". Documentation is updated.
- redirect : alert is added in the parser.
- rsprep : alert added in the parser.

--
Cyril Bonté

15 years ago[BUG] http: trim any excess buffer data when recycling a connection
Willy Tarreau [Mon, 25 Jan 2010 22:11:14 +0000 (23:11 +0100)] 
[BUG] http: trim any excess buffer data when recycling a connection

We must trim any excess data from the response buffer when recycling
a keep-alive connection, because we may have blocked an invalid response
from a server that we don't want to accidentely forward once we disable
the analysers, nor do we want those data to come along with next response.
A typical example of such data would be from a buggy server responding to
a HEAD with some data, or sending more than the advertised content-length.

15 years ago[MINOR] http: remove a copy-paste typo in transaction cleaning
Willy Tarreau [Mon, 25 Jan 2010 21:46:30 +0000 (22:46 +0100)] 
[MINOR] http: remove a copy-paste typo in transaction cleaning

For deciding to set the BF_EXPECT_MORE, we reused the same code as in
http_wait_for_request(), but here we must ignore buf->lr which is not
yet set and useless. This might only have caused random sub-optimal
behaviours.

15 years ago[CRITICAL] buffers: buffer_insert_line2 must not change the ->w entry
Willy Tarreau [Mon, 25 Jan 2010 19:39:51 +0000 (20:39 +0100)] 
[CRITICAL] buffers: buffer_insert_line2 must not change the ->w entry

Krzysztof Oledzki reported that 1.4-dev7 would regularly crash
on an apparently very common workload. The cores he provided
showed some inter-buffer data corruption, exactly similar to
what was fixed by the following recent commit :

bbfa7938bd74adbfa435f26503fc10f5938195a3 [BUG] buffer_replace2 must never change the ->w entry

In fact, it was buffer_insert_line2() which was still modifying the
->w pointer, causing issues with pipelined responses in keep-alive
mode if some headers were to be added.

The bug requires a remote client, a near server, large server buffers
and small client buffers to be reproduced, with response header
insertion. Still, it's surprizing that it did not trigger earlier.

Now after 100k pipelined requests it did not trigger anymore.

15 years ago[MEDIUM] http: add support for Proxy-Connection header
Willy Tarreau [Mon, 25 Jan 2010 11:15:43 +0000 (12:15 +0100)] 
[MEDIUM] http: add support for Proxy-Connection header

Despite what is explicitly stated in HTTP specifications,
browsers still use the undocumented Proxy-Connection header
instead of the Connection header when they connect through
a proxy. As such, proxies generally implement support for
this stupid header name, breaking the standards and making
it harder to support keep-alive between clients and proxies.

Thus, we add a new "option http-use-proxy-header" to tell
haproxy that if it sees requests which look like proxy
requests, it should use the Proxy-Connection header instead
of the Connection header.

15 years ago[RELEASE] Released version 1.4-dev7 v1.4-dev7
Willy Tarreau [Mon, 25 Jan 2010 00:54:37 +0000 (01:54 +0100)] 
[RELEASE] Released version 1.4-dev7

Released version 1.4-dev7 with the following main changes :
    - [BUG] appsession: possible memory leak in case of out of memory condition
    - [MINOR] config: don't accept 'appsession' in defaults section
    - [MINOR] Add function to parse a size in configuration
    - [MEDIUM] Add stick table (persistence) management functions and types
    - [MEDIUM] Add pattern fetch management types and functions
    - [MEDIUM] Add src dst and dport pattern fetches.
    - [MEDIUM] Add stick table configuration and init.
    - [MEDIUM] Add stick and store rules analysers.
    - [MINOR] add option "mysql-check" to use MySQL health checks
    - [BUG] health checks: fix requeued message
    - [OPTIM] remove SSP_O_VIA and SSP_O_STATUS
    - [BUG] checks: fix newline termination
    - [MINOR] acl: add fe_id/so_id to match frontend's and socket's id
    - [BUG] appsession's sessid must be reset at end of transaction
    - [BUILD] appsession did not build anymore under gcc-2.95
    - [BUG] server redirection used an uninitialized string.
    - [MEDIUM] http: fix handling of message pointers
    - [MINOR] http: fix double slash prefix with server redirect
    - [MINOR] http redirect: add the ability to append a '/' to the URL
    - [BUG] stream_interface: fix retnclose and remove cond_close
    - [MINOR] http redirect: don't explicitly state keep-alive on 1.1
    - [MINOR] http: move appsession 'sessid' from session to http_txn
    - [OPTIM] reorder http_txn to optimize cache lines placement
    - [MINOR] http: differentiate waiting for new request and waiting for a complete requst
    - [MINOR] http: add a separate "http-keep-alive" timeout
    - [MINOR] config: remove undocumented and buggy 'timeout appsession'
    - [DOC] fix various too large lines
    - [DOC] remove several trailing spaces
    - [DOC] add the doc about stickiness
    - [BUILD] remove a warning in standard.h on AIX
    - [BUG] checks: chars are unsigned on AIX, check was always true
    - [CLEANUP] stream_sock: MSG_NOSIGNAL is only for send(), not recv()
    - [BUG] check: we must not check for error before reading a response
    - [BUG] buffers: remove remains of wrong obsolete length check
    - [OPTIM] stream_sock: don't shutdown(write) when the socket is in error
    - [BUG] http: don't count req errors on client resets or t/o during keep-alive
    - [MEDIUM] http: don't switch to tunnel mode upon close
    - [DOC] add documentation about connection header processing
    - [MINOR] http: add http_remove_header2() to remove a header value.
    - [MINOR] tools: add a "word_match()" function to match words and ignore spaces
    - [MAJOR] http: rework request Connection header handling
    - [MAJOR] http: rework response Connection header handling
    - [MINOR] add the ability to force kernel socket buffer size.
    - [BUG] http_server_error() must not purge a previous pending response
    - [OPTIM] http: don't delay response if next request is incomplete
    - [MINOR] add the "force-persist" statement to force persistence on down servers
    - [MINOR] http: logs must report persistent connections to down servers
    - [BUG] buffer_replace2 must never change the ->w entry

15 years ago[BUG] buffer_replace2 must never change the ->w entry
Willy Tarreau [Mon, 25 Jan 2010 00:49:57 +0000 (01:49 +0100)] 
[BUG] buffer_replace2 must never change the ->w entry

This function is used to move data which is located between ->w and ->r,
so it must not touch ->w, otherwise it will displace pending data which
is before the one we're actually overwriting. The issue arises with
some pipelined responses which cause some part of the previous one to
be chopped off when removing the connection: close header, thus
corrupting last response and shifting next one. Those are detected
in the logs because the next response will be a 502 with flags PH.

15 years ago[MINOR] http: logs must report persistent connections to down servers
Willy Tarreau [Sun, 24 Jan 2010 12:10:43 +0000 (13:10 +0100)] 
[MINOR] http: logs must report persistent connections to down servers

When using "option persist" or "force-persist", we want to know from the
logs if the cookie referenced a valid server or a down server. Till here
the flag reported a valid server even if the server was down, which is
misleading. Now we correctly report that the requested server was down.
We can typically see "--DI" when using "option persist" with redispatch,
ad "SCDN" when using force-persist on a down server.

15 years ago[MINOR] add the "force-persist" statement to force persistence on down servers
Willy Tarreau [Fri, 22 Jan 2010 18:10:05 +0000 (19:10 +0100)] 
[MINOR] add the "force-persist" statement to force persistence on down servers

This is used to force access to down servers for some requests. This
is useful when validating that a change on a server correctly works
before enabling the server again.

15 years ago[OPTIM] http: don't delay response if next request is incomplete
Willy Tarreau [Fri, 22 Jan 2010 13:41:29 +0000 (14:41 +0100)] 
[OPTIM] http: don't delay response if next request is incomplete

We use to delay the response if there is a new request in the buffer.
However, if the pending request is incomplete, we should not delay the
pending responses.

15 years ago[BUG] http_server_error() must not purge a previous pending response
Willy Tarreau [Fri, 22 Jan 2010 13:17:47 +0000 (14:17 +0100)] 
[BUG] http_server_error() must not purge a previous pending response

This can cause parts of responses to be truncated in case of
pipelined requests if the second request generates an error
before the first request is completely flushed.

15 years ago[MINOR] add the ability to force kernel socket buffer size.
Willy Tarreau [Thu, 21 Jan 2010 16:43:04 +0000 (17:43 +0100)] 
[MINOR] add the ability to force kernel socket buffer size.

Sometimes we need to be able to change the default kernel socket
buffer size (recv and send). Four new global settings have been
added for this :
   - tune.rcvbuf.client
   - tune.rcvbuf.server
   - tune.sndbuf.client
   - tune.sndbuf.server

Those can be used to reduce kernel memory footprint with large numbers
of concurrent connections, and to reduce risks of write timeouts with
very slow clients due to excessive kernel buffering.

15 years ago[MAJOR] http: rework response Connection header handling
Willy Tarreau [Mon, 18 Jan 2010 18:08:45 +0000 (19:08 +0100)] 
[MAJOR] http: rework response Connection header handling

This one is the next step of previous patch. It correctly computes
the response mode and the Connection flag transformations depending
on the request mode and version, and the response version and headers.

We're now also able to add "Connection: keep-alive", and to convert
server's close during a keep-alive connection to a server-close
connection.

15 years ago[MAJOR] http: rework request Connection header handling
Willy Tarreau [Mon, 18 Jan 2010 15:54:40 +0000 (16:54 +0100)] 
[MAJOR] http: rework request Connection header handling

We need to improve Connection header handling in the request for it
to support the upcoming keep-alive mode. Now we have two flags which
keep in the session the information about the presence of a
Connection: close and a Connection: keep-alive headers in the initial
request, as well as two others which keep the current state of those
headers so that we don't have to parse them again. Knowing the initial
value is essential to know when the client asked for keep-alive while
we're forcing a close (eg in server-close mode). Also the Connection
request parser is now able to automatically remove single header values
at the same time they are parsed. This provides greater flexibility and
reliability.

All combinations of listen/front/back in all modes and with both
1.0 and 1.1 have been tested.

15 years ago[MINOR] tools: add a "word_match()" function to match words and ignore spaces
Willy Tarreau [Mon, 18 Jan 2010 14:05:57 +0000 (15:05 +0100)] 
[MINOR] tools: add a "word_match()" function to match words and ignore spaces

Some header values might be delimited with spaces, so it's not enough to
compare "close" or "keep-alive" with strncasecmp(). Use word_match() for
that.

15 years ago[MINOR] http: add http_remove_header2() to remove a header value.
Willy Tarreau [Mon, 18 Jan 2010 13:54:04 +0000 (14:54 +0100)] 
[MINOR] http: add http_remove_header2() to remove a header value.

Calling this function after http_find_header2() automatically deletes
the current value of the header, and removes the header itself if the
value is the only one. The context is automatically adjusted for a
next call to http_find_header2() to return the next header. No other
change nor test should be made on the transient context though.

15 years ago[DOC] add documentation about connection header processing
Willy Tarreau [Sun, 17 Jan 2010 10:43:59 +0000 (11:43 +0100)] 
[DOC] add documentation about connection header processing

The connection header is complex to handle, especially in the response
path, depending on request and response HTTP versions, desired mode,
etc... Let's document it. Note that only a subset of this document is
currently implemented.

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.