From: Willy Tarreau Date: Sat, 17 Jul 2010 06:02:58 +0000 (+0200) Subject: [MEDIUM] http: forward client's close when abortonclose is set X-Git-Tag: v1.5-dev8~491 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5c54c7146345d8886921ae8c324aa5ae8a797542;p=thirdparty%2Fhaproxy.git [MEDIUM] http: forward client's close when abortonclose is set While it's usually desired to wait for a server response even when the client closes its request channel, it can be problematic with long polling requests. In order to let the server decide what to do in such a case, if option abortonclose is set, we simply forward the shutdown to the server. That way, it can decide to take the appropriate action. Most servers will still process the request, while some will probably want to abort. Obviously, this only works as long as the client has not sent another pipelined request over the same connection. (was commit 0e25d86da49827ff6aa3c94132c01292b5ba4854 in 1.4) --- diff --git a/src/proto_http.c b/src/proto_http.c index 1d126fc5c1..d737cfe543 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -4257,6 +4257,18 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit) goto return_bad_req; return 1; } + + /* If "option abortonclose" is set on the backend, we + * want to monitor the client's connection and forward + * any shutdown notification to the server, which will + * decide whether to close or to go on processing the + * request. + */ + if (s->be->options & PR_O_ABRT_CLOSE) { + buffer_auto_read(req); + buffer_auto_close(req); + } + return 0; } }