]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
13 years agoMAJOR: acl: make use of the new argument parsing framework
Willy Tarreau [Thu, 19 Apr 2012 15:16:54 +0000 (17:16 +0200)] 
MAJOR: acl: make use of the new argument parsing framework

The ACL parser now uses the argument parser to build a typed argument list.
Right now arguments are all strings and only one argument is supported since
this is what ACLs currently support.

13 years agoMEDIUM: add a new typed argument list parsing framework
Willy Tarreau [Thu, 19 Apr 2012 13:24:50 +0000 (15:24 +0200)] 
MEDIUM: add a new typed argument list parsing framework

make_arg_list() builds an array of typed arguments with their values,
that the caller describes how to parse. This will be used to support
multiple arguments for ACLs and patterns, which is currently problematic
and prevents ACLs and patterns from being merged. Up to 7 arguments types
may be enumerated in a single 32-bit word, including their number of
mandatory parts.

At the moment, these files are not used yet, they're only built. Note that
the 4-bit encoding for the type has left only one unused type!

13 years agoMEDIUM: http/acl: make acl_fetch_hdr_{ip,val} rely on acl_fetch_hdr()
Willy Tarreau [Mon, 16 Apr 2012 15:21:11 +0000 (17:21 +0200)] 
MEDIUM: http/acl: make acl_fetch_hdr_{ip,val} rely on acl_fetch_hdr()

These two functions will now exploit the return of acl_fetch_hdr() instead
of doing the same work again and again.

13 years agoMEDIUM: http/acl: merge all request and response ACL fetches of headers and cookies
Willy Tarreau [Mon, 16 Apr 2012 14:26:40 +0000 (16:26 +0200)] 
MEDIUM: http/acl: merge all request and response ACL fetches of headers and cookies

Latest changes have made it possible to remove all differences between
request and response processing, making it worth merging request and
response ACL fetch functions to reduce code size.

Most likely with minor adaptation it will be possible to use the same hdr_*
functions to match in the response path, and cook_* for the response cookie
too.

13 years agoBUG/MINOR: http_auth: ACLs are volatile, not permanent
Willy Tarreau [Mon, 16 Apr 2012 13:00:51 +0000 (15:00 +0200)] 
BUG/MINOR: http_auth: ACLs are volatile, not permanent

ACLs are volatile since they require a fetch of request buffer data which is
then copied to a temporary shared place. The issue is minor though since auth
is generally checked very early.

13 years agoMEDIUM: http: make all ACL fetch function use acl_prefetch_http()
Willy Tarreau [Mon, 16 Apr 2012 12:42:55 +0000 (14:42 +0200)] 
MEDIUM: http: make all ACL fetch function use acl_prefetch_http()

All ACLs which need to process HTTP contents first call this function which
performs all the preliminary tests and also triggers the request parsing if
needed. A macro was written to simplify the code.

As a side effect, it's not required anymore to check for the HTTP ACL before
checking for HTTP contents.

13 years agoMEDIUM: http: add a prefetch function for ACL pattern fetch
Willy Tarreau [Mon, 16 Apr 2012 12:34:04 +0000 (14:34 +0200)] 
MEDIUM: http: add a prefetch function for ACL pattern fetch

This function will be called by all ACL fetch functions. Right now all ACL
fetch functions have to perform the exact same tests to check whether data
are available. Also, only one of them is able to actually parse an HTTP
request.

Using the prefetch function, it will be possible to try to parse a request
on the fly and to avoid the fetch if some data are missing. This will
significantly reduce the amount of tests in all ACL fetch functions.

13 years agoMEDIUM: buffers: rename a number of buffer management functions
Willy Tarreau [Mon, 7 May 2012 09:56:55 +0000 (11:56 +0200)] 
MEDIUM: buffers: rename a number of buffer management functions

The following renaming took place :
1) buffer input functions
  buffer_put_block => bi_putblk
  buffer_put_char => bi_putchr
  buffer_put_string => bi_putstr
  buffer_put_chunk => bi_putchk
  buffer_feed => bi_putstr
  buffer_feed_chunk => bi_putchk
  buffer_cut_tail => bi_erase
  buffer_ignore => bi_fast_delete

2) buffer output functions
  buffer_get_char => bo_getchr
  buffer_get_line => bo_getline
  buffer_get_block => bo_getblk
  buffer_skip => bo_skip
  buffer_write => bo_inject

3) buffer input avail/full functions were introduced :
  bi_avail
  bi_full

13 years agoMEDIUM: buffers: implement b_adv() to advance a buffer's pointer
Willy Tarreau [Sat, 5 May 2012 21:32:27 +0000 (23:32 +0200)] 
MEDIUM: buffers: implement b_adv() to advance a buffer's pointer

This is more convenient and efficient than buf->p = b_ptr(buf, n);
It simply advances the buffer's pointer by <n> and trasfers that
amount of bytes from <in> to <out>. The BF_OUT_EMPTY flag is updated
accordingly.

A few occurrences of such computations in buffers.c and stream_sock.c
were updated to use b_adv(), which resulted in a small code shrink.

13 years agoMEDIUM: buffers: add new pointer wrappers and get rid of almost all buffer_wrap_add...
Willy Tarreau [Fri, 4 May 2012 19:35:27 +0000 (21:35 +0200)] 
MEDIUM: buffers: add new pointer wrappers and get rid of almost all buffer_wrap_add calls

buffer_wrap_add was convenient for the migration but is not handy at all.
Let's have new wrappers that report input begin/end and output begin/end
instead.

It looks like we'll also need a b_adv(ofs) to advance a buffer's pointer.

13 years agoMEDIUM: buffers: fix unsafe use of buffer_ignore at some places
Willy Tarreau [Fri, 9 Mar 2012 14:03:30 +0000 (15:03 +0100)] 
MEDIUM: buffers: fix unsafe use of buffer_ignore at some places

buffer_ignore may only be used when the output of a buffer is empty,
but it's not granted it is always the case when sending HTTP error
responses. Better use buffer_cut_tail() instead, and use buffer_ignore
only on non-wrapping data.

13 years agoMINOR: http: remove useless wrapping checks in http_msg_analyzer
Willy Tarreau [Fri, 9 Mar 2012 13:46:19 +0000 (14:46 +0100)] 
MINOR: http: remove useless wrapping checks in http_msg_analyzer

The message cannot wrap here.

13 years agoMEDIUM: http: remove buffer arg in chunk parsing functions
Willy Tarreau [Fri, 9 Mar 2012 13:10:20 +0000 (14:10 +0100)] 
MEDIUM: http: remove buffer arg in chunk parsing functions

The buffer pointer is now taken from the http_msg in the following
functions :

http_parse_chunk_size
http_forward_trailers
http_skip_chunk_crlf

Most internal pointers were converted to const as the result of the
operation.

13 years agoMEDIUM: http: remove buffer arg in http_buffer_heavy_realign
Willy Tarreau [Fri, 9 Mar 2012 12:58:04 +0000 (13:58 +0100)] 
MEDIUM: http: remove buffer arg in http_buffer_heavy_realign

The buffer pointer is now taken from the http_msg. The function has also
been renamed "http_message_realign".

13 years agoMEDIUM: http: remove buffer arg in http_upgrade_v09_to_v10
Willy Tarreau [Fri, 9 Mar 2012 12:56:20 +0000 (13:56 +0100)] 
MEDIUM: http: remove buffer arg in http_upgrade_v09_to_v10

The buffer and http_msg pointers are now taken from the transaction.

13 years agoMEDIUM: http: remove buffer arg in http_msg_analyzer
Willy Tarreau [Fri, 9 Mar 2012 12:50:57 +0000 (13:50 +0100)] 
MEDIUM: http: remove buffer arg in http_msg_analyzer

The buffer pointer is now taken from the http_msg.

13 years agoMEDIUM: http: remove buffer arg in http_capture_bad_message
Willy Tarreau [Fri, 9 Mar 2012 12:39:23 +0000 (13:39 +0100)] 
MEDIUM: http: remove buffer arg in http_capture_bad_message

The buffer pointer is now taken from the http_msg.

13 years agoMEDIUM: http: remove buffer arg in a few header manipulation functions
Willy Tarreau [Fri, 9 Mar 2012 12:30:45 +0000 (13:30 +0100)] 
MEDIUM: http: remove buffer arg in a few header manipulation functions

The buffer pointer is now taken from the http_msg in the following functions :

 - http_remove_header2
 - http_header_add_tail
 - http_header_add_tail2
 - http_parse_connection_header
 - http_change_connection_header

13 years agoMEDIUM: http: http_send_name_header: remove references to msg and buffer
Willy Tarreau [Fri, 9 Mar 2012 11:11:57 +0000 (12:11 +0100)] 
MEDIUM: http: http_send_name_header: remove references to msg and buffer

They can be deduced from txn.

13 years agoMAJOR: http: make http_msg->sol relative to buffer's origin
Willy Tarreau [Fri, 9 Mar 2012 20:39:51 +0000 (21:39 +0100)] 
MAJOR: http: make http_msg->sol relative to buffer's origin

msg->sol is now a relative pointer just like all other ones. There is no
more absolute references to the buffer outside the struct buffer itself.

Next two cleanups should include removing buffer references to functions
which already have an msg, and removal of wrapping detection in request
and response parsing which cannot wrap by definition.

13 years agoMEDIUM: http: add a pointer to the buffer in http_msg
Willy Tarreau [Fri, 9 Mar 2012 10:32:30 +0000 (11:32 +0100)] 
MEDIUM: http: add a pointer to the buffer in http_msg

ACLs and patterns only rely on a struct http_msg and don't know the pointer
to the actual data. struct http_msg will soon only hold relative references
so that's not possible. We need http_msg to hold a reference to the struct
buffer before having relative pointers everywhere.

It is likely that doing so will also result in opportunities to simplify
a number of functions arguments. The following functions are already
candidate :

http_buffer_heavy_realign
http_capture_bad_message
http_change_connection_header
http_forward_trailers
http_header_add_tail
http_header_add_tail2
http_msg_analyzer
http_parse_chunk_size
http_parse_connection_header
http_remove_header2
http_send_name_header
http_skip_chunk_crlf
http_upgrade_v09_to_v10

13 years agoMAJOR: http: turn http_msg->eol to a buffer-relative offset
Willy Tarreau [Mon, 5 Mar 2012 15:57:34 +0000 (16:57 +0100)] 
MAJOR: http: turn http_msg->eol to a buffer-relative offset

It was an absolute pointer to the buffer's data, now it's a pointer relative
to the buffer's origin.

13 years agoCLEANUP: http: remove unused http_msg->col
Willy Tarreau [Fri, 9 Mar 2012 20:28:54 +0000 (21:28 +0100)] 
CLEANUP: http: remove unused http_msg->col

The <col> element of the struct http_msg has not been used for a long
time now, remove it.

13 years agoMAJOR: http: change msg->{som,col,sov,eoh} to be relative to buffer origin
Willy Tarreau [Mon, 5 Mar 2012 14:52:30 +0000 (15:52 +0100)] 
MAJOR: http: change msg->{som,col,sov,eoh} to be relative to buffer origin

These offsets were relative to the buffer itself. Now they're relative to
the buffer's origin (buf->p) which normally corresponds to the start of
current message.

This saves a big dependency between the HTTP message struct and the buffers.
It appeared during this change that ->col is not used anymore (it will have
to be removed). Next step is to turn ->eol and ->sol from absolute to relative.

13 years agoMAJOR: http: move buffer->lr to http_msg->next
Willy Tarreau [Mon, 5 Mar 2012 10:17:50 +0000 (11:17 +0100)] 
MAJOR: http: move buffer->lr to http_msg->next

The buffer's pointer <lr> was only used by HTTP parsers which also use a
struct http_msg to keep track of the parser's state. We've reached a point
where it makes no sense to keep ->lr in the buffer, as the split between
buffer and msg is only arbitrary for historical reasons.

This change ensures that touching buffers will not impact HTTP messages
anymore, making the buffers more content-agnostic. However, it becomes
very important not to forget to update msg->next when some data get
forwarded or moved (and in general each time buf->p is updated).

The new pointer in http_msg becomes relative to buffer->p so that
parsing multiple messages becomes easier. It is possible that at one
point ->som and ->next will be merged.

Note: http_parse_reqline() and http_parse_stsline() have been temporarily
modified to know the message starting point in the buffer (->p).

13 years agoMAJOR: buffers: replace buf->r with buf->p + buf->i
Willy Tarreau [Fri, 2 Mar 2012 19:14:45 +0000 (20:14 +0100)] 
MAJOR: buffers: replace buf->r with buf->p + buf->i

This change gets rid of buf->r which is always equal to buf->p + buf->i.
It removed some wrapping detection at a number of places, but required addition
of new relative offset computations at other locations. A large number of places
can be simplified now with extreme care, since most of the time, either the
pointer has to be computed once or we need a difference between the old ->w and
old ->r to compute free space. The cleanup will probably happen with the rewrite
of the buffer_input_* and buffer_output_* functions anyway.

buf->lr still has to move to the struct http_msg and be relative to buf->p
for the rework to be complete.

13 years agoMAJOR: buffers: replace buf->w with buf->p - buf->o
Willy Tarreau [Fri, 2 Mar 2012 15:13:16 +0000 (16:13 +0100)] 
MAJOR: buffers: replace buf->w with buf->p - buf->o

This change introduces the buffer's base pointer, which is the limit between
incoming and outgoing data. It's the point where the parsing should start
from. A number of computations have already been greatly simplified, but
more simplifications are expected to come from the removal of buf->r.

The changes appear good and have revealed occasional improper use of some
pointers. It is possible that this patch has introduced bugs or revealed
some, although preliminary testings tend to indicate that everything still
works as it should.

13 years agoMINOR: buffers: remove unused function buffer_contig_data()
Willy Tarreau [Fri, 2 Mar 2012 10:36:00 +0000 (11:36 +0100)] 
MINOR: buffers: remove unused function buffer_contig_data()

This one was never used and is buggy. It will be easier to rewrite
it when the buffer rework is complete.

13 years agoMINOR: buffers: provide simple pointer normalization functions
Willy Tarreau [Fri, 2 Mar 2012 09:38:01 +0000 (10:38 +0100)] 
MINOR: buffers: provide simple pointer normalization functions

Add buffer_wrap_sub() and buffer_wrap_add() to normalize buffer pointers
after an addition or subtract.

13 years agoMAJOR: buffer: replace buf->l with buf->{o+i}
Willy Tarreau [Thu, 1 Mar 2012 17:19:58 +0000 (18:19 +0100)] 
MAJOR: buffer: replace buf->l with buf->{o+i}

We don't have buf->l anymore. We have buf->i for pending data and
the total length is retrieved by adding buf->o. Some computation
already become simpler.

Despite extreme care, bugs are not excluded.

It's worth noting that msg->err_pos as set by HTTP request/response
analysers becomes relative to pending data and not to the beginning
of the buffer. This has not been completed yet so differences might
occur when outgoing data are left in the buffer.

13 years agoMAJOR: buffer rework: replace ->send_max with ->o
Willy Tarreau [Thu, 1 Mar 2012 15:08:30 +0000 (16:08 +0100)] 
MAJOR: buffer rework: replace ->send_max with ->o

This is the first minor step of the buffer rework. It's only renaming,
it should have no impact.

13 years agoDOC: add a diagram to explain how circular buffers work
Willy Tarreau [Mon, 27 Feb 2012 18:31:50 +0000 (19:31 +0100)] 
DOC: add a diagram to explain how circular buffers work

Also add some thoughts about the existing and new design.

Note: an earlier design used the names "head" and "tail" for both sides
of the buffer, but it appears awkward as these words may be understood
in two forms (feed by head, output by tail, or make the newcomers wait
at the tail of the queue). Also there were already a few functions in the
code making use of either terminology. So better avoid this terminology
and use "input" and "output" instead.

13 years agoMEDIUM: move message-related flags from transaction to message
Willy Tarreau [Fri, 17 Feb 2012 16:39:37 +0000 (17:39 +0100)] 
MEDIUM: move message-related flags from transaction to message

Too many flags are stored in the transaction structure. Some flags are
clearly message-specific and exist in two versions (request and response).
Move them to a new "flags" field in the http_message struct instead.

13 years agoCLEANUP: remove a few warning about unchecked return values in debug code
Willy Tarreau [Sun, 29 Apr 2012 12:11:38 +0000 (14:11 +0200)] 
CLEANUP: remove a few warning about unchecked return values in debug code

There were a few unchecked write() calls in the debug code that cause
gcc 4.x to emit warnings on recent libc. We don't want to check them
as we can't make anything from the result, let's simply surround them
with an empty if statement.

Note that one of the warnings was for chdir("/") which normally cannot
fail since it follows a successful chroot (which means the perms are
necessarily there). Anyway let's move the call uppe to protect it too.

13 years agoMINOR: standard: add a memprintf() function to build formatted error messages
Willy Tarreau [Fri, 27 Apr 2012 09:16:50 +0000 (11:16 +0200)] 
MINOR: standard: add a memprintf() function to build formatted error messages

memprintf() is just like snprintf() except that it always returns a properly
sized allocated string that the caller is responsible for freeing. NULL is
returned on serious errors. It also supports stackable calls over the same
pointer since it offers support for automatically freeing a previous one :

     memprintf(&err, "invalid argument: '%s'", arg);
     ...
     memprintf(&err, "keyword parser said: <%s>", *err);
     ...
     memprintf(&err, "line parser said: %s\n", *err);
     ...
     free(*err);

13 years agoCLEANUP: http: message parser must ignore HTTP_MSG_ERROR
Willy Tarreau [Mon, 16 Apr 2012 12:51:55 +0000 (14:51 +0200)] 
CLEANUP: http: message parser must ignore HTTP_MSG_ERROR

The issue only happens when DEBUG_FULL is enabled, which causes
http_msg_analyzer() to complain if it's called twice with an invalid
message, for instance because of two consecutive ACLs using req_proto_http.

The code is commented out when DEBUG_FULL is disabled, so this is not a bug,
just an annoyance for the developer.

13 years agoBUILD: http: stop gcc-4.1.2 from complaining about possibly uninitialized values
Willy Tarreau [Wed, 11 Apr 2012 15:28:40 +0000 (17:28 +0200)] 
BUILD: http: stop gcc-4.1.2 from complaining about possibly uninitialized values

The three warnings below are totally wrong since the variables depend on another
one which is only turned on when the variables are initialized. Still this gcc-4.1.2
isn't able to see this and prefers to complain wrongly. So let's initialize the
variables to shut it up since we're not in the fast path.

src/proto_http.c: In function 'acl_fetch_any_cookie_cnt':
src/proto_http.c:8393: warning: 'val_end' may be used uninitialized in this function

src/proto_http.c: In function 'http_process_req_stat_post':
src/proto_http.c:2577: warning: 'st_next_param' may be used uninitialized in this function
src/proto_http.c:2577: warning: 'st_cur_param' may be used uninitialized in this function

13 years agoBUILD: http: make extract_cookie_value() return an int not size_t
Willy Tarreau [Wed, 11 Apr 2012 15:21:08 +0000 (17:21 +0200)] 
BUILD: http: make extract_cookie_value() return an int not size_t

It's very annoying that we have to deal with the crappy size_t and with ints
at some places because these ones don't mix well. Patch 6f61b2 changed the
chunk len to int but its size remains size_t and some functions are having
trouble being used by several callers depending on the type of their arguments.

Let's turn extract_cookie_value() to int for now on, and plan a massive cleanup
later to remove all size_t.

13 years agoDOC: fix some keywords arguments documentation
Cyril Bonté [Sat, 21 Apr 2012 21:30:29 +0000 (23:30 +0200)] 
DOC: fix some keywords arguments documentation

- Typo on "dispatch" keyword arguments.
- Reindent some blocks for better parsing by automated tools.
- "option mysql-check" and "option pgsql-check" arguments were not documented
  as the others.

13 years agoMINOR: cli: display the 4 IP addresses and ports on "show sess XXX"
Daniel Schultze [Fri, 23 Mar 2012 17:53:36 +0000 (10:53 -0700)] 
MINOR: cli: display the 4 IP addresses and ports on "show sess XXX"

I have modified dumpstats.c to show additional information for the show
session <id> command on the statistics socket. This will dump the
public, frontend, backend, and server ip/tcp addresses and port. We
found it useful to have this information available in real time and
could not find another way of getting this information.

13 years agoBUG/MINOR: acl: req_ssl_sni would randomly fail if a session ID is present
Willy Tarreau [Mon, 9 Apr 2012 07:24:11 +0000 (09:24 +0200)] 
BUG/MINOR: acl: req_ssl_sni would randomly fail if a session ID is present

The wrong byte was checked for the session_id length in the payload. This
used to work when the session ID was absent because zero was found there,
but when a session ID is present, there is 1/256 chance that the inspected
data contains 0x20 (the actual session ID length), so it fails.

Thanks to Emmanuel Bézagu for reporting this bug.

This bug does not need backporting, it is 1.5 specific.

13 years agoDOC: cleanup indentation, alignment, columns and chapters
Cyril Bonté [Sun, 8 Apr 2012 19:57:39 +0000 (21:57 +0200)] 
DOC: cleanup indentation, alignment, columns and chapters

This patch is a group commit simplify the parsing of the documenation :
- remove remaining tabulations
- realign some lines
- break lines at 80 columns
- add missing chapters in the summary
- fix chapter numbering format

13 years agoMEDIUM: stream_sock: add a get_src and get_dst callback and remove SN_FRT_ADDR_SET
Willy Tarreau [Sat, 7 Apr 2012 16:03:52 +0000 (18:03 +0200)] 
MEDIUM: stream_sock: add a get_src and get_dst callback and remove SN_FRT_ADDR_SET

These callbacks are used to retrieve the source and destination address
of a socket. The address flags are not hold on the stream interface and
not on the session anymore. The addresses are collected when needed.

This still needs to be improved to store the IP and port separately so
that it is not needed to perform a getsockname() when only the IP address
is desired for outgoing traffic.

13 years agoMINOR: log: log-format: usable without httplog and tcplog
William Lallemand [Mon, 2 Apr 2012 14:22:10 +0000 (16:22 +0200)] 
MINOR: log: log-format: usable without httplog and tcplog

Options httplog and tcplog aren't mandatory anymore for the log-format.
The LW_ flags are now set during the log-format string parsing.

13 years agoMEDIUM: log: Unique ID
William Lallemand [Mon, 12 Mar 2012 11:48:57 +0000 (12:48 +0100)] 
MEDIUM: log: Unique ID

The Unique ID, is an ID generated with several informations. You can use
a log-format string to customize it, with the "unique-id-format" keyword,
and insert it in the request header, with the "unique-id-header" keyword.

13 years agoMEDIUM: log: New format-log flags: %Fi %Fp %Si %Sp %Ts %rt %H %pid
William Lallemand [Thu, 5 Apr 2012 16:02:55 +0000 (18:02 +0200)] 
MEDIUM: log: New format-log flags: %Fi %Fp %Si %Sp %Ts %rt %H %pid

%Fi: Frontend IP
%Fp: Frontend Port
%Si: Server IP
%Sp: Server Port
%Ts: Timestamp
%rt: HTTP request counter
%H: hostname
%pid: PID

+X: Hexadecimal represenation

The +X mode in logformat displays hexadecimal for the following flags
%Ci %Cp %Fi %Fp %Bi %Bp %Si %Sp %Ts %ct %pid

rename logformat_write_string() to lf_text()

Optimize size computation

13 years agoMEDIUM: log: split of log_format generation
William Lallemand [Mon, 12 Mar 2012 11:46:41 +0000 (12:46 +0100)] 
MEDIUM: log: split of log_format generation

* logformat functions now take a format linked list as argument
* build_logline() build a logline using a format linked list
* rename LOG_* by LOG_FMT_* in enum
* improve error management in build_logline()

13 years agoCLEANUP: Fix some minor whitespace issues
Aman Gupta [Sat, 7 Apr 2012 00:39:26 +0000 (17:39 -0700)] 
CLEANUP: Fix some minor whitespace issues

13 years agoMINOR: Add TO/FROM_SET flags to struct stream_interface
Aman Gupta [Tue, 3 Apr 2012 01:57:55 +0000 (18:57 -0700)] 
MINOR: Add TO/FROM_SET flags to struct stream_interface

[WT: it will make sense to remove SN_FRT_ADDR_SET and to use these
  flags everywhere instead ]

13 years agoCLEANUP: lb_first: add reference to a paper describing the original idea
Willy Tarreau [Sat, 7 Apr 2012 07:08:45 +0000 (09:08 +0200)] 
CLEANUP: lb_first: add reference to a paper describing the original idea

The original idea behind this implementation has been published in the
paper below :

   http://reports-archive.adm.cs.cmu.edu/anon/2012/CMU-CS-12-109.pdf

13 years agoMEDIUM: http: add cookie and scookie ACLs
Willy Tarreau [Fri, 6 Apr 2012 16:57:55 +0000 (18:57 +0200)] 
MEDIUM: http: add cookie and scookie ACLs

The ACL matches rely on the extract_cookie_value() function as used for
for patterns. This permits ACLs to match cookie values based on the cookie
name instead of having to perform substring matching on the cookie header.

13 years agoMEDIUM: http: make extract_cookie_value() iterate over cookie values
Willy Tarreau [Fri, 6 Apr 2012 16:20:06 +0000 (18:20 +0200)] 
MEDIUM: http: make extract_cookie_value() iterate over cookie values

This will make the function usable for ACLs.

13 years agoMEDIUM: log: add a new cookie flag 'U' to report situations where cookie is not used
Willy Tarreau [Thu, 5 Apr 2012 19:18:22 +0000 (21:18 +0200)] 
MEDIUM: log: add a new cookie flag 'U' to report situations where cookie is not used

This happens when a "use-server" rule sets the server instead.

13 years agoMEDIUM: session: implement the "use-server" directive
Willy Tarreau [Thu, 5 Apr 2012 19:09:48 +0000 (21:09 +0200)] 
MEDIUM: session: implement the "use-server" directive

Sometimes it is desirable to forward a particular request to a specific
server without having to declare a dedicated backend for this server. This
can be achieved using the "use-server" rules. These rules are evaluated after
the "redirect" rules and before evaluating cookies, and they have precedence
on them. There may be as many "use-server" rules as desired. All of these
rules are evaluated in their declaration order, and the first one which
matches will assign the server.

13 years agoCLEANUP: Fix some minor typos
Aman Gupta [Tue, 3 Apr 2012 01:57:54 +0000 (18:57 -0700)] 
CLEANUP: Fix some minor typos

13 years agoMINOR: Add release callback to si_applet
Aman Gupta [Tue, 3 Apr 2012 01:57:53 +0000 (18:57 -0700)] 
MINOR: Add release callback to si_applet

13 years agoMINOR: stats admin: reduce memcmp()/strcmp() calls on status codes
Cyril Bonté [Wed, 4 Apr 2012 10:57:21 +0000 (12:57 +0200)] 
MINOR: stats admin: reduce memcmp()/strcmp() calls on status codes

memcmp()/strcmp() calls were needed in different parts of code to determine
the status code. Each new status code introduces new calls, which can become
inefficient and source of bugs.
This patch reorganizes the code to rely on a numeric status code internally
and to be hopefully more generic.

13 years agoMINOR: stats admin: use the backend id instead of its name in the form
Cyril Bonté [Wed, 4 Apr 2012 10:57:20 +0000 (12:57 +0200)] 
MINOR: stats admin: use the backend id instead of its name in the form

Proxy ids are unique whereas names can be used several times in the
configuration. In order to prevent the ambiguity, the HTML form now provides
the backend id instead of its name (the name can still be provided in the POST
data).

13 years agoCLEANUP: fix typo in findserver() log message
Cyril Bonté [Wed, 4 Apr 2012 10:57:19 +0000 (12:57 +0200)] 
CLEANUP: fix typo in findserver() log message

There was a typo in the findserver() log message :
"found" was written "fould".

13 years agoMINOR: stats admin: allow unordered parameters in POST requests
Cyril Bonté [Wed, 4 Apr 2012 10:57:18 +0000 (12:57 +0200)] 
MINOR: stats admin: allow unordered parameters in POST requests

Previously, the stats admin page required POST parameters to be provided
exactly in the same order as the HTML form.
This patch allows to handle those parameters in any orders.

Also, note that haproxy won't alter server states anymore if backend or server
names are ambiguous (duplicated names in the configuration) to prevent
unexpected results (the same should probably be applied to the stats socket).

13 years agoMINOR: contrib/iprange: add a network IP range to mask converter
Willy Tarreau [Mon, 2 Apr 2012 19:44:05 +0000 (21:44 +0200)] 
MINOR: contrib/iprange: add a network IP range to mask converter

This tool has remained uncommitted in my development tree for almost a year.
Just minor polish and commit.

It can be used to convert some geolocation IP lists to ACLs.

13 years agoBUG/MEDIUM: balance source did not properly hash IPv6 addresses
Willy Tarreau [Sat, 31 Mar 2012 17:53:37 +0000 (19:53 +0200)] 
BUG/MEDIUM: balance source did not properly hash IPv6 addresses

The hash of IPv6 addresses was not properly aligned and resulted in the
last quarter of the address not being hashed. In practice, this is rarely
detected since MAC addresses are used in the second half. But this becomes
very visible with IPv6-mapped IPv4 addresses such as ::FFFF:1.2.3.4 where
the IPv4 part is never hashed.

This bug has been there forever, since introduction of "balance source" in
v1.2.11. The fix must then be backported to all stable versions.

Thanks to Alex Markham for reporting this issue to the list !

13 years agoBUG/MAJOR: log: possible segfault with logformat
William Lallemand [Mon, 26 Mar 2012 15:52:55 +0000 (17:52 +0200)] 
BUG/MAJOR: log: possible segfault with logformat

Possible zero-pointer deference in sess_log().
Checks of return values in sess_log() fix the issue.

Fix bad computation in logformat_write_string().

This issue is 1.5-specific and was introduced just before 1.5-dev8.
No backport is needed.

13 years ago[RELEASE] Released version 1.5-dev8 v1.5-dev8
Willy Tarreau [Mon, 26 Mar 2012 04:15:29 +0000 (06:15 +0200)] 
[RELEASE] Released version 1.5-dev8

Released version 1.5-dev8 with the following main changes :
    - MINOR: patch for minor typo (ressources/resources)
    - MEDIUM: http: add support for sending the server's name in the outgoing request
    - DOC: mention that default checks are TCP connections
    - BUG/MINOR: fix options forwardfor if-none when an alternative header name is specified
    - CLEANUP: Make check_statuses, analyze_statuses and process_chk static
    - CLEANUP: Fix HCHK spelling errors
    - BUG/MINOR: fix typo in processing of http-send-name-header
    - MEDIUM: log: Use linked lists for loggers
    - BUILD: fix declaration inside a scope block
    - REORG: log: split send_log function
    - MINOR: config: Parse the string of the log-format config keyword
    - MINOR: add ultoa, ulltoa, ltoa, lltoa implementations
    - MINOR: Date and time fonctions that don't use snprintf
    - MEDIUM: log: make http_sess_log use log_format
    - DOC: log-format documentation
    - MEDIUM: log: use log_format for mode tcplog
    - MEDIUM: log-format: backend source address %Bi %Bp
    - BUG/MINOR: log-format: fix %o flag
    - BUG/MEDIUM: bad length in log_format and __send_log
    - MINOR: logformat %st is signed
    - BUILD/MINOR: fix the source URL in the spec file
    - DOC: acl is http_first_req, not http_req_first
    - BUG/MEDIUM: don't trim last spaces from headers consisting only of spaces
    - MINOR: acl: add new matches for header/path/url length
    - BUILD: halog: make halog build on solaris
    - BUG/MINOR: don't use a wrong port when connecting to a server with mapped ports
    - MINOR: remove the client/server side distinction in SI addresses
    - MINOR: halog: add support for matching queued requests
    - DOC: indicate that cookie "prefix" and "indirect" should not be mixed
    - OPTIM/MINOR: move struct sockaddr_storage to the tail of structs
    - OPTIM/MINOR: make it possible to change pipe size (tune.pipesize)
    - BUILD/MINOR: silent a build warning in src/pipe.c (fcntl)
    - OPTIM/MINOR: move the hdr_idx pools out of the proxy struct
    - MEDIUM: tune.http.maxhdr makes it possible to configure the maximum number of HTTP headers
    - BUG/MINOR: fix a segfault when parsing a config with undeclared peers
    - CLEANUP: rename possibly confusing struct field "tracked"
    - BUG/MEDIUM: checks: fix slowstart behaviour when server tracking is in use
    - MINOR: config: tolerate server "cookie" setting in non-HTTP mode
    - MEDIUM: buffers: add some new primitives and rework existing ones
    - BUG: buffers: don't return a negative value on buffer_total_space_res()
    - MINOR: buffers: make buffer_pointer() support negative pointers too
    - CLEANUP: kill buffer_replace() and use an inline instead
    - BUG: tcp: option nolinger does not work on backends
    - CLEANUP: ebtree: remove a few annoying signedness warnings
    - CLEANUP: ebtree: clarify licence and update to 6.0.6
    - CLEANUP: ebtree: remove 4-year old harmless typo in duplicates insertion code
    - CLEANUP: ebtree: remove another typo, a wrong initialization in insertion code
    - BUG: ebtree: ebst_lookup() could return the wrong entry
    - OPTIM: stream_sock: reduce the amount of in-flight spliced data
    - OPTIM: stream_sock: save a failed recv syscall when splice returns EAGAIN
    - MINOR: acl: add support for TLS server name matching using SNI
    - BUG: http: re-enable TCP quick-ack upon incomplete HTTP requests
    - BUG: proto_tcp: don't try to bind to a foreign address if sin_family is unknown
    - MINOR: pattern: export the global temporary pattern
    - CLEANUP: patterns: get rid of pattern_data_setstring()
    - MEDIUM: acl: use temp_pattern to store fetched information in the "method" match
    - MINOR: acl: include pattern.h to make pattern migration more transparent
    - MEDIUM: pattern: change the pattern data integer from unsigned to signed
    - MEDIUM: acl: use temp_pattern to store any integer-type information
    - MEDIUM: acl: use temp_pattern to store any address-type information
    - CLEANUP: acl: integer part of acl_test is not used anymore
    - MEDIUM: acl: use temp_pattern to store any string-type information
    - CLEANUP: acl: remove last data fields from the acl_test struct
    - MEDIUM: http: replace get_ip_from_hdr2() with http_get_hdr()
    - MEDIUM: patterns: the hdr() pattern is now of type string
    - DOC: add minimal documentation on how ACLs work internally
    - DOC: add a coding-style file
    - OPTIM: halog: keep a fast path for the lines-count only
    - CLEANUP: silence a warning when building on sparc
    - BUG: http: tighten the list of allowed characters in a URI
    - MEDIUM: http: block non-ASCII characters in URIs by default
    - DOC: add some documentation from RFC3986 about URI format
    - BUG/MINOR: cli: correctly remove the whole table on "clear table"
    - BUG/MEDIUM: correctly disable servers tracking another disabled servers.
    - BUG/MEDIUM: zero-weight servers must not dequeue requests from the backend
    - MINOR: halog: add some help on the command line
    - BUILD: fix build error on FreeBSD
    - BUG: fix double free in peers config error path
    - MEDIUM: improve config check return codes
    - BUILD: make it possible to look for pcre in the default system paths
    - MINOR: config: emit a warning when 'default_backend' masks servers
    - MINOR: backend: rework the LC definition to support other connection-based algos
    - MEDIUM: backend: add the 'first' balancing algorithm
    - BUG: fix httplog trailing LF
    - MEDIUM: increase chunk-size limit to 2GB-1
    - BUG: queue: fix dequeueing sequence on HTTP keep-alive sessions
    - BUG: http: disable TCP delayed ACKs when forwarding content-length data
    - BUG: checks: fix server maintenance exit sequence
    - BUG/MINOR: stream_sock: don't remove BF_EXPECT_MORE and BF_SEND_DONTWAIT on partial writes
    - DOC: enumerate valid status codes for "observe layer7"
    - MINOR: buffer: switch a number of buffer args to const
    - CLEANUP: silence signedness warning in acl.c
    - BUG: stream_sock: si->release was not called upon shutw()
    - MINOR: log: use "%ts" to log term status only and "%tsc" to log with cookie
    - BUG/CRITICAL: log: fix risk of crash in development snapshot
    - BUG/MAJOR: possible crash when using capture headers on TCP frontends
    - MINOR: config: disable header captures in TCP mode and complain

13 years agoCLEANUP: Fix HCHK spelling errors
Simon Horman [Sun, 18 Mar 2012 22:25:28 +0000 (07:25 +0900)] 
CLEANUP: Fix HCHK spelling errors

13 years agoCLEANUP: Make check_statuses, analyze_statuses and process_chk static
Simon Horman [Sun, 18 Mar 2012 22:24:41 +0000 (07:24 +0900)] 
CLEANUP: Make check_statuses, analyze_statuses and process_chk static

These symbols are only used inside src/checks.c

13 years agoMINOR: config: disable header captures in TCP mode and complain
Willy Tarreau [Sat, 24 Mar 2012 07:33:05 +0000 (08:33 +0100)] 
MINOR: config: disable header captures in TCP mode and complain

In order to help users fix their configs, report a warning when a capture
has been set on a non-HTTP frontend.

This should be backported to 1.4.

13 years agoBUG/MAJOR: possible crash when using capture headers on TCP frontends
Willy Tarreau [Sat, 24 Mar 2012 07:28:09 +0000 (08:28 +0100)] 
BUG/MAJOR: possible crash when using capture headers on TCP frontends

Olufemi Omojola provided a config and a core showing a possible crash
when captures are configured on a TCP-mode frontend which branches to
an HTTP backend. The reason is that being in TCP mode, the frontend
does not allocate capture pools for the request, but the HTTP backend
tries to use them and dies on the NULL.

While such a config has long been unlikely to happen, it looks like
people using websocket tend to do this more often now.

Change the control to use the pointer instead of the number of captures
to know when to log.

This bug was reported in 1.4.20, so it must be backported there.

13 years agoMINOR: logformat %st is signed
William Lallemand [Thu, 22 Mar 2012 10:32:29 +0000 (11:32 +0100)] 
MINOR: logformat %st is signed

replace ultoa by ltoa for HTTP status code (can be -1)

13 years agoMINOR: patch for minor typo (ressources/resources)
Adrian Bridgett [Mon, 19 Mar 2012 23:36:42 +0000 (23:36 +0000)] 
MINOR: patch for minor typo (ressources/resources)

The main stats page says "ressources" (French spelling) rather than
"resources" (English spelling).

One little patch attached (against v1.4.20).

Many thanks,

Adrian

13 years agoBUG/MEDIUM: bad length in log_format and __send_log
William Lallemand [Mon, 19 Mar 2012 15:15:12 +0000 (16:15 +0100)] 
BUG/MEDIUM: bad length in log_format and __send_log

__send_log(): the size of the buffer sent is wrong when the facility
is lower than 3 digits.

logformat_write_string(): computation of size is wrong

Note: this was introduced after 1.5-dev7, no backport needed.

13 years agoBUG/CRITICAL: log: fix risk of crash in development snapshot
Willy Tarreau [Mon, 19 Mar 2012 15:51:53 +0000 (16:51 +0100)] 
BUG/CRITICAL: log: fix risk of crash in development snapshot

Commit a1cc38 introduced a regression which was easy to trigger till ad4cd58
(snapshots 20120222 to 20120311 included). The bug was still present after
that but harder to trigger.

The bug is caused by the use of two distinct log buffers due to intermediary
changes. The issue happens when an HTTP request is logged just after a TCP
request during the same second and the HTTP request is too large for the buffer.
In this case, it happens that the HTTP request is logged into the TCP buffer
instead and that length controls can't detect anything.

Starting with bddd4f, the issue is still possible when logging too large an
HTTP request just after a send_log() call (typically a server status change).

We owe a big thanks to Sander Klein for testing several snapshots and more
specifically for taking significant risks in production by letting the buggy
version crash several times in order to provide an exploitable core ! The bug
could not have been found without this precious help. Thank you Sander !

This fix does not need to be backported, it did not affect any released version.

13 years agoMINOR: log: use "%ts" to log term status only and "%tsc" to log with cookie
Willy Tarreau [Mon, 12 Mar 2012 14:09:42 +0000 (15:09 +0100)] 
MINOR: log: use "%ts" to log term status only and "%tsc" to log with cookie

The difference could be seen when logging a request in HTTP mode with option
tcplog, as it would keep emitting 4 chars. Better use two distinct flags to
clear the confusion.

13 years agoBUG/MINOR: log-format: fix %o flag
William Lallemand [Mon, 12 Mar 2012 10:03:47 +0000 (11:03 +0100)] 
BUG/MINOR: log-format: fix %o flag

The %o flag was not working at all.

13 years agoMEDIUM: log-format: backend source address %Bi %Bp
William Lallemand [Fri, 2 Mar 2012 13:35:21 +0000 (14:35 +0100)] 
MEDIUM: log-format: backend source address %Bi %Bp

%Bi return the backend source IP
%Bp return the backend source port

Add a function pointer in logformat_type to do additional configuration
during the log-format variable parsing.

13 years agoMEDIUM: log: use log_format for mode tcplog
William Lallemand [Mon, 27 Feb 2012 10:23:10 +0000 (11:23 +0100)] 
MEDIUM: log: use log_format for mode tcplog

Merge http_sess_log() and tcp_sess_log() to sess_log() and move it to
log.c

A new field in logformat_type define if you can use a logformat
variable in TCP or HTTP mode.

doc: log-format in tcp mode

Note that due to the way log buffer allocation currently works, trying to
log an HTTP request without "option httplog" is still not possible. This
will change in the near future.

13 years agoBUG: stream_sock: si->release was not called upon shutw()
Willy Tarreau [Sat, 10 Mar 2012 12:42:32 +0000 (13:42 +0100)] 
BUG: stream_sock: si->release was not called upon shutw()

The ->release function of the stream interface is never called upon
a shutw() because it's placed after a return statement. It is possible
that it has impacted inter-process stick-table replication by preventing
a full resync after certain sequences of connection breakage. Since this
bug has been present since the introduction of the ->release() callback,
it cannot have caused regressions, just possibly non-working situations.

This was detected at Exceliance by Emeric Brun during a code review. It
is 1.5-specific.

13 years agoCLEANUP: silence signedness warning in acl.c
Willy Tarreau [Sat, 10 Mar 2012 08:05:30 +0000 (09:05 +0100)] 
CLEANUP: silence signedness warning in acl.c

The recent SNI patch introduced a trivial warning in acl.c.

13 years agoMINOR: buffer: switch a number of buffer args to const
Willy Tarreau [Sat, 10 Mar 2012 07:55:07 +0000 (08:55 +0100)] 
MINOR: buffer: switch a number of buffer args to const

A number of offset computation functions use struct buffer* arguments
and return integers without modifying the input. Using consts helps
simplifying some operations in callers.

13 years agoDOC: enumerate valid status codes for "observe layer7"
Willy Tarreau [Sat, 10 Mar 2012 07:19:02 +0000 (08:19 +0100)] 
DOC: enumerate valid status codes for "observe layer7"

13 years agoBUG/MINOR: stream_sock: don't remove BF_EXPECT_MORE and BF_SEND_DONTWAIT on partial...
Willy Tarreau [Fri, 9 Mar 2012 17:10:44 +0000 (18:10 +0100)] 
BUG/MINOR: stream_sock: don't remove BF_EXPECT_MORE and BF_SEND_DONTWAIT on partial writes

The flags are one-shot but should be maintained over all send() operations
as long as send_max is not flushed. The flags were incidentely cleared once
a complete send() was performed, regardless of the fact that the send()
might have been on the first half of a buffer before a wrapping. The result
is that on wrapping data (eg: which happens often with chunked encoding),
many incomplete segments are transmitted instead of being aggregated.

The fix consists in only flushing the flags only once send_max is empty,
which was the expected behaviour.

This fix should be backported to 1.4 though it is not critical, just sub-optimal.

13 years agoBUG: checks: fix server maintenance exit sequence
Willy Tarreau [Fri, 9 Mar 2012 16:16:09 +0000 (17:16 +0100)] 
BUG: checks: fix server maintenance exit sequence

Recent commit 62c3be broke maintenance mode by fixing srv_is_usable().
Enabling a disabled server would not re-introduce it into the farm.
The reason is that in set_server_up(), the SRV_MAINTAIN flag is still
present when recounting the servers. The flag was removed late only to
adjust a log message. Keep a copy of the old flag instead and update
SRV_MAINTAIN earlier.

This fix must also be backported to 1.4 (but no release got the regression).

13 years agoBUG: http: disable TCP delayed ACKs when forwarding content-length data
Willy Tarreau [Mon, 5 Mar 2012 07:29:20 +0000 (08:29 +0100)] 
BUG: http: disable TCP delayed ACKs when forwarding content-length data

Commits 5c6209 and 072930 were aimed at avoiding undesirable PUSH flags
when forwarding chunked data, but had the undesired effect of causing
data advertised by content-length to be affected by the delayed ACK too.
This can happen when the data to be forwarded are small enough to fit into
a single send() call, otherwise the BF_EXPECT_MORE flag would be removed.

Content-length data don't need the BF_EXPECT_MORE flag since the low-level
forwarder already knows it can safely rely on bf->to_forward to set the
appropriate TCP flags.

Note that the issue is only observed in requests at the moment, though the
later introduction of server-side keep-alive could trigger the issue on the
response path too.

Special thanks to Randy Shults for reporting this issue with a lot of
details helping to reproduce it.

The fix must be backported to 1.4.

13 years agoBUG: queue: fix dequeueing sequence on HTTP keep-alive sessions
Willy Tarreau [Thu, 1 Mar 2012 22:34:37 +0000 (23:34 +0100)] 
BUG: queue: fix dequeueing sequence on HTTP keep-alive sessions

When a request completes on a server and the server connection is closed
while the client connection stays open, the HTTP engine releases all server
connection slots and scans the queues to offer the connection slot to
another pending request.

An issue happens when the released connection allows other requests to be
dequeued : may_dequeue_tasks() relies on srv->served which is only decremented
by sess_change_server() which itself is only called after may_dequeue_tasks().
This results in no connection being woken up until another connection terminates
so that may_dequeue_tasks() is called again.

This fix is minimalist and only moves sess_change_server() earlier (which is
safe). It should be reworked and the code factored out so that the same occurrence
in session.c shares the same code.

This bug has been there since the introduction of option-http-server-close and
the fix must be backported to 1.4.

13 years agoMEDIUM: increase chunk-size limit to 2GB-1
Willy Tarreau [Fri, 24 Feb 2012 18:20:12 +0000 (19:20 +0100)] 
MEDIUM: increase chunk-size limit to 2GB-1

Since commit 115acb97, chunk size was limited to 256MB. There is no reason for
such a limit and the comment on the code suggests a missing zero. However,
increasing the limit past 2 GB causes trouble due to some 32-bit subtracts
in various computations becoming negative (eg: buffer_max_len). So let's limit
the chunk size to 2 GB - 1 max.

13 years agoBUG: fix httplog trailing LF
Willy Tarreau [Fri, 24 Feb 2012 10:46:54 +0000 (11:46 +0100)] 
BUG: fix httplog trailing LF

commit a1cc3811 introduced an undesirable \0\n ending on HTTP log messages. This
is because of an extra character count passed to __send_log() which causes the LF
to be appended past the \0. Some syslog daemons thus log an extra empty line. The
fix is obvious. Fix the function comments to remind what they expect on their input.

This is past 1.5-dev7 regression so there's no backport needed.

13 years agoMEDIUM: backend: add the 'first' balancing algorithm
Willy Tarreau [Mon, 13 Feb 2012 16:12:08 +0000 (17:12 +0100)] 
MEDIUM: backend: add the 'first' balancing algorithm

The principle behind this load balancing algorithm was first imagined
and modeled by Steen Larsen then iteratively refined through several
work sessions until it would totally address its original goal.

The purpose of this algorithm is to always use the smallest number of
servers so that extra servers can be powered off during non-intensive
hours. Additional tools may be used to do that work, possibly by
locally monitoring the servers' activity.

The first server with available connection slots receives the connection.
The servers are choosen from the lowest numeric identifier to the highest
(see server parameter "id"), which defaults to the server's position in
the farm. Once a server reaches its maxconn value, the next server is used.
It does not make sense to use this algorithm without setting maxconn. Note
that it can however make sense to use minconn so that servers are not used
at full load before starting new servers, and so that introduction of new
servers requires a progressively increasing load (the number of servers
would more or less follow the square root of the load until maxconn is
reached). This algorithm ignores the server weight, and is more beneficial
to long sessions such as RDP or IMAP than HTTP, though it can be useful
there too.

13 years agoMINOR: backend: rework the LC definition to support other connection-based algos
Willy Tarreau [Mon, 13 Feb 2012 15:57:44 +0000 (16:57 +0100)] 
MINOR: backend: rework the LC definition to support other connection-based algos

The leastconn algorithm should be of kind "connection-based", not "leastconn"
if we want to later support other connection-based LB algos.

13 years agoMINOR: config: emit a warning when 'default_backend' masks servers
Willy Tarreau [Mon, 13 Feb 2012 13:32:34 +0000 (14:32 +0100)] 
MINOR: config: emit a warning when 'default_backend' masks servers

When a "listen" instance uses a "default_backned" rule and has servers,
the servers will never be used. Report it so that users don't get trapped.

13 years agoBUILD: make it possible to look for pcre in the default system paths
Willy Tarreau [Fri, 10 Feb 2012 18:46:59 +0000 (19:46 +0100)] 
BUILD: make it possible to look for pcre in the default system paths

If running "make PCREDIR=" will not force to add -I nor -L anymore.

13 years agoDOC: log-format documentation
William Lallemand [Mon, 30 Jan 2012 15:47:22 +0000 (16:47 +0100)] 
DOC: log-format documentation

13 years agoMEDIUM: log: make http_sess_log use log_format
William Lallemand [Wed, 8 Feb 2012 15:38:44 +0000 (16:38 +0100)] 
MEDIUM: log: make http_sess_log use log_format

http_sess_log now use the logformat linked list to make the log
string, snprintf is not used for speed issue.

CLF mode also uses logformat.

NOTE: as of now, empty fields in CLF now are "" not "-" anymore.

13 years agoMINOR: Date and time fonctions that don't use snprintf
William Lallemand [Mon, 6 Feb 2012 17:15:57 +0000 (18:15 +0100)] 
MINOR: Date and time fonctions that don't use snprintf

Also move human_time() to standard.c since it's not related to
timeval calculations.

13 years agoMINOR: add ultoa, ulltoa, ltoa, lltoa implementations
William Lallemand [Tue, 24 Jan 2012 10:15:39 +0000 (11:15 +0100)] 
MINOR: add ultoa, ulltoa, ltoa, lltoa implementations

Implementations that write result from left to right

13 years agoMINOR: config: Parse the string of the log-format config keyword
William Lallemand [Wed, 8 Feb 2012 15:37:49 +0000 (16:37 +0100)] 
MINOR: config: Parse the string of the log-format config keyword

parse_logformat_string: parse the string, detect the type: text,
        separator or variable

parse_logformat_var: dectect variable name

parse_logformat_var_args: parse arguments and flags

add_to_logformat_list: add to the logformat linked list

13 years agoREORG: log: split send_log function
William Lallemand [Mon, 6 Feb 2012 15:00:33 +0000 (16:00 +0100)] 
REORG: log: split send_log function

send_log function is now splited in 3 functions
* hdr_log: generate the syslog header
* send_log: send a syslog message with a printf format string
* __send_log: send a syslog message

13 years agoBUILD: fix declaration inside a scope block
William Lallemand [Mon, 30 Jan 2012 16:27:17 +0000 (17:27 +0100)] 
BUILD: fix declaration inside a scope block

13 years agoMEDIUM: improve config check return codes
Willy Tarreau [Thu, 2 Feb 2012 16:48:18 +0000 (17:48 +0100)] 
MEDIUM: improve config check return codes

When checking a configuration file using "-c -f xxx", sometimes it is
reported that a config is valid while it will later fail (eg: no enabled
listener). Instead, let's improve the return values :
  - return 0 if config is 100% OK
  - return 1 if config has errors
  - return 2 if config is OK but no listener nor peer is enabled

13 years agoBUG: fix double free in peers config error path
Willy Tarreau [Thu, 2 Feb 2012 16:06:13 +0000 (17:06 +0100)] 
BUG: fix double free in peers config error path

If the local host is not found as a peer in a "peers" section, we have a
double free, and possibly a use-after-free because the peers section is
freed since it's aliased as the table's name.

13 years agoDOC: mention that default checks are TCP connections
Patrick Mézard [Sun, 22 Jan 2012 15:01:22 +0000 (16:01 +0100)] 
DOC: mention that default checks are TCP connections