From c58fc6943d1e93e84d5875d0c36f0e7ee63696f8 Mon Sep 17 00:00:00 2001 From: willy tarreau Date: Sat, 17 Dec 2005 14:13:08 +0100 Subject: [PATCH] * released 1.1.26 * the fix introduced in 1.1.25 for client timeouts while waiting for servers broke almost all compatibility with POST requests, because the proxy stopped to read anything from the client as soon as it got all of its headers. --- CHANGELOG | 6 ++++++ haproxy.c | 30 +++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 33f201d96..2efba8092 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,12 @@ ChangeLog : =========== +2003/10/22 : 1.1.26 + - the fix introduced in 1.1.25 for client timeouts while waiting for servers + broke almost all compatibility with POST requests, because the proxy + stopped to read anything from the client as soon as it got all of its + headers. + 2003/10/15 : 1.1.25 - added the 'tcplog' option, which provides enhanced, HTTP-like logs for generic TCP proxies, or lighter logs for HTTP proxies. diff --git a/haproxy.c b/haproxy.c index ef46dfefd..776a23521 100644 --- a/haproxy.c +++ b/haproxy.c @@ -53,8 +53,8 @@ #include #endif -#define HAPROXY_VERSION "1.1.25" -#define HAPROXY_DATE "2003/10/15" +#define HAPROXY_VERSION "1.1.26" +#define HAPROXY_DATE "2003/10/22" /* this is for libc5 for example */ #ifndef TCP_NODELAY @@ -2464,6 +2464,16 @@ int process_cli(struct session *t) { * data state which will save one schedule. */ //break; + + if (!t->proxy->clitimeout || + (t->srv_state < SV_STDATA && t->proxy->srvtimeout)) + /* If the client has no timeout, or if the server is not ready yet, + * and we know for sure that it can expire, then it's cleaner to + * disable the timeout on the client side so that too low values + * cannot make the sessions abort too early. + */ + tv_eternity(&t->crexpire); + goto process_data; } @@ -2845,8 +2855,8 @@ int process_cli(struct session *t) { return 1; } - if (req->l >= req->rlim - req->data || t->srv_state < SV_STDATA) { - /* no room to read more data, or server not ready yet */ + if (req->l >= req->rlim - req->data) { + /* no room to read more data */ if (FD_ISSET(t->cli_fd, StaticReadEvent)) { /* stop reading until we get some space */ FD_CLR(t->cli_fd, StaticReadEvent); @@ -2857,10 +2867,16 @@ int process_cli(struct session *t) { /* there's still some space in the buffer */ if (! FD_ISSET(t->cli_fd, StaticReadEvent)) { FD_SET(t->cli_fd, StaticReadEvent); - if (t->proxy->clitimeout) - tv_delayfrom(&t->crexpire, &now, t->proxy->clitimeout); - else + if (!t->proxy->clitimeout || + (t->srv_state < SV_STDATA && t->proxy->srvtimeout)) + /* If the client has no timeout, or if the server not ready yet, and we + * know for sure that it can expire, then it's cleaner to disable the + * timeout on the client side so that too low values cannot make the + * sessions abort too early. + */ tv_eternity(&t->crexpire); + else + tv_delayfrom(&t->crexpire, &now, t->proxy->clitimeout); } }