--------------------- PatchSet 11637 Date: 2007/09/05 20:03:08 Author: hno Branch: HEAD Tag: (none) Log: Bug #1882: Parent responses are not cached if sibling returns 504 The internal state was not reset properly when retrying requests. Members: src/forward.c:1.130->1.131 src/structs.h:1.521->1.522 Index: squid/src/forward.c =================================================================== RCS file: /cvsroot/squid/squid/src/forward.c,v retrieving revision 1.130 retrieving revision 1.131 diff -u -r1.130 -r1.131 --- squid/src/forward.c 3 Sep 2007 04:41:23 -0000 1.130 +++ squid/src/forward.c 5 Sep 2007 20:03:08 -0000 1.131 @@ -1,6 +1,6 @@ /* - * $Id: forward.c,v 1.130 2007/09/03 04:41:23 hno Exp $ + * $Id: forward.c,v 1.131 2007/09/05 20:03:08 hno Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -894,6 +894,7 @@ fwdState->server_fd = -1; fwdState->request = requestLink(r); fwdState->start = squid_curtime; + fwdState->orig_entry_flags = e->flags; storeLockObject(e); if (!fwdState->request->flags.pinned) EBIT_SET(e->flags, ENTRY_FWD_HDR_WAIT); @@ -962,6 +963,7 @@ fwdState->server_fd = -1; fwdState->request = requestLink(r); fwdState->start = squid_curtime; + fwdState->orig_entry_flags = e->flags; #if LINUX_TPROXY /* If we need to transparently proxy the request @@ -1110,6 +1112,24 @@ if (fwdState->server_fd > -1) fwdUnregister(fwdState->server_fd, fwdState); storeEntryReset(e); + /* HACK WARNING: This fiddling with the flags really + * should be done in the store layer, but current + * design does not allow it to be done proper in a + * sane manner. + * A sign that we have pushed the design of everything + * going via a single StoreEntry per request a bit too far. + */ + if (EBIT_TEST(e->flags, ENTRY_NEGCACHED)) { + storeSetPrivateKey(e); + EBIT_CLR(e->flags, ENTRY_NEGCACHED); + EBIT_CLR(e->flags, KEY_EARLY_PUBLIC); + } + if (EBIT_TEST(e->flags, RELEASE_REQUEST)) { + EBIT_CLR(e->flags, RELEASE_REQUEST); + EBIT_CLR(e->flags, KEY_EARLY_PUBLIC); + } + if (EBIT_TEST(fwdState->orig_entry_flags, ENTRY_CACHABLE)) + EBIT_SET(e->flags, ENTRY_CACHABLE); fwdStartComplete(fwdState->servers, fwdState); } else { debug(17, 3) ("fwdComplete: not re-forwarding status %d\n", Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid/squid/src/structs.h,v retrieving revision 1.521 retrieving revision 1.522 diff -u -r1.521 -r1.522 --- squid/src/structs.h 3 Sep 2007 04:41:23 -0000 1.521 +++ squid/src/structs.h 5 Sep 2007 20:03:08 -0000 1.522 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.521 2007/09/03 04:41:23 hno Exp $ + * $Id: structs.h,v 1.522 2007/09/05 20:03:08 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -2260,6 +2260,7 @@ #if LINUX_NETFILTER struct sockaddr_in src; #endif + u_short orig_entry_flags; /* Hack to be able to reset the entry proper */ }; #if USE_HTCP