haproxy/src
Willy Tarreau bb2e669f9e BUG/MAJOR: http: correctly rewind the request body after start of forwarding
Daniel Dubovik reported an interesting bug showing that the request body
processing was still not 100% fixed. If a POST request contained short
enough data to be forwarded at once before trying to establish the
connection to the server, we had no way to correctly rewind the body.

The first visible case is that balancing on a header does not always work
on such POST requests since the header cannot be found. But there are even
nastier implications which are that http-send-name-header would apply to
the wrong location and possibly even affect part of the request's body
due to an incorrect rewinding.

There are two options to fix the problem :
  - first one is to force the HTTP_MSG_F_WAIT_CONN flag on all hash-based
    balancing algorithms and http-send-name-header, but there's always a
    risk that any new algorithm forgets to set it ;

  - the second option is to account for the amount of skipped data before
    the connection establishes so that we always know the position of the
    request's body relative to the buffer's origin.

The second option is much more reliable and fits very well in the spirit
of the past changes to fix forwarding. Indeed, at the moment we have
msg->sov which points to the start of the body before headers are forwarded
and which equals zero afterwards (so it still points to the start of the
body before forwarding data). A minor change consists in always making it
point to the start of the body even after data have been forwarded. It means
that it can get a negative value (so we need to change its type to signed)..

In order to avoid wrapping, we only do this as long as the other side of
the buffer is not connected yet.

Doing this definitely fixes the issues above for the requests. Since the
response cannot be rewound we don't need to perform any change there.

This bug was introduced/remained unfixed in 1.5-dev23 so the fix must be
backported to 1.5.
2014-07-10 19:29:45 +02:00
..
acl.c MINOR: acl: set "str" as default match for strings 2014-05-12 15:19:15 +02:00
appsession.c BUILD: definitely silence some stupid GCC warnings 2013-12-13 15:21:36 +01:00
arg.c MINOR: arg: improve wording on error reporting 2013-12-13 00:38:47 +01:00
auth.c MINOR: fix a few memory usage errors 2014-05-15 08:06:57 +02:00
backend.c BUG/MEDIUM: backend: Update hash to use unsigned int throughout 2014-07-08 22:00:21 +02:00
base64.c [MINOR] add encode/decode function for 30-bit integers from/to base64 2010-10-30 19:04:33 +02:00
buffer.c MINOR: buffer: align the last output line if there are less than 8 characters left 2013-11-21 08:07:04 +01:00
cfgparse.c MEDIUM: log: support a user-configurable max log line length 2014-06-27 18:13:53 +02:00
channel.c BUG/MEDIUM: channel: bi_putblk() must not wrap before the end of buffer 2014-04-24 17:19:21 +02:00
checks.c BUILD: checks: kill a minor warning on Solaris in external checks 2014-07-08 01:13:33 +02:00
chunk.c BUG/MINOR: chunk: Fix function chunk_strcmp and chunk_strcasecmp match a substring. 2014-05-09 19:16:13 +02:00
compression.c BUG/MINOR: compression: correctly report incoming byte count 2014-04-23 19:31:17 +02:00
connection.c BUG/MINOR: ssl: Fix external function in order not to return a pointer on an internal trash buffer. 2014-06-24 22:39:16 +02:00
cttproxy.c CLEANUP: cttproxy: remove a warning on undeclared close() 2012-10-05 22:18:07 +02:00
dumpstats.c MINOR: stats: fix minor typo in HTML page 2014-07-02 17:49:34 +02:00
ev_epoll.c BUG/MEDIUM: polling: fix possible CPU hogging of worker processes after receiving SIGUSR1. 2014-05-20 14:57:36 +02:00
ev_kqueue.c MINOR: polling: create function fd_compute_new_polled_status() 2014-01-26 00:42:32 +01:00
ev_poll.c MINOR: polling: create function fd_compute_new_polled_status() 2014-01-26 00:42:32 +01:00
ev_select.c MINOR: polling: create function fd_compute_new_polled_status() 2014-01-26 00:42:32 +01:00
fd.c BUG/MEDIUM: polling: fix possible CPU hogging of worker processes after receiving SIGUSR1. 2014-05-20 14:57:36 +02:00
freq_ctr.c BUG/MINOR: time: frequency counters are not totally accurate 2012-12-29 21:50:07 +01:00
frontend.c MINOR: logs: don't limit HTTP header captures to HTTP frontends 2014-06-13 16:32:48 +02:00
haproxy-systemd-wrapper.c MINOR: systemd wrapper: propagate exit status 2014-04-17 18:11:11 +02:00
haproxy.c MEDIUM: regex: replace all standard regex function by own functions 2014-06-18 15:07:57 +02:00
hash.c BUG/MEDIUM: backend: Update hash to use unsigned int throughout 2014-07-08 22:00:21 +02:00
hdr_idx.c OPTIM/MINOR: move the hdr_idx pools out of the proxy struct 2011-10-24 18:15:04 +02:00
i386-linux-vsys.c MEDIUM: listener: add support for linux's accept4() syscall 2012-10-08 20:11:03 +02:00
lb_chash.c REORG/MEDIUM: server: split server state and flags in two different variables 2014-05-22 11:27:00 +02:00
lb_fas.c REORG/MEDIUM: server: split server state and flags in two different variables 2014-05-22 11:27:00 +02:00
lb_fwlc.c REORG/MEDIUM: server: split server state and flags in two different variables 2014-05-22 11:27:00 +02:00
lb_fwrr.c REORG/MEDIUM: server: split server state and flags in two different variables 2014-05-22 11:27:00 +02:00
lb_map.c MINOR: server: make use of srv_is_usable() instead of checking eweight 2014-05-23 14:29:11 +02:00
listener.c MEDIUM: listener: support rebinding during resume() 2014-07-08 01:13:35 +02:00
log.c MEDIUM: log: support a user-configurable max log line length 2014-06-27 18:13:53 +02:00
map.c BUG/MEDIUM: patterns: last fix was still not enough 2014-04-28 14:19:17 +02:00
memory.c MINOR: cli: add the new "show pools" command 2014-01-28 16:50:35 +01:00
pattern.c MINOR: regex: Create JIT compatible function that return match strings 2014-06-18 15:07:50 +02:00
payload.c BUG/MINOR: acl: req_ssl_sni fails with SSLv3 record version 2014-04-10 23:30:59 +02:00
peers.c BUG/MEDIUM: peers: fix key consistency for integer stick tables 2014-02-16 08:14:16 +01:00
pipe.c BUILD/MINOR: silent a build warning in src/pipe.c (fcntl) 2011-10-24 17:09:22 +02:00
proto_http.c BUG/MAJOR: http: correctly rewind the request body after start of forwarding 2014-07-10 19:29:45 +02:00
proto_tcp.c MEDIUM: listener: implement a per-protocol pause() function 2014-07-08 01:13:34 +02:00
proto_uxst.c BUG/MEDIUM: unix: completely unbind abstract sockets during a pause() 2014-07-08 01:13:35 +02:00
protocol.c REORG: split "protocols" files into protocol and listener 2012-09-15 22:29:32 +02:00
proxy.c MEDIUM: proxy: make timeout parser a bit stricter 2014-05-22 08:26:41 +02:00
queue.c MINOR: server: make use of srv_is_usable() instead of checking eweight 2014-05-23 14:29:11 +02:00
raw_sock.c BUG/MINOR: raw_sock: also consider ENOTCONN in addition to EAGAIN for recv() 2014-03-04 07:27:18 +01:00
rbtree.c [MINOR] imported the rbtree function from Linux kernel 2007-01-07 02:12:57 +01:00
regex.c MINOR: regex: Use native PCRE API. 2014-06-18 15:14:00 +02:00
sample.c MINOR: samples: add two converters for the date format 2014-07-10 16:43:44 +02:00
server.c MAJOR: checks: add support for a new "drain" administrative mode 2014-05-23 14:29:11 +02:00
session.c MINOR: stick-table: make stktable_fetch_key() indicate why it failed 2014-06-25 17:17:53 +02:00
sessionhash.c [PATCH] appsessions: cleanup DEBUG_HASH and initialize request_counter 2008-08-13 23:43:26 +02:00
shctx.c MINOR: stats: add counters for SSL cache lookups and misses 2014-05-28 16:53:04 +02:00
signal.c BUG/MEDIUM: signal: signal handler does not properly check for signal bounds 2013-01-24 16:19:19 +01:00
ssl_sock.c BUG/MINOR: ssl: Fix external function in order not to return a pointer on an internal trash buffer. 2014-06-24 22:39:16 +02:00
standard.c MINOR: tools: add new functions to quote-encode strings 2014-06-16 18:20:14 +02:00
stick_table.c MEDIUM: stick-table: add new converters to fetch table data 2014-07-10 16:43:44 +02:00
stream_interface.c MEDIUM: connection: Implement and extented PROXY Protocol V2 2014-05-09 08:25:38 +02:00
task.c [OPTIM] task: don't scan the run queue if we know it's empty 2011-09-10 20:08:49 +02:00
time.c BUG/MINOR: time: frequency counters are not totally accurate 2012-12-29 21:50:07 +01:00
trace.c MINOR: add a new function call tracer for debugging purposes 2012-05-26 00:12:37 +02:00
uri_auth.c BUG/MEDIUM: uri_auth: missing NULL check and memory leak on memory shortage 2013-01-24 16:19:19 +01:00