Re: squid-2.HEAD: proposed patch for max-age + no-cache combination

From: Adrian Chadd <adrian@dont-contact.us>
Date: Sun, 27 Apr 2008 19:55:01 +0800

On Sun, Apr 27, 2008, Alexander V. Lukyanov wrote:
> Hello!
>
> Currently it is possible for squid to send out Cache-Control: max-age=XXX, no-cache
> combination. But max-age does not make any sense when there is a no-cache flag.
>
> Here is a patch to fix it. The patch skips setting max-age if there is no-cache flag.
> If the client has sent the combination, it is forwarded to the server as before.

Ok. Is there a particular motivation for this? Is it something that breaks a
server? Or?

Adrian

>
> Index: http.c
> ===================================================================
> RCS file: /squid/squid/src/http.c,v
> retrieving revision 1.441
> diff -u -p -r1.441 http.c
> --- http.c 25 Apr 2008 20:39:36 -0000 1.441
> +++ http.c 27 Apr 2008 04:59:06 -0000
> @@ -1332,15 +1334,15 @@ httpBuildRequestHeader(request_t * reque
> HttpHdrCc *cc = httpHeaderGetCc(hdr_in);
> if (!cc)
> cc = httpHdrCcCreate();
> - if (!EBIT_TEST(cc->mask, CC_MAX_AGE)) {
> + /* Set no-cache if determined needed but not found */
> + if (orig_request->flags.nocache && !httpHeaderHas(hdr_in, HDR_PRAGMA))
> + EBIT_SET(cc->mask, CC_NO_CACHE);
> + if (!EBIT_TEST(cc->mask, CC_NO_CACHE) && !EBIT_TEST(cc->mask, CC_MAX_AGE)) {
> const char *url = entry ? storeUrl(entry) : urlCanonical(orig_request);
> httpHdrCcSetMaxAge(cc, getMaxAge(url));
> if (strLen(request->urlpath))
> assert(strstr(url, strBuf(request->urlpath)));
> }
> - /* Set no-cache if determined needed but not found */
> - if (orig_request->flags.nocache && !httpHeaderHas(hdr_in, HDR_PRAGMA))
> - EBIT_SET(cc->mask, CC_NO_CACHE);
> /* Enforce sibling relations */
> if (flags.only_if_cached)
> EBIT_SET(cc->mask, CC_ONLY_IF_CACHED);

-- 
- Xenion - http://www.xenion.com.au/ - VPS Hosting - Commercial Squid Support -
- $25/pm entry-level VPSes w/ capped bandwidth charges available in WA -
Received on Sun Apr 27 2008 - 11:55:03 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 30 2008 - 12:00:07 MDT