From 63a1304f544e2af5b81c3e1bf67441478c23ee39 Mon Sep 17 00:00:00 2001
From: Malcolm Tredinnick <malcolm.tredinnick@gmail.com>
Date: Fri, 1 Jun 2007 11:47:54 +0000
Subject: [PATCH] Fixed #3206 -- Changed ETag comparison to only return 304
 when the normal status code would be in the range 200 - 299. This matches RFC
 2616 requirements. Based on a patch from Vinay Sajip.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@5407 bcc190cf-cafb-0310-a4f2-bffc1f526a37
---
 django/middleware/common.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/django/middleware/common.py b/django/middleware/common.py
index 2c72c9a583..85703d2a0b 100644
--- a/django/middleware/common.py
+++ b/django/middleware/common.py
@@ -75,7 +75,7 @@ class CommonMiddleware(object):
         # Use ETags, if requested.
         if settings.USE_ETAGS:
             etag = md5.new(response.content).hexdigest()
-            if request.META.get('HTTP_IF_NONE_MATCH') == etag:
+            if response.status_code >= 200 and response.status_code < 300 and response.statusrequest.META.get('HTTP_IF_NONE_MATCH') == etag:
                 response = http.HttpResponseNotModified()
             else:
                 response['ETag'] = etag