]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added icap_connect_timeout and icap_io_timeout squid.conf options to control
authorrousskov <>
Wed, 20 Jun 2007 03:03:45 +0000 (03:03 +0000)
committerrousskov <>
Wed, 20 Jun 2007 03:03:45 +0000 (03:03 +0000)
how long an ICAP transaction should wait for the ICAP server to accept its
connection or process the next I/O. These options are needed for many optional
ICAP services that are poorly reachable or otherwise delay network I/Os.
Waiting for a service is harmful to user experience, especially when the
service failure or lack of connectivity can be bypassed.

The two knobs use HTTP option values as defaults and have different defaults
for essential and optional services. This may be a bad idea and will change
depending on user feedback.

All timeouts are currently global. Eventually, we will need per-service or
service group timeouts and, possibly, even an OPTIONS-specific timeout.

Merged from the squid3-icap branch.

src/ICAP/ICAPConfig.cc
src/ICAP/ICAPConfig.h
src/cf.data.pre

index 8eec11a00f457be4b84a471c0c17a1eaaf42580f..f41092cecf6114b8160bad70ee228987d8393a28 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ICAPConfig.cc,v 1.16 2007/05/29 13:31:43 amosjeffries Exp $
+ * $Id: ICAPConfig.cc,v 1.17 2007/06/19 21:03:46 rousskov Exp $
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
  * ----------------------------------------------------------
@@ -431,3 +431,20 @@ ICAPConfig::~ICAPConfig()
     classes.clean();
 
 };
+
+time_t ICAPConfig::connect_timeout(bool bypassable) const
+{
+    if (connect_timeout_raw > 0)
+        return connect_timeout_raw; // explicitly configured
+
+    return bypassable ? Config.Timeout.peer_connect : Config.Timeout.connect;
+}
+
+time_t ICAPConfig::io_timeout(bool) const
+{
+    if (io_timeout_raw > 0)
+        return io_timeout_raw; // explicitly configured
+    // TODO: provide a different default for an ICAP transaction that 
+    // can still be bypassed
+    return Config.Timeout.read; 
+}
index 7741d85ed3bf53c0d998da164ac987ab89b70b87..e9994238d2c44988480ae7b50675e2e074af0883 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: ICAPConfig.h,v 1.13 2007/05/29 13:31:44 amosjeffries Exp $
+ * $Id: ICAPConfig.h,v 1.14 2007/06/19 21:03:46 rousskov Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -96,6 +96,8 @@ public:
     int onoff;
     int preview_enable;
     int preview_size;
+    time_t connect_timeout_raw;
+    time_t io_timeout_raw;
     int default_options_ttl;
     int send_client_ip;
     int send_client_username;
@@ -112,6 +114,9 @@ public:
 
     ~ICAPConfig();
 
+    time_t connect_timeout(bool bypassable) const;
+    time_t io_timeout(bool bypassable) const;
+
     void parseICAPService(void);
     void freeICAPService(void);
     void dumpICAPService(StoreEntry *, const char *);
index fada4e4cb6d6abc32cd7ce60f2b242a9f1874980..35ee11879b06f5dca2d21d66239816d9d63dafa4 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.438 2007/05/26 06:38:03 wessels Exp $
+# $Id: cf.data.pre,v 1.439 2007/06/19 21:03:45 rousskov Exp $
 #
 #
 # SQUID Web Proxy Cache                http://www.squid-cache.org/
@@ -4997,6 +4997,36 @@ DOC_START
     If you want to enable the ICAP module support, set this to on.
 DOC_END
 
+NAME: icap_connect_timeout
+TYPE: time_t
+DEFAULT: none
+LOC: TheICAPConfig.connect_timeout_raw
+IFDEF: ICAP_CLIENT
+DOC_START
+       This parameter specifies how long to wait for the TCP connect to
+       the requested ICAP server to complete before giving up and either
+       terminating the HTTP transaction or bypassing the failure.
+
+       The default for optional services is peer_connect_timeout.
+       The default for essential services is connect_timeout.
+       If this option is explicitly set, its value applies to all services.
+DOC_END
+
+NAME: icap_io_timeout
+COMMENT: time-units
+TYPE: time_t
+DEFAULT: none
+LOC: TheICAPConfig.io_timeout_raw
+IFDEF: ICAP_CLIENT
+DOC_START
+       This parameter specifies how long to wait for an I/O activity on
+       an established, active ICAP connection before giving up and
+       either terminating the HTTP transaction or bypassing the
+       failure.
+
+       The default is read_timeout.
+DOC_END
+
 NAME: icap_service_failure_limit
 TYPE: int
 IFDEF: ICAP_CLIENT