haproxy/doc
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
..
design-thoughts DOC: commit a few old design thoughts files 2014-06-19 21:02:32 +02:00
internals BUG/MAJOR: http: correctly rewind the request body after start of forwarding 2014-07-10 19:29:45 +02:00
acl.fig [DOC] add diagrams of queuing and future ACL design 2009-02-22 16:46:38 +01:00
architecture.txt MINOR: patch for minor typo (ressources/resources) 2012-03-21 07:54:41 +01:00
close-options.txt [DOC] add a few old and uncommitted docs 2011-09-05 01:04:44 +02:00
coding-style.txt DOC: add a coding-style file 2011-12-30 17:33:27 +01:00
configuration.txt MINOR: samples: add two converters for the date format 2014-07-10 16:43:44 +02:00
cookie-options.txt [DOC] add a few old and uncommitted docs 2011-09-05 01:04:44 +02:00
gpl.txt [LICENSE] licensing clarifications 2006-06-15 21:48:13 +02:00
haproxy-en.txt MEDIUM: New cli option -Ds for systemd compatibility 2013-02-13 10:47:49 +01:00
haproxy-fr.txt MEDIUM: New cli option -Ds for systemd compatibility 2013-02-13 10:47:49 +01:00
haproxy.1 DOC: fix a few config typos. 2014-04-14 14:03:08 +02:00
lgpl.txt [LICENSE] licensing clarifications 2006-06-15 21:48:13 +02:00
proxy-protocol.txt DOC: minor updates to the proxy protocol doc 2014-06-14 11:46:02 +02:00
queuing.fig [DOC] add diagrams of queuing and future ACL design 2009-02-22 16:46:38 +01:00