From: Willy Tarreau Date: Sun, 21 Apr 2013 06:04:22 +0000 (+0200) Subject: BUG/MEDIUM: stats: fix a regression when dealing with POST requests X-Git-Tag: v1.5-dev19~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7fe3300b7686054be4c289abc935a4241491c5ea;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: stats: fix a regression when dealing with POST requests In 1.5-dev17 (commit 1facd6d6), we reorganized the way HTTP stats requests are handled. When moving the code, we dropped a "return 0" which happens upon incomplete POST request, so we now end up with the next return 1 which causes processing to go on with next analyser. This causes incomplete POST requests to try to forward the request to servers, resulting in either a 404 or a 503 depending on the configuration. This patch fixes this regression to restore the previous behaviour. It's not enough though, as it happens that the stats code is handled after all http header processing but in the same function. The net effect is that incomplete requests cause the headers manipulation to be performed multiple times, possibly resulting in multiple headers in the request buffer. Since the stats requests are not meant to be forwarded, it's not an issue yet but this is something to take care of later. A remaining issue that's not handled yet is that if the client does not send the complete POST headers, then the request is finally forwarded. This is not a regression, it has always been there and seems to be caused by the lack of timeout processing when waiting for the POST body. The solution to this issue would be to move the handling of stats requests into a dedicated analyser placed after http_process_request_body(). Bug reported by Guillaume de Lafond. --- diff --git a/src/proto_http.c b/src/proto_http.c index 610d5a57fa..d1bf51ead0 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -3629,6 +3629,7 @@ int http_process_req_common(struct session *s, struct channel *req, int an_bit, /* we need more data, let's come back here later */ req->analysers |= an_bit; channel_dont_connect(req); + return 0; } return 1; }