From: Willy Tarreau Date: Sun, 12 Jul 2009 08:03:17 +0000 (+0200) Subject: [MINOR] http: take http request timeout from the backend X-Git-Tag: v1.4-dev1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd7afc0a13f21efcfe261b04d4327d048d5d3e50;p=thirdparty%2Fhaproxy.git [MINOR] http: take http request timeout from the backend Since we can now switch from TCP to HTTP, we need to be able to apply the HTTP request timeout after switching. That means we need to take it from the backend and not from the frontend. Since the backend points to the frontend before switching, that changes nothing for the normal case. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index eafb8cfeb6..e9a7fcb9c2 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -757,7 +757,7 @@ timeout client X X X - timeout clitimeout X X X - (deprecated) timeout connect X - X X timeout contimeout X - X X (deprecated) -timeout http-request X X X - +timeout http-request X X X X timeout queue X - X X timeout server X - X X timeout srvtimeout X - X X (deprecated) @@ -4107,7 +4107,7 @@ timeout contimeout (deprecated) timeout http-request Set the maximum allowed time to wait for a complete HTTP request May be used in sections : defaults | frontend | listen | backend - yes | yes | yes | no + yes | yes | yes | yes Arguments : is the timeout value specified in milliseconds by default, but can be in any other unit if the number is suffixed by the unit, @@ -4133,7 +4133,9 @@ timeout http-request will prevent people from sending bare HTTP requests using telnet. If this parameter is not set, the client timeout still applies between each - chunk of the incoming request. + chunk of the incoming request. It should be set in the frontend to take + effect, unless the frontend is in TCP mode, in which case the HTTP backend's + timeout will be used. See also : "timeout client". diff --git a/src/cfgparse.c b/src/cfgparse.c index a7dbe02478..73446a4321 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -865,6 +865,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) curproxy->timeout.check = defproxy.timeout.check; curproxy->timeout.queue = defproxy.timeout.queue; curproxy->timeout.tarpit = defproxy.timeout.tarpit; + curproxy->timeout.httpreq = defproxy.timeout.httpreq; curproxy->source_addr = defproxy.source_addr; } diff --git a/src/proto_http.c b/src/proto_http.c index 229d71f48f..0711bdc834 100644 --- a/src/proto_http.c +++ b/src/proto_http.c @@ -1688,7 +1688,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit) /* just set the request timeout once at the beginning of the request */ if (!tick_isset(req->analyse_exp)) - req->analyse_exp = tick_add_ifset(now_ms, s->fe->timeout.httpreq); + req->analyse_exp = tick_add_ifset(now_ms, s->be->timeout.httpreq); /* we're not ready yet */ return 0; @@ -2535,7 +2535,7 @@ int http_process_request_body(struct session *s, struct buffer *req, int an_bit) */ buffer_write_dis(req); if (!tick_isset(req->analyse_exp)) - req->analyse_exp = tick_add_ifset(now_ms, s->fe->timeout.httpreq); + req->analyse_exp = tick_add_ifset(now_ms, s->be->timeout.httpreq); return 0; } } diff --git a/src/proxy.c b/src/proxy.c index 7f11a19b35..f6c142f9b0 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -113,7 +113,7 @@ static int proxy_parse_timeout(char **args, int section, struct proxy *proxy, } else if (!strcmp(args[0], "http-request")) { tv = &proxy->timeout.httpreq; td = &defpx->timeout.httpreq; - cap = PR_CAP_FE; + cap = PR_CAP_FE | PR_CAP_BE; } else if (!strcmp(args[0], "server") || !strcmp(args[0], "srvtimeout")) { name = "server"; tv = &proxy->timeout.server;