From 3bed5e9337fd6eeab0f0006ebefcbe98ee5c4f9f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 7 May 2014 14:50:10 +0200 Subject: [PATCH] BUG/MEDIUM: http: disable server-side expiration until client has sent the body 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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/proto_http.c b/src/proto_http.c index 797b3b8b5..1b96e3fd4 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -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;