]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Do not check store_status when checking ENTRY_BAD_LENGTH (#1342)
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 3 May 2023 22:20:27 +0000 (22:20 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Fri, 5 May 2023 22:35:45 +0000 (22:35 +0000)
Before 1997 commit b34ed72 (that introduced the current ENTRY_BAD_LENGTH
"cache"), checking store_status before calling storeEntryValidLength()
kind of made sense because storeEntryValidLength() did not support
STORE_PENDING entries with their unset object_len. Since that commit,
checking store_status does not cause any visible problems (i.e. the code
"works") because ENTRY_BAD_LENGTH implies STORE_OK. However, that
implication is not backed by some fundamental invariant and might
suddenly disappear. Checking two flags instead of one is also wasteful.

No Squid functionality changes are expected.

src/store.cc
src/store_digest.cc

index 2df3a72eba1c7f3c180a6f2455c806bc3f2669d4..00d7aed1d13866526f8e4a8b795b63b812acca0b 100644 (file)
@@ -915,7 +915,7 @@ StoreEntry::checkCachable()
         return 0; // avoid rerequesting release below
     }
 
-    if (store_status == STORE_OK && EBIT_TEST(flags, ENTRY_BAD_LENGTH)) {
+    if (EBIT_TEST(flags, ENTRY_BAD_LENGTH)) {
         debugs(20, 2, "StoreEntry::checkCachable: NO: wrong content-length");
         ++store_check_cachable_hist.no.wrong_content_length;
     } else if (!mem_obj) {
index 6b1b77a3219481192abf9b8ad821955cc0160c41..a965bc82ab225ac472af45e361b2dceb708a4048 100644 (file)
@@ -248,7 +248,7 @@ storeDigestAddable(const StoreEntry * e)
         return 0;
     }
 
-    if (e->store_status == STORE_OK && EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) {
+    if (EBIT_TEST(e->flags, ENTRY_BAD_LENGTH)) {
         debugs(71, 6, "storeDigestAddable: NO: wrong content-length");
         return 0;
     }