]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: http: disable server-side expiration until client has sent the body
authorWilly Tarreau <w@1wt.eu>
Wed, 7 May 2014 12:50:10 +0000 (14:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 May 2014 13:23:52 +0000 (15:23 +0200)
It's the final part of the 2 previous patches. We prevent the server from
timing out if we still have some data to pass to it. That way, even if the
server runs with a short timeout and the client with a large one, the server
side timeout will only start to count once the client sends everything. This
ensures we don't report a 504 before the server gets the whole request.

It is not certain whether the 1.4 state machine is fully compatible with
this change. Since the purpose is only to ensure that we never report a
server error before a client error if some data are missing from the client
and when the server-side timeout is smaller than or equal to the client's,
it's probably not worth attempting the backport.

src/proto_http.c

index 797b3b8b560b50af7733ae4dbc26e9d15a1ea6eb..1b96e3fd47a4bf136eef2d90562eed6a79dc5cfc 100644 (file)
@@ -5791,6 +5791,12 @@ int http_wait_for_response(struct session *s, struct channel *rep, int an_bit)
                        return 0;
                }
 
+               /* we don't want to expire on the server side first until the client
+                * has sent all the expected message body.
+                */
+               if (txn->req.msg_state >= HTTP_MSG_BODY && txn->req.msg_state < HTTP_MSG_DONE)
+                       rep->flags |= CF_READ_NOEXP;
+
                channel_dont_close(rep);
                rep->flags |= CF_READ_DONTWAIT; /* try to get back here ASAP */
                return 0;