]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
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.

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.