Author: mtredinnick
Date: 2007-06-17 02:21:09 -0500 (Sun, 17 Jun 2007)
New Revision: 5483
Modified:
django/trunk/django/middleware/common.py
Log:
Changed ETag computation to first check if an ETag header already exists in the
response.
Modified: django/trunk/django/middleware/common.py
===================================================================
--- django/trunk/django/middleware/common.py 2007-06-17 07:11:37 UTC (rev
5482)
+++ django/trunk/django/middleware/common.py 2007-06-17 07:21:09 UTC (rev
5483)
@@ -11,7 +11,8 @@
- Forbids access to User-Agents in settings.DISALLOWED_USER_AGENTS
- URL rewriting: Based on the APPEND_SLASH and PREPEND_WWW settings,
- this middleware appends missing slashes and/or prepends missing
"www."s.
+ this middleware appends missing slashes and/or prepends missing
+ "www."s.
- ETags: If the USE_ETAGS setting is set, ETags will be calculated from
the entire page content and Not Modified responses will be returned
@@ -74,7 +75,10 @@
# Use ETags, if requested.
if settings.USE_ETAGS:
- etag = md5.new(response.content).hexdigest()
+ if response.has_header('ETag'):
+ etag = response['ETag']
+ else:
+ etag = md5.new(response.content).hexdigest()
if response.status_code >= 200 and response.status_code < 300 and
request.META.get('HTTP_IF_NONE_MATCH') == etag:
response = http.HttpResponseNotModified()
else:
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---