]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: remove goto from Vary: header failure recovery
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 23 Aug 2014 12:04:16 +0000 (05:04 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 23 Aug 2014 12:04:16 +0000 (05:04 -0700)
src/http.cc

index 708c6c12d62e20493970246150e51ad441373703..12ee1a5e7308c95990d43246d8c7d5fac43489bf 100644 (file)
@@ -930,6 +930,7 @@ HttpStateData::haveParsedReplyHeaders()
     if (neighbors_do_private_keys)
         httpMaybeRemovePublic(entry, rep->sline.status());
 
+    bool varyFailure = false;
     if (rep->header.has(HDR_VARY)
 #if X_ACCELERATOR_VARY
             || rep->header.has(HDR_X_ACCELERATOR_VARY)
@@ -941,48 +942,46 @@ HttpStateData::haveParsedReplyHeaders()
             entry->makePrivate();
             if (!fwd->reforwardableStatus(rep->sline.status()))
                 EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
-            goto no_cache;
+            varyFailure = true;
+        } else {
+            entry->mem_obj->vary_headers = xstrdup(vary);
         }
-
-        entry->mem_obj->vary_headers = xstrdup(vary);
     }
 
-    /*
-     * If its not a reply that we will re-forward, then
-     * allow the client to get it.
-     */
-    if (!fwd->reforwardableStatus(rep->sline.status()))
-        EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
+    if (!varyFailure) {
+        /*
+         * If its not a reply that we will re-forward, then
+         * allow the client to get it.
+         */
+        if (!fwd->reforwardableStatus(rep->sline.status()))
+            EBIT_CLR(entry->flags, ENTRY_FWD_HDR_WAIT);
 
-    switch (cacheableReply()) {
+        switch (cacheableReply()) {
 
-    case 1:
-        entry->makePublic();
-        break;
+        case 1:
+            entry->makePublic();
+            break;
 
-    case 0:
-        entry->makePrivate();
-        break;
+        case 0:
+            entry->makePrivate();
+            break;
 
-    case -1:
+        case -1:
 
 #if USE_HTTP_VIOLATIONS
-        if (Config.negativeTtl > 0)
-            entry->cacheNegatively();
-        else
+            if (Config.negativeTtl > 0)
+                entry->cacheNegatively();
+            else
 #endif
-            entry->makePrivate();
-
-        break;
-
-    default:
-        assert(0);
+                entry->makePrivate();
+            break;
 
-        break;
+        default:
+            assert(0);
+            break;
+        }
     }
 
-no_cache:
-
     if (!ignoreCacheControl) {
         if (rep->cache_control) {
             // We are required to revalidate on many conditions.