Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1594

Show
Ignore:
Timestamp:
01/11/07 10:45:28
Author:
fumanchu
Message:

Added 'must-revalidate' to Cache-Control header in expires tool.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/caching.py

    r1495 r1594  
    176176    If 'secs' is zero, the following "cache prevention" headers are also set: 
    177177       'Pragma': 'no-cache' 
    178        'Cache-Control': 'no-cache
     178       'Cache-Control': 'no-cache, must-revalidate
    179179     
    180180    If 'force' is False (the default), the following headers are checked: 
     
    184184     
    185185    response = cherrypy.response 
     186    headers = response.headers 
    186187     
    187188    cacheable = False 
     
    189190        # some header names that indicate that the response can be cached 
    190191        for indicator in ('Etag', 'Last-Modified', 'Age', 'Expires'): 
    191             if indicator in response.headers: 
     192            if indicator in headers: 
    192193                cacheable = True 
    193194                break 
     
    198199         
    199200        if secs == 0: 
    200             if force or "Pragma" not in response.headers: 
    201                 response.headers["Pragma"] = "no-cache" 
     201            if force or "Pragma" not in headers: 
     202                headers["Pragma"] = "no-cache" 
    202203            if cherrypy.request.protocol >= (1, 1): 
    203                 if force or "Cache-Control" not in response.headers: 
    204                     response.headers["Cache-Control"] = "no-cache" 
     204                if force or "Cache-Control" not in headers: 
     205                    headers["Cache-Control"] = "no-cache, must-revalidate" 
    205206         
    206207        expiry = http.HTTPDate(response.time + secs) 
    207         if force or "Expires" not in response.headers: 
    208             response.headers["Expires"] = expiry 
     208        if force or "Expires" not in headers: 
     209            headers["Expires"] = expiry 

Hosted by WebFaction

Log in as guest/cpguest to create tickets