From: wessels <> Date: Thu, 17 Jun 1999 03:23:31 +0000 (+0000) Subject: Added redirector_bypass option, written for Deere and Company X-Git-Tag: SQUID_3_0_PRE1~2154 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=07476a7fd727d70833a2d0f2ffc747d4016f8ed9;p=thirdparty%2Fsquid.git Added redirector_bypass option, written for Deere and Company --- diff --git a/src/cf.data.pre b/src/cf.data.pre index 83a99d0175..5aaead814c 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -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 diff --git a/src/redirect.cc b/src/redirect.cc index 1e2443e463..758097d437 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -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); diff --git a/src/structs.h b/src/structs.h index 047cd3d9ea..69ac4973f1 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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 {