]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Improved HttpHdrCc documentation
authorFrancesco Chemolli <kinkie@squid-cache.org>
Tue, 27 Sep 2011 06:14:57 +0000 (08:14 +0200)
committerFrancesco Chemolli <kinkie@squid-cache.org>
Tue, 27 Sep 2011 06:14:57 +0000 (08:14 +0200)
Reverted spurious change in Makefile.am
Fixed potential null pointer dereference in refresh.cc
Reverted unnecessary changes to HttpHeader::getCc
Removed explicit constructor requirement for HttpHdrCc

src/HttpHdrCc.h
src/HttpHeader.cc
src/Makefile.am
src/refresh.cc

index e658900124cb4bd0ad6ad7aca69b5acb96af8499..6de04e0520e7d0a3ae86e1943942e62abbd580d6 100644 (file)
@@ -51,31 +51,44 @@ public:
        static const int32_t STALE_IF_ERROR_UNSET=-1; //stale_if_error is unset
        static const int32_t MIN_FRESH_UNSET=-1; //min_fresh is unset
 
-    explicit HttpHdrCc() :
+    HttpHdrCc() :
             mask(0), max_age(MAX_AGE_UNSET), s_maxage(S_MAXAGE_UNSET),
             max_stale(MAX_STALE_UNSET), stale_if_error(STALE_IF_ERROR_UNSET),
             min_fresh(MIN_FRESH_UNSET) {}
 
+    /// reset data-members to default state
     void clear();
+
+    /// parse a header-string and fill in appropriate values.
     bool parse(const String & s);
 
+    /// max-age setter. Clear by setting to MAX_AGE_UNSET
     _SQUID_INLINE_ void setMaxAge(int32_t max_age);
     _SQUID_INLINE_ int32_t getMaxAge() const;
 
+    /// s-maxage setter. Clear by setting to S_MAXAGE_UNSET
     _SQUID_INLINE_ void setSMaxAge(int32_t s_maxage);
     _SQUID_INLINE_ int32_t getSMaxAge() const;
 
+    /// max-stale setter. Clear by setting to MAX_STALE_UNSET
     _SQUID_INLINE_ void setMaxStale(int32_t max_stale);
     _SQUID_INLINE_ int32_t getMaxStale() const;
 
+    /// stale-if-error setter. Clear by setting to STALE_IF_ERROR_UNSET
     _SQUID_INLINE_ void setStaleIfError(int32_t stale_if_error);
     _SQUID_INLINE_ int32_t getStaleIfError() const;
 
+    /// min-fresh setter. Clear by setting to MIN_FRESH_UNSET
     _SQUID_INLINE_ void setMinFresh(int32_t min_fresh);
     _SQUID_INLINE_ int32_t getMinFresh() const;
 
     MEMPROXY_CLASS(HttpHdrCc);
 
+    /** bit-mask representing what header values are set among those
+     * recognized by squid.
+     *
+     * managed via EBIT_SET/TEST/CLR
+     */
     int32_t mask;
 private:
     int32_t max_age;
@@ -84,6 +97,9 @@ private:
     int32_t stale_if_error;
     int32_t min_fresh;
 public:
+    /**comma-separated representation of the header values which were
+     * received but are not recognized.
+     */
     String other;
 };
 
index e3fc42f80c8d595f085c9b4f0325a899a77f6b0d..1441b942e205b673b42d2fc723b2294bbaf66fdf 100644 (file)
@@ -1311,19 +1311,14 @@ HttpHeader::getLastStr(http_hdr_type id) const
 HttpHdrCc *
 HttpHeader::getCc() const
 {
-    HttpHdrCc *cc;
-    String s;
-    bool gotList;
-
     if (!CBIT_TEST(mask, HDR_CACHE_CONTROL))
         return NULL;
     PROF_start(HttpHeader_getCc);
 
-    gotList=getList(HDR_CACHE_CONTROL, &s);
+    String s;
+    getList(HDR_CACHE_CONTROL, &s);
 
-    cc=new HttpHdrCc();
-    if (!gotList)
-        return cc;
+    HttpHdrCc *cc=new HttpHdrCc();
 
     if (!cc->parse(s)) {
         delete cc;
index 1789418d6630f7907a07328c09f59cb384fb04d6..19806703ba972aace79d1c74a76b299759f8f0d9 100644 (file)
@@ -1097,7 +1097,7 @@ tests_testHttpReply_LDADD=\
 tests_testHttpReply_DEPENDENCIES= $(SQUID_CPPUNIT_LA)
 
 ## Tests for the ACLMaxUserIP class
-## acl needs wordlist. wordlist needs MemBuf
+## acl needs wordlist. wordlist needs MemBug
 ## MemBuf needs mem, MemBuf needs event,
 ## event needs cbdata.
 ## ACLMaxUserUP needs $(AUTH_LIBS)
index fa603a914438792cc5e08da1b1bfa4e71ab46ad4..af4fdc7afa62f72237631b61628c7f1ee4959fe4 100644 (file)
@@ -268,8 +268,8 @@ refreshCheck(const StoreEntry * entry, HttpRequest * request, time_t delta)
 
     if (request && !request->flags.ignore_cc) {
         const HttpHdrCc *const cc = request->cache_control;
-        const int32_t minFresh=cc->getMinFresh();
-        if (cc && minFresh!=HttpHdrCc::MIN_FRESH_UNSET) {
+        if (cc && cc->getMinFresh()!=HttpHdrCc::MIN_FRESH_UNSET) {
+            const int32_t minFresh=cc->getMinFresh();
             debugs(22, 3, "\tage + min-fresh:\t" << age << " + " <<
                        minFresh << " = " << age + minFresh);
             debugs(22, 3, "\tcheck_time + min-fresh:\t" << check_time << " + "