]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 4481: varyEvaluateMatch: Oops. Not a Vary match on second attempt
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 7 Apr 2016 13:10:28 +0000 (01:10 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 7 Apr 2016 13:10:28 +0000 (01:10 +1200)
src/StoreMetaVary.cc
src/store_swapmeta.cc

index bd8423ff55c1c29188eb93195944c95b1080333e..7f86be742125c5a5b07d6663a019e8bb87ea4461 100644 (file)
@@ -22,6 +22,9 @@ StoreMetaVary::checkConsistency(StoreEntry *e) const
         /* XXX separate this mutator from the query */
         /* Assume the object is OK.. remember the vary request headers */
         e->mem_obj->vary_headers.assign(static_cast<const char *>(value), length);
+        /* entries created before SBuf vary handling may include string terminator */
+        static const SBuf nul("\0", 1);
+        e->mem_obj->vary_headers.trim(nul);
         return true;
     }
 
index 7e5dd0fe1928cb799358876085c417287c21e076..c56cc67ecf73de52e36db01509bd6768119a7d7a 100644 (file)
@@ -89,9 +89,7 @@ storeSwapMetaBuild(StoreEntry * e)
     SBuf vary(e->mem_obj->vary_headers);
 
     if (!vary.isEmpty()) {
-        // TODO: do we still need +1 here? StoreMetaVary::checkConsistency
-        //       no longer relies on nul-termination, but other things might.
-        t = StoreMeta::Factory(STORE_META_VARY_HEADERS, vary.length() + 1, vary.c_str());
+        t = StoreMeta::Factory(STORE_META_VARY_HEADERS, vary.length(), vary.c_str());
 
         if (!t) {
             storeSwapTLVFree(TLV);