------------------------------------------------------------ revno: 13545 revision-id: squid3@treenet.co.nz-20140823120416-2pqr08bsaim6ilmf parent: squid3@treenet.co.nz-20140823111732-cftwfc0gzujwiokc committer: Amos Jeffries branch nick: trunk timestamp: Sat 2014-08-23 05:04:16 -0700 message: Cleanup: remove goto from Vary: header failure recovery ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20140823120416-2pqr08bsaim6ilmf # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: 84b3edd5260a78366ab64a1eae04e90c081f5e39 # timestamp: 2014-08-23 12:54:18 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20140823111732-\ # cftwfc0gzujwiokc # # Begin patch === modified file 'src/http.cc' --- src/http.cc 2014-08-10 23:18:33 +0000 +++ src/http.cc 2014-08-23 12:04:16 +0000 @@ -930,6 +930,7 @@ 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 @@ 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); - - switch (cacheableReply()) { - - case 1: - entry->makePublic(); - break; - - case 0: - entry->makePrivate(); - break; - - case -1: + 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()) { + + case 1: + entry->makePublic(); + break; + + case 0: + entry->makePrivate(); + break; + + 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); - - break; + entry->makePrivate(); + break; + + default: + assert(0); + break; + } } -no_cache: - if (!ignoreCacheControl) { if (rep->cache_control) { // We are required to revalidate on many conditions.