]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MINOR] http: take http request timeout from the backend
authorWilly Tarreau <w@1wt.eu>
Sun, 12 Jul 2009 08:03:17 +0000 (10:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 12 Jul 2009 08:03:17 +0000 (10:03 +0200)
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.

doc/configuration.txt
src/cfgparse.c
src/proto_http.c
src/proxy.c

index eafb8cfeb64f9bda76ccbe810510bbe9a1f36933..e9a7fcb9c2cae0fbed611d8f8d6d1816ceaf4376 100644 (file)
@@ -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 <timeout> (deprecated)
 timeout http-request <timeout>
   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 :
     <timeout> 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 <timeout>
   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".
 
index a7dbe02478c020357734bd65d9d04975c46779d5..73446a43218349f7dcc41a77fa66e7c3034d2f8c 100644 (file)
@@ -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;
                }
 
index 229d71f48feaa0158c8e4d7b03bf79914b24b0b7..0711bdc834519e12a64e8c7416c8073874d0a9a7 100644 (file)
@@ -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;
        }
 }
index 7f11a19b35b3bd25b8501cca33a9e5a35e9b9f46..f6c142f9b00dd2c8f69b8b4b31eb6fd684b025d3 100644 (file)
@@ -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;