]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added redirector_bypass option, written for Deere and Company
authorwessels <>
Thu, 17 Jun 1999 03:23:31 +0000 (03:23 +0000)
committerwessels <>
Thu, 17 Jun 1999 03:23:31 +0000 (03:23 +0000)
src/cf.data.pre
src/redirect.cc
src/structs.h

index 83a99d01750c62066c3a2162259af38bf32d65ca..5aaead814c6a8a2384a9ac2d6ecf228a8e7cfb2d 100644 (file)
@@ -1,6 +1,6 @@
 
 #
-# $Id: cf.data.pre,v 1.155 1999/05/19 19:57:36 wessels Exp $
+# $Id: cf.data.pre,v 1.156 1999/06/16 21:23:31 wessels Exp $
 #
 #
 # SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -2906,4 +2906,20 @@ DOC_START
        and coredump files will be left there.
 DOC_END
 
+NAME: redirector_bypass
+TYPE: onoff
+LOC: Config.onoff.redirector_bypass
+DEFAULT: off
+DOC_START
+       When this is 'on', a request will not go through the
+       redirector if all redirectors are busy.  If this is 'off'
+       and the redirector queue grows too large, Squid will exit
+       with a FATAL erorr and ask you to increase the number of
+       redirectors.  You should only enable this if the redirectors
+       are not critical to your caching system.  If you use
+       redirectors for access control, and you enable this option,
+       then users may have access to pages that they should not
+       be allowed to request.
+DOC_END
+
 EOF
index 1e2443e463ed73ff7d3b24e30c811801ecc65bf6..758097d437c4155ec3743a0b4a0cc364b2959baf 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: redirect.cc,v 1.79 1999/04/07 21:39:06 wessels Exp $
+ * $Id: redirect.cc,v 1.80 1999/06/16 21:23:32 wessels Exp $
  *
  * DEBUG: section 29    Redirector
  * AUTHOR: Duane Wessels
@@ -48,6 +48,7 @@ static HLPCB redirectHandleReply;
 static void redirectStateFree(redirectStateData * r);
 static helper *redirectors = NULL;
 static OBJH redirectStats;
+static int n_bypassed = 0;
 
 static void
 redirectHandleReply(void *data, char *reply)
@@ -81,6 +82,9 @@ redirectStats(StoreEntry * sentry)
 {
     storeAppendPrintf(sentry, "Redirector Statistics:\n");
     helperStats(sentry, redirectors);
+    if (Config.onoff.redirector_bypass)
+       storeAppendPrintf(sentry, "\nNumber of requests bypassed "
+           "because all redirectors were busy: %d\n", n_bypassed);
 }
 
 /**** PUBLIC FUNCTIONS ****/
@@ -99,6 +103,12 @@ redirectStart(clientHttpRequest * http, RH * handler, void *data)
        handler(data, NULL);
        return;
     }
+    if (Config.onoff.redirector_bypass && redirectors->stats.queue_size) {
+       /* Skip redirector if there is one request queued */
+       n_bypassed++;
+       handler(data, NULL);
+       return;
+    }
     r = xcalloc(1, sizeof(redirectStateData));
     cbdataAdd(r, cbdataXfree, 0);
     r->orig_url = xstrdup(http->uri);
index 047cd3d9ea0d5918cc1d03f2d061690b4b9c8662..69ac4973f19691c374d3504fbd987a837bcd5805 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.297 1999/06/16 21:22:14 wessels Exp $
+ * $Id: structs.h,v 1.298 1999/06/16 21:23:34 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -387,6 +387,7 @@ struct _SquidConfig {
        int redir_rewrites_host;
        int prefer_direct;
        int strip_query_terms;
+       int redirector_bypass;
     } onoff;
     acl *aclList;
     struct {