Changeset 1089
- Timestamp:
- 05/02/06 18:04:53
- Files:
-
- trunk/cherrypy/_cperror.py (modified) (1 diff)
- trunk/cherrypy/lib/caching.py (modified) (1 diff)
- trunk/cherrypy/lib/static.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cperror.py
r1082 r1089 102 102 response = cherrypy.response 103 103 response.status = status = self.status 104 response.headers['Content-Type'] = "text/html"105 104 106 105 if status in (300, 301, 302, 303, 307): 106 response.headers['Content-Type'] = "text/html" 107 107 # "The ... URI SHOULD be given by the Location field 108 108 # in the response." trunk/cherrypy/lib/caching.py
r1083 r1089 105 105 if c: 106 106 expirationTime, lastModified, obj = cacheData 107 s, h, b = obj 107 108 modifiedSince = cherrypy.request.headers.get('If-Modified-Since', None) 108 109 if modifiedSince is not None and modifiedSince == lastModified: 109 110 cherrypy._cache.totNonModified += 1 110 111 cherrypy.response.status = "304 Not Modified" 112 ct = h.get("Content-Type") 113 if ct: 114 cherrypy.response.header_list["Content-Type"] = ct 111 115 cherrypy.response.body = None 112 116 else: 113 117 # serve it & get out from the request 114 cherrypy.response.status, cherrypy.response.header_list, body = obj118 cherrypy.response.status, cherrypy.response.header_list, body = s, h, b 115 119 cherrypy.response.body = body 116 120 return c trunk/cherrypy/lib/static.py
r1084 r1089 34 34 if cherrypy.request.headers.has_key('If-Modified-Since'): 35 35 if cherrypy.request.headers['If-Modified-Since'] == strModifTime: 36 response.status = "304 Not Modified"37 response.body = None38 if getattr(cherrypy, "debug", None):39 cherrypy.log(" Found file (304 Not Modified): %s" % path, "DEBUG")40 36 return False 41 37 response.headers['Last-Modified'] = strModifTime … … 86 82 87 83 if not modified_since(path, stat): 84 response.status = "304 Not Modified" 88 85 response.body = [] 86 if getattr(cherrypy, "debug", None): 87 cherrypy.log(" Found file (304 Not Modified): %s" % path, "DEBUG") 89 88 return [] 90 89

