]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceFormat Enforcement
authorAutomatic source maintenance <squidadm@squid-cache.org>
Wed, 5 Oct 2011 00:19:46 +0000 (18:19 -0600)
committerAutomatic source maintenance <squidadm@squid-cache.org>
Wed, 5 Oct 2011 00:19:46 +0000 (18:19 -0600)
src/HttpHdrCc.cc
src/HttpHdrCc.cci
src/HttpHdrCc.h
src/base/StringArea.h
src/http.cc
src/refresh.cc

index 1df1278dae68a8f8ab8fff7bfbec68df0ca36bad..43dc2510ceeb50775e3a7a4f0f57c556f7889e05 100644 (file)
@@ -49,20 +49,20 @@ typedef struct {
 
 /* order must match that of enum http_hdr_cc_type. The constraint is verified at initialization time */
 static HttpHeaderCcFields CcAttrs[CC_ENUM_END] = {
-        {"public", CC_PUBLIC},
-        {"private", CC_PRIVATE},
-        {"no-cache", CC_NO_CACHE},
-        {"no-store", CC_NO_STORE},
-        {"no-transform", CC_NO_TRANSFORM},
-        {"must-revalidate", CC_MUST_REVALIDATE},
-        {"proxy-revalidate", CC_PROXY_REVALIDATE},
-        {"max-age", CC_MAX_AGE},
-        {"s-maxage", CC_S_MAXAGE},
-        {"max-stale", CC_MAX_STALE},
-        {"min-fresh", CC_MIN_FRESH},
-        {"only-if-cached", CC_ONLY_IF_CACHED},
-        {"stale-if-error", CC_STALE_IF_ERROR},
-        {"Other,", CC_OTHER} /* ',' will protect from matches */
+    {"public", CC_PUBLIC},
+    {"private", CC_PRIVATE},
+    {"no-cache", CC_NO_CACHE},
+    {"no-store", CC_NO_STORE},
+    {"no-transform", CC_NO_TRANSFORM},
+    {"must-revalidate", CC_MUST_REVALIDATE},
+    {"proxy-revalidate", CC_PROXY_REVALIDATE},
+    {"max-age", CC_MAX_AGE},
+    {"s-maxage", CC_S_MAXAGE},
+    {"max-stale", CC_MAX_STALE},
+    {"min-fresh", CC_MIN_FRESH},
+    {"only-if-cached", CC_ONLY_IF_CACHED},
+    {"stale-if-error", CC_STALE_IF_ERROR},
+    {"Other,", CC_OTHER} /* ',' will protect from matches */
 };
 
 /// Map an header name to its type, to expedite parsing
@@ -83,7 +83,7 @@ void
 httpHdrCcInitModule(void)
 {
     /* build lookup and accounting structures */
-    for (int32_t i = 0;i < CC_ENUM_END; ++i) {
+    for (int32_t i = 0; i < CC_ENUM_END; ++i) {
         const HttpHeaderCcFields &f=CcAttrs[i];
         assert(i == f.id); /* verify assumption: the id is the key into the array */
         const StringArea k(f.name,strlen(f.name));
@@ -188,14 +188,30 @@ HttpHdrCc::parse(const String & str)
             }
             break;
 
-        case CC_PUBLIC: Public(true); break;
-        case CC_PRIVATE: Private(true); break;
-        case CC_NO_CACHE: noCache(true); break;
-        case CC_NO_STORE: noStore(true); break;
-        case CC_NO_TRANSFORM: noTransform(true); break;
-        case CC_MUST_REVALIDATE: mustRevalidate(true); break;
-        case CC_PROXY_REVALIDATE: proxyRevalidate(true); break;
-        case CC_ONLY_IF_CACHED: onlyIfCached(true); break;
+        case CC_PUBLIC:
+            Public(true);
+            break;
+        case CC_PRIVATE:
+            Private(true);
+            break;
+        case CC_NO_CACHE:
+            noCache(true);
+            break;
+        case CC_NO_STORE:
+            noStore(true);
+            break;
+        case CC_NO_TRANSFORM:
+            noTransform(true);
+            break;
+        case CC_MUST_REVALIDATE:
+            mustRevalidate(true);
+            break;
+        case CC_PROXY_REVALIDATE:
+            proxyRevalidate(true);
+            break;
+        case CC_ONLY_IF_CACHED:
+            onlyIfCached(true);
+            break;
 
         case CC_OTHER:
             if (other.size())
index 17e69648f743f234921cb514fb8fe16c6a995b17..c02e7025dd1512b52ba6e4990530b5e92932653e 100644 (file)
@@ -53,7 +53,7 @@ HttpHdrCc::setValue(int32_t &value, int32_t new_value, http_hdr_cc_type hdr, boo
     if (setting) {
         if (new_value < 0) {
             debugs(65,3,HERE << "rejecting negative-value Cache-Control directive " << hdr
-                << " value " << new_value );
+                   << " value " << new_value );
             return;
         }
     } else {
index b31b2be3136ff5dfe5882f49a224e91054eefeee..e0603727badefc006a2305ee756d4d2015fdf4c2 100644 (file)
@@ -44,14 +44,14 @@ class HttpHdrCc
 {
 
 public:
-       static const int32_t MAX_AGE_UNKNOWN=-1; //max-age is unset
-       static const int32_t S_MAXAGE_UNKNOWN=-1; //s-maxage is unset
-       static const int32_t MAX_STALE_UNKNOWN=-1; //max-stale is unset
-       ///used to mark a valueless Cache-Control: max-stale directive, which instructs
-       /// us to treat responses of any age as fresh
-       static const int32_t MAX_STALE_ANY=0x7fffffff;
-       static const int32_t STALE_IF_ERROR_UNKNOWN=-1; //stale_if_error is unset
-       static const int32_t MIN_FRESH_UNKNOWN=-1; //min_fresh is unset
+    static const int32_t MAX_AGE_UNKNOWN=-1; //max-age is unset
+    static const int32_t S_MAXAGE_UNKNOWN=-1; //s-maxage is unset
+    static const int32_t MAX_STALE_UNKNOWN=-1; //max-stale is unset
+    ///used to mark a valueless Cache-Control: max-stale directive, which instructs
+    /// us to treat responses of any age as fresh
+    static const int32_t MAX_STALE_ANY=0x7fffffff;
+    static const int32_t STALE_IF_ERROR_UNKNOWN=-1; //stale_if_error is unset
+    static const int32_t MIN_FRESH_UNKNOWN=-1; //min_fresh is unset
 
     HttpHdrCc() :
             mask(0), max_age(MAX_AGE_UNKNOWN), s_maxage(S_MAXAGE_UNKNOWN),
index 9463e1495565cae4377daa6d2b4cea31a973883b..7391515df3b2f26267796cef2fe6a1a8df4e3f1a 100644 (file)
  * Not meant for stand-alone storage. Validity of the
  * pointed-to string is responsibility of the caller.
  */
-class StringArea {
-    public:
+class StringArea
+{
+public:
     /// build a StringArea by explicitly assigning pointed-to area and and length
     StringArea(const char * ptr, size_t len): theStart(ptr), theLen(len) {}
     bool operator==(const StringArea &s) const { return theLen==s.theLen && memcmp(theStart,s.theStart,theLen)==0; }
     bool operator!=(const StringArea &s) const { return !operator==(s); }
     bool operator< ( const StringArea &s) const {
-        return (theLen < s.theLen || (theLen == s.theLen && memcmp(theStart,s.theStart,theLen) < 0)) ; }
+        return (theLen < s.theLen || (theLen == s.theLen && memcmp(theStart,s.theStart,theLen) < 0)) ;
+    }
 
-    private:
+private:
     /// pointed to the externally-managed memory area
     const char *theStart;
     /// length of the string
index d55a969b58dfea4eff61848f4e17c6e5ebc522bd..7cf6938f2d2936408ad9b21d4d19569f5b1df565 100644 (file)
@@ -929,7 +929,7 @@ no_cache:
         if (rep->cache_control->proxyRevalidate() ||
                 rep->cache_control->mustRevalidate() ||
                 rep->cache_control->hasSMaxAge()
-                )
+           )
             EBIT_SET(entry->flags, ENTRY_REVALIDATE);
     }
 
index 154b66b9284d32ee72d68f2e87fe89805952a94a..9049aa1335b28c3e087da222db7e0a3d29780e0a 100644 (file)
@@ -271,7 +271,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
         if (cc && cc->hasMinFresh()) {
             const int32_t minFresh=cc->minFresh();
             debugs(22, 3, "\tage + min-fresh:\t" << age << " + " <<
-                       minFresh << " = " << age + minFresh);
+                   minFresh << " = " << age + minFresh);
             debugs(22, 3, "\tcheck_time + min-fresh:\t" << check_time << " + "
                    << minFresh << " = " <<
                    mkrfc1123(check_time + minFresh));
@@ -288,7 +288,7 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
 
     // stale-if-error requires any failure be passed thru when its period is over.
     if (request && entry->mem_obj && entry->mem_obj->getReply() && entry->mem_obj->getReply()->cache_control &&
-               entry->mem_obj->getReply()->cache_control->hasStaleIfError() &&
+            entry->mem_obj->getReply()->cache_control->hasStaleIfError() &&
             entry->mem_obj->getReply()->cache_control->staleIfError() < staleness) {
 
         debugs(22, 3, "refreshCheck: stale-if-error period expired.");