From 7c47630958474695c57591984a5c5546af44c071 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 23 Aug 2014 05:04:16 -0700 Subject: [PATCH] Cleanup: remove goto from Vary: header failure recovery --- src/http.cc | 57 ++++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/http.cc b/src/http.cc index 708c6c12d6..12ee1a5e73 100644 --- a/src/http.cc +++ b/src/http.cc @@ -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. -- 2.47.2