Re: If refresh_pattern only extends expiration, how to force time-to-live in Squid code?

2009-09-02 Thread Guy Bashkansky
(Resending, first time accidentally sent with HTML formatting, bounced)

Now I see the Expires header having a value in the past, which may
confuse clients and caches further down the chain.
Scenario: origin returns max-age=900 (15 min) and refresh_pattern
overrides expire to 24 hours, what do the headers to the client look
like?

On the first request (cache-miss), the Expires header is not added to
the response sent to client.
On subsequent cache-hits the Expires header is added to the response
sent to client. (Why this artifact?)

The Expires header is set to time the object was received from the
origin plus the value in the Max-age header.
This results in the Expires header having a value in the past when the
cached object is older than the Max-age.

How to fix it best? (in my local version)

Since my trouble is the Expires header having a value in the past, I
consider suppressing the Squid artifact of inserting an Expires
header.
Is there a Squid configuration ability to do so?  If not, what would
be the right way to do it in my local code branch?


On Fri, Aug 28, 2009 at 6:12 PM, Guy Bashkansky guy...@gmail.com wrote:

 Henrik,
 Thanks, it works!
 Guy

 On Thu, Aug 27, 2009 at 2:00 AM, Henrik Nordstrom 
 hen...@henriknordstrom.net wrote:

 ons 2009-08-26 klockan 18:17 -0700 skrev Guy Bashkansky:

  If indeed refresh_pattern only extends expiration, I would like to
  develop a feature that enforces an exact time-to-live (per URL) in my
  local branch of Squid code.

 See the refreshStaleness() function. Should be sufficient to move the
 max age check up above the expires check.

 Regards
 Henrik



-- Forwarded message --
From: Guy Bashkansky guy...@gmail.com
Date: Wed, Aug 26, 2009 at 6:17 PM
Subject: If refresh_pattern only extends expiration, how to force
time-to-live in Squid code?
To: squid-dev@squid-cache.org


I've tried to set an exact time-to-live (override origin cache
control) in Squid (2.4 STABLE6) configuration by refresh_pattern,
e.g.:

refresh_pattern   30_minutes_cache_control_url   15   0%   15
override-expire   ignore-max-age

Observed: URL is matched (in log), but objects still cached for 30
minutes, rather than for 15 minutes, as hoped.

If indeed refresh_pattern only extends expiration, I would like to
develop a feature that enforces an exact time-to-live (per URL) in my
local branch of Squid code.

What would be the most reasonable way to do this?  How can I force
objects to expire from cache after a given time?

Thanks.


Re: If refresh_pattern only extends expiration, how to force time-to-live in Squid code?

2009-09-02 Thread Henrik Nordstrom
ons 2009-09-02 klockan 12:42 -0700 skrev Guy Bashkansky:

 Now I see the Expires header having a value in the past, which may
 confuse clients and caches further down the chain.
 Scenario: origin returns max-age=900 (15 min) and refresh_pattern
 overrides expire to 24 hours, what do the headers to the client look
 like?
 
 On the first request (cache-miss), the Expires header is not added to
 the response sent to client.
 On subsequent cache-hits the Expires header is added to the response
 sent to client. (Why this artifact?)

Is it? Should not, at least not unless you run 2.7 with the
act-as-origin option..

 The Expires header is set to time the object was received from the
 origin plus the value in the Max-age header.

odd..

Regards
Henrik



Re: If refresh_pattern only extends expiration, how to force time-to-live in Squid code?

2009-09-02 Thread Henrik Nordstrom
ons 2009-09-02 klockan 13:42 -0700 skrev Guy Bashkansky:
 I'm using a customized version of Squid 2.4 STABLE6.  But nothing
 seems to be customized in refresh.c, except for my own recent swap of
 age and expires checks (as recommended).

Ouch.. that's a very very old relese. Upgrading highly recommended.

 Probably the expires header is added in some other place, it's just
 difficult to figure out exactly where in the code and how it is
 controlled.

grep -4 HDR_EXPIRES src/*.c

Regards
Henrik



Re: If refresh_pattern only extends expiration, how to force time-to-live in Squid code?

2009-08-27 Thread Henrik Nordstrom
ons 2009-08-26 klockan 18:17 -0700 skrev Guy Bashkansky:

 If indeed refresh_pattern only extends expiration, I would like to
 develop a feature that enforces an exact time-to-live (per URL) in my
 local branch of Squid code.

See the refreshStaleness() function. Should be sufficient to move the
max age check up above the expires check.

Regards
Henrik



If refresh_pattern only extends expiration, how to force time-to-live in Squid code?

2009-08-26 Thread Guy Bashkansky
I've tried to set an exact time-to-live (override origin cache
control) in Squid (2.4 STABLE6) configuration by refresh_pattern,
e.g.:

refresh_pattern   30_minutes_cache_control_url   15   0%   15
override-expire   ignore-max-age

Observed: URL is matched (in log), but objects still cached for 30
minutes, rather than for 15 minutes, as hoped.

If indeed refresh_pattern only extends expiration, I would like to
develop a feature that enforces an exact time-to-live (per URL) in my
local branch of Squid code.

What would be the most reasonable way to do this?  How can I force
objects to expire from cache after a given time?

Thanks.