]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
renamed refresh_t to RefreshPattern and moved to own header file.
authorFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 10 Sep 2012 07:59:18 +0000 (09:59 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Mon, 10 Sep 2012 07:59:18 +0000 (09:59 +0200)
src/Makefile.am
src/RefreshPattern.h [new file with mode: 0644]
src/SquidConfig.h
src/cache_cf.cc
src/http.cc
src/refresh.cc
src/refresh.h
src/structs.h

index 54e6ad0ad6820aa16c82de554c45db185e865c48..bd3937f6e0dd908f3b6241de6c3fa5f76e978178 100644 (file)
@@ -271,6 +271,7 @@ squid_SOURCES = \
        AuthReg.h \
        YesNoNone.h \
        YesNoNone.cc \
+       RefreshPattern.h \
        cache_cf.cc \
        CacheDigest.h \
        CacheDigest.cc \
@@ -1381,6 +1382,7 @@ tests_testCacheManager_SOURCES = \
        AuthReg.h \
        YesNoNone.h \
        YesNoNone.cc \
+       RefreshPattern.h \
        cache_cf.cc \
        CacheDigest.h \
        CacheDigest.cc \
@@ -1771,6 +1773,7 @@ tests_testEvent_SOURCES = \
        AuthReg.h \
        YesNoNone.h \
        YesNoNone.cc \
+       RefreshPattern.h \
        cache_cf.cc \
        cache_manager.cc \
        carp.h \
@@ -2008,6 +2011,7 @@ tests_testEventLoop_SOURCES = \
        AuthReg.h \
        YesNoNone.h \
        YesNoNone.cc \
+       RefreshPattern.h \
        cache_cf.cc \
        carp.h \
        carp.cc \
@@ -2240,6 +2244,7 @@ tests_test_http_range_SOURCES = \
        AuthReg.h \
        YesNoNone.h \
        YesNoNone.cc \
+       RefreshPattern.h \
        cache_cf.cc \
        cache_manager.cc \
        CacheDigest.h \
@@ -2528,6 +2533,7 @@ tests_testHttpRequest_SOURCES = \
        AuthReg.h \
        YesNoNone.h \
        YesNoNone.cc \
+       RefreshPattern.h \
        cache_cf.cc \
        debug.cc \
        CacheDigest.h \
@@ -3586,6 +3592,7 @@ tests_testURL_SOURCES = \
        AuthReg.h \
        YesNoNone.h \
        YesNoNone.cc \
+       RefreshPattern.h \
        cache_cf.cc \
        cache_manager.cc \
        CacheDigest.h \
diff --git a/src/RefreshPattern.h b/src/RefreshPattern.h
new file mode 100644 (file)
index 0000000..c3abe78
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef SQUID_REFRESHPATTERN_H_
+#define SQUID_REFRESHPATTERN_H_
+/*
+ * SQUID Web Proxy Cache          http://www.squid-cache.org/
+ * ----------------------------------------------------------
+ *
+ *  Squid is the result of efforts by numerous individuals from
+ *  the Internet community; see the CONTRIBUTORS file for full
+ *  details.   Many organizations have provided support for Squid's
+ *  development; see the SPONSORS file for full details.  Squid is
+ *  Copyrighted (C) 2001 by the Regents of the University of
+ *  California; see the COPYRIGHT file for full details.  Squid
+ *  incorporates software developed and/or copyrighted by other
+ *  sources; see the CREDITS file for full details.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+class RefreshPattern {
+public:
+    const char *pattern;
+    regex_t compiled_pattern;
+    time_t min;
+    double pct;
+    time_t max;
+    RefreshPattern *next;
+
+    struct {
+        unsigned int icase:1;
+        unsigned int refresh_ims:1;
+        unsigned int store_stale:1;
+#if USE_HTTP_VIOLATIONS
+        unsigned int override_expire:1;
+        unsigned int override_lastmod:1;
+        unsigned int reload_into_ims:1;
+        unsigned int ignore_reload:1;
+        unsigned int ignore_no_cache:1;
+        unsigned int ignore_no_store:1;
+        unsigned int ignore_must_revalidate:1;
+        unsigned int ignore_private:1;
+        unsigned int ignore_auth:1;
+#endif
+    } flags;
+    int max_stale;
+};
+
+#endif /* SQUID_REFRESHPATTERN_H_ */
index 1e2fb338359a8491f299eaf34ea67f7c1b4e5ff1..337f8ac28430803c157f3bbdfa622ad6ffb159ca 100644 (file)
@@ -50,7 +50,7 @@ class acl_access;
 class AclDenyInfoList;
 class acl_size_t;
 class HeaderManglers;
-class refresh_t;
+class RefreshPattern;
 class SwapDir;
 class RemovalPolicySettings;
 
@@ -403,7 +403,7 @@ public:
         int sanitycheck;
         int telnet;
     } Ftp;
-    refresh_t *Refresh;
+    RefreshPattern *Refresh;
 
     struct _cacheSwap {
         RefCount<SwapDir> *swapDirs;
index a79dc204283694c99e1ba50cfeef72f96cbd9f80..4fe46c3b5654f43114bd088ecaa6485fb072560c 100644 (file)
@@ -63,6 +63,7 @@
 #include "mgr/Registration.h"
 #include "Parsing.h"
 #include "PeerDigest.h"
+#include "RefreshPattern.h"
 #include "rfc1738.h"
 #include "SquidConfig.h"
 #include "SquidString.h"
@@ -181,7 +182,7 @@ static void free_access_log(CustomLog ** definitions);
 
 static void update_maxobjsize(void);
 static void configDoConfigure(void);
-static void parse_refreshpattern(refresh_t **);
+static void parse_refreshpattern(RefreshPattern **);
 static uint64_t parseTimeUnits(const char *unit,  bool allowMsec);
 static void parseTimeLine(time_msec_t * tptr, const char *units, bool allowMsec);
 static void parse_u_short(unsigned short * var);
@@ -765,7 +766,7 @@ configDoConfigure(void)
 #if USE_HTTP_VIOLATIONS
 
     {
-        const refresh_t *R;
+        const RefreshPattern *R;
 
         for (R = Config.Refresh; R; R = R->next) {
             if (!R->flags.override_expire)
@@ -2643,7 +2644,7 @@ parse_tristate(int *var)
 #define free_tristate free_int
 
 static void
-dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
+dump_refreshpattern(StoreEntry * entry, const char *name, RefreshPattern * head)
 {
     while (head != NULL) {
         storeAppendPrintf(entry, "%s%s %s %d %d%% %d",
@@ -2701,7 +2702,7 @@ dump_refreshpattern(StoreEntry * entry, const char *name, refresh_t * head)
 }
 
 static void
-parse_refreshpattern(refresh_t ** head)
+parse_refreshpattern(RefreshPattern ** head)
 {
     char *token;
     char *pattern;
@@ -2726,7 +2727,7 @@ parse_refreshpattern(refresh_t ** head)
 #endif
 
     int i;
-    refresh_t *t;
+    RefreshPattern *t;
     regex_t comp;
     int errcode;
     int flags = REG_EXTENDED | REG_NOSUB;
@@ -2831,7 +2832,7 @@ parse_refreshpattern(refresh_t ** head)
 
     pct = pct < 0.0 ? 0.0 : pct;
     max = max < 0 ? 0 : max;
-    t = static_cast<refresh_t *>(xcalloc(1, sizeof(refresh_t)));
+    t = static_cast<RefreshPattern *>(xcalloc(1, sizeof(RefreshPattern)));
     t->pattern = (char *) xstrdup(pattern);
     t->compiled_pattern = comp;
     t->min = min;
@@ -2891,9 +2892,9 @@ parse_refreshpattern(refresh_t ** head)
 }
 
 static void
-free_refreshpattern(refresh_t ** head)
+free_refreshpattern(RefreshPattern ** head)
 {
-    refresh_t *t;
+    RefreshPattern *t;
 
     while ((t = *head) != NULL) {
         *head = t->next;
index 2fbdbd76b440e318e96ad635b1bd26ac7fbe2b5a..73ffa217dae9c8638ea504ee6637a5b6bd84ca84 100644 (file)
@@ -65,6 +65,7 @@
 #include "peer_proxy_negotiate_auth.h"
 #include "profiler/Profiler.h"
 #include "refresh.h"
+#include "RefreshPattern.h"
 #include "rfc1738.h"
 #include "SquidConfig.h"
 #include "SquidTime.h"
@@ -337,7 +338,7 @@ HttpStateData::cacheableReply()
     const char *v;
 #if USE_HTTP_VIOLATIONS
 
-    const refresh_t *R = NULL;
+    const RefreshPattern *R = NULL;
 
     /* This strange looking define first looks up the refresh pattern
      * and then checks if the specified flag is set. The main purpose
index a7d4bd8486f2525ff2951d74c47d186d30af05b4..be36c73de334412bbd94070bebf78a128888a93a 100644 (file)
@@ -41,6 +41,7 @@
 #include "HttpRequest.h"
 #include "HttpReply.h"
 #include "MemObject.h"
+#include "RefreshPattern.h"
 #include "SquidTime.h"
 #include "SquidConfig.h"
 #include "Store.h"
@@ -109,16 +110,16 @@ refreshCounts[rcCount];
 #define REFRESH_DEFAULT_PCT    0.20
 #define REFRESH_DEFAULT_MAX    (time_t)259200
 
-static const refresh_t *refreshUncompiledPattern(const char *);
+static const RefreshPattern *refreshUncompiledPattern(const char *);
 static OBJH refreshStats;
-static int refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age, const refresh_t * R, stale_flags * sf);
+static int refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age, const RefreshPattern * R, stale_flags * sf);
 
-static refresh_t DefaultRefresh;
+static RefreshPattern DefaultRefresh;
 
-const refresh_t *
+const RefreshPattern *
 refreshLimits(const char *url)
 {
-    const refresh_t *R;
+    const RefreshPattern *R;
 
     for (R = Config.Refresh; R; R = R->next) {
         if (!regexec(&(R->compiled_pattern), url, 0, 0, 0))
@@ -128,10 +129,10 @@ refreshLimits(const char *url)
     return NULL;
 }
 
-static const refresh_t *
+static const RefreshPattern *
 refreshUncompiledPattern(const char *pat)
 {
-    const refresh_t *R;
+    const RefreshPattern *R;
 
     for (R = Config.Refresh; R; R = R->next) {
         if (0 == strcmp(R->pattern, pat))
@@ -157,7 +158,7 @@ refreshUncompiledPattern(const char *pat)
  * times.
  */
 static int
-refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age, const refresh_t * R, stale_flags * sf)
+refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age, const RefreshPattern * R, stale_flags * sf)
 {
     /** \par
      * Check for an explicit expiration time (Expires: header).
@@ -231,7 +232,7 @@ refreshStaleness(const StoreEntry * entry, time_t check_time, const time_t age,
 static int
 refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
 {
-    const refresh_t *R;
+    const RefreshPattern *R;
     const char *uri = NULL;
     time_t age = 0;
     time_t check_time = squid_curtime + delta;
@@ -535,7 +536,7 @@ refreshCheckDigest(const StoreEntry * entry, time_t delta)
 time_t
 getMaxAge(const char *url)
 {
-    const refresh_t *R;
+    const RefreshPattern *R;
     debugs(22, 3, "getMaxAge: '" << url << "'");
 
     if ((R = refreshLimits(url)))
index 1c6b9d36d29618652da7fd0876c839fa386ffb93..73757d178c171d1c6e94f5db6e8f5eae4c63da7d 100644 (file)
@@ -33,6 +33,8 @@
 #ifndef SQUID_REFRESH_H_
 #define SQUID_REFRESH_H_
 
+class RefreshPattern;
+
 extern void refreshAddToList(const char *, int, time_t, int, time_t);
 extern int refreshIsCachable(const StoreEntry *);
 extern int refreshCheckHTTP(const StoreEntry *, HttpRequest *);
@@ -41,6 +43,6 @@ extern int refreshCheckHTCP(const StoreEntry *, HttpRequest *);
 extern int refreshCheckDigest(const StoreEntry *, time_t delta);
 extern time_t getMaxAge(const char *url);
 extern void refreshInit(void);
-extern const refresh_t *refreshLimits(const char *url);
+extern const RefreshPattern *refreshLimits(const char *url);
 
 #endif /* SQUID_REFRESH_H_ */
index dc072636b8fb9a6a35f533b2fdf202885a8092b4..5f75f1648cbae018f9bc097a4dda6ec572b21265 100644 (file)
@@ -105,7 +105,6 @@ class external_acl;
 class Store;
 class CustomLog;
 class cachemgr_passwd;
-class refresh_t;
 namespace AnyP
 {
 struct PortCfg;
@@ -313,34 +312,6 @@ public:
     cachemgr_passwd *next;
 };
 
-class refresh_t {
-public:
-    const char *pattern;
-    regex_t compiled_pattern;
-    time_t min;
-    double pct;
-    time_t max;
-    refresh_t *next;
-
-    struct {
-        unsigned int icase:1;
-        unsigned int refresh_ims:1;
-        unsigned int store_stale:1;
-#if USE_HTTP_VIOLATIONS
-        unsigned int override_expire:1;
-        unsigned int override_lastmod:1;
-        unsigned int reload_into_ims:1;
-        unsigned int ignore_reload:1;
-        unsigned int ignore_no_cache:1;
-        unsigned int ignore_no_store:1;
-        unsigned int ignore_must_revalidate:1;
-        unsigned int ignore_private:1;
-        unsigned int ignore_auth:1;
-#endif
-    } flags;
-    int max_stale;
-};
-
 
 #if USE_SSL
 struct _sslproxy_cert_sign {