--------------------- PatchSet 11641 Date: 2007/09/05 21:28:34 Author: hno Branch: SQUID_2_6 Tag: (none) Log: MFC: 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.120.2.3->1.120.2.4 src/structs.h:1.507.2.7->1.507.2.8 Index: squid/src/forward.c =================================================================== RCS file: /cvsroot/squid/squid/src/forward.c,v retrieving revision 1.120.2.3 retrieving revision 1.120.2.4 diff -u -r1.120.2.3 -r1.120.2.4 --- squid/src/forward.c 17 Apr 2007 09:35:17 -0000 1.120.2.3 +++ squid/src/forward.c 5 Sep 2007 21:28:34 -0000 1.120.2.4 @@ -1,6 +1,6 @@ /* - * $Id: forward.c,v 1.120.2.3 2007/04/17 09:35:17 hno Exp $ + * $Id: forward.c,v 1.120.2.4 2007/09/05 21:28:34 hno Exp $ * * DEBUG: section 17 Request Forwarding * AUTHOR: Duane Wessels @@ -793,6 +793,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); @@ -867,6 +868,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 @@ -1015,6 +1017,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.507.2.7 retrieving revision 1.507.2.8 diff -u -r1.507.2.7 -r1.507.2.8 --- squid/src/structs.h 15 Jul 2007 09:52:18 -0000 1.507.2.7 +++ squid/src/structs.h 5 Sep 2007 21:28:34 -0000 1.507.2.8 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.507.2.7 2007/07/15 09:52:18 hno Exp $ + * $Id: structs.h,v 1.507.2.8 2007/09/05 21:28:34 hno Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -2252,6 +2252,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