On Wed, 2006-04-19 at 11:03 -0500, Dan Connolly wrote:
> I re-dicovered http://bitworking.org/projects/httplib2/ .
>  http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.3
> 
> Then I see max-stale is what I want, but then in httplib2.py, I see:
> 
>     We will never return a stale document as 
>     fresh as a design decision, and thus the non-implementation 
>     of 'max-stale'.
> 
> So I'm getting no help from either side. Sigh.

I'm having some luck with only-if-cached. But I think the case
of a cache miss is buggy. Patch attached.



-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E
Index: httplib2/__init__.py
===================================================================
--- httplib2/__init__.py	(revision 181)
+++ httplib2/__init__.py	(working copy)
@@ -193,7 +193,7 @@
     elif cc_response.has_key('no-cache'):
         retval = "STALE"
     elif cc.has_key('only-if-cached'):
-        retval = "FRESH"
+        retval = response_headers.has_key('status') and "FRESH" or "STALE"
     elif response_headers.has_key('date'):
         date = calendar.timegm(rfc822.parsedate_tz(response_headers['date']))
         now = time.time()

Reply via email to