W3C home > Mailing lists > Public > ietf-http-wg-old@w3.org > September to December 1996

Re: Confusion about Age: accuracy vs. safety

From: Anselm Baird-Smith <abaird@w3.org>
Date: Wed, 4 Sep 1996 09:45:41 +0500
Message-Id: <9609041345.AA06187@www18.w3.org>
To: Koen Holtman <koen@win.tue.nl>
Cc: Jeffrey Mogul <mogul@pa.dec.com>, fielding@liege.ICS.UCI.EDU, http-wg%cuckoo.hpl.hp.com@hplb.hpl.hp.com
Koen Holtman writes:
 > Jeffrey Mogul:
 > >To wit: the spec
 > >explicitly allows your caches to ignore the expiration times 
 > 
 > This is only allowed if a Warning is added, I believe.
 > 
 > I have always had doubts about whether cache implementers would want
 > to implement Jeff's Age calculation algorithm without any changes.

I can speak for myself here: as I am not as wise as you guys, and as I
don't have much time for discussions, I did implement *exactly* (as
faithfully as possible - see code below), Jeff's pseudo code.

Anselm.
BTW: if you find a bug in this code, let me know !

    public void updateAges(Request request, Reply reply) {
	// Quickly save the reponse time:
	long response_time = System.currentTimeMillis();
	setResponseTime(response_time);
	// HTTP/1.1, Section 13.2.3, Age Calculation
	long age_value     = reply.getAge();
	long date_value    = reply.getDate();
	long request_time  = request.getDate();
	
	long apparent_age   = Math.max(0, response_time-date_value);
	long c_received_age = Math.max(apparent_age, age_value);
	long response_delay = response_time - request_time;
	// Save the initial age:
	setInitialAge(c_received_age + response_delay);
	// Save the date of the reply:
	if ( date_value > 0 )
	    setDate(date_value);
	// Look for HTTP/1.1 specific headers:
	if ( reply.getMajorVersion() >= 1 ) {
	    // HTTP/1.x specific headers: maxage
	    long maxage = ((long) reply.getMaxAge()) * 1000;
	    if ((maxage < 0) &&  reply.hasHeader(reply.H_EXPIRES) ) 
		maxage = reply.getExpires() - reply.getDate() ;
	    if ( maxage >= 0 )
		setMaxAge(maxage);
	    else
		setDefaultMaxAge();
	    // HTTP/1.1 specific headers: *-revalidate
	    if ( reply.getMinorVersion() >= 1 ) {
		setRevalidate(false);
		if ( reply.checkMustRevalidate() )
		    setRevalidate(true);
		if ( ( ! isShared()) && reply.checkProxyRevalidate() )
		    setRevalidate(true);
	    }
	}
    }
Received on Wednesday, 4 September 1996 06:47:50 EDT

This archive was generated by hypermail pre-2.1.9 : Wednesday, 24 September 2003 06:32:13 EDT