Changeset 1594
- Timestamp:
- 01/11/07 10:45:28
- Files:
-
- trunk/cherrypy/lib/caching.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/lib/caching.py
r1495 r1594 176 176 If 'secs' is zero, the following "cache prevention" headers are also set: 177 177 'Pragma': 'no-cache' 178 'Cache-Control': 'no-cache '178 'Cache-Control': 'no-cache, must-revalidate' 179 179 180 180 If 'force' is False (the default), the following headers are checked: … … 184 184 185 185 response = cherrypy.response 186 headers = response.headers 186 187 187 188 cacheable = False … … 189 190 # some header names that indicate that the response can be cached 190 191 for indicator in ('Etag', 'Last-Modified', 'Age', 'Expires'): 191 if indicator in response.headers:192 if indicator in headers: 192 193 cacheable = True 193 194 break … … 198 199 199 200 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" 202 203 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" 205 206 206 207 expiry = http.HTTPDate(response.time + secs) 207 if force or "Expires" not in response.headers:208 response.headers["Expires"] = expiry208 if force or "Expires" not in headers: 209 headers["Expires"] = expiry

