Loading django/middleware/common.py +3 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,9 @@ class CommonMiddleware(object): if response.has_header('ETag'): return get_conditional_response( request, etag=response['ETag'], # get_conditional_response() requires an unquoted version # of the response's ETag. etag=response['ETag'].strip('"'), response=response, ) Loading docs/releases/1.9.1.txt +3 −0 Original line number Diff line number Diff line Loading @@ -19,3 +19,6 @@ Bugfixes * Fixed a state bug when migrating a ``SeparateDatabaseAndState`` operation backwards (:ticket:`25896`). * Fixed a regression in ``CommonMiddleware`` causing ``If-None-Match`` checks to always return HTTP 200 (:ticket:`25900`). tests/middleware/tests.py +10 −0 Original line number Diff line number Diff line Loading @@ -291,6 +291,16 @@ class CommonMiddlewareTest(SimpleTestCase): res = StreamingHttpResponse(['content']) self.assertFalse(CommonMiddleware().process_response(req, res).has_header('ETag')) @override_settings(USE_ETAGS=True) def test_if_none_match(self): first_req = HttpRequest() first_res = CommonMiddleware().process_response(first_req, HttpResponse('content')) second_req = HttpRequest() second_req.method = 'GET' second_req.META['HTTP_IF_NONE_MATCH'] = first_res['ETag'] second_res = CommonMiddleware().process_response(second_req, HttpResponse('content')) self.assertEqual(second_res.status_code, 304) # Other tests @override_settings(DISALLOWED_USER_AGENTS=[re.compile(r'foo')]) Loading Loading
django/middleware/common.py +3 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,9 @@ class CommonMiddleware(object): if response.has_header('ETag'): return get_conditional_response( request, etag=response['ETag'], # get_conditional_response() requires an unquoted version # of the response's ETag. etag=response['ETag'].strip('"'), response=response, ) Loading
docs/releases/1.9.1.txt +3 −0 Original line number Diff line number Diff line Loading @@ -19,3 +19,6 @@ Bugfixes * Fixed a state bug when migrating a ``SeparateDatabaseAndState`` operation backwards (:ticket:`25896`). * Fixed a regression in ``CommonMiddleware`` causing ``If-None-Match`` checks to always return HTTP 200 (:ticket:`25900`).
tests/middleware/tests.py +10 −0 Original line number Diff line number Diff line Loading @@ -291,6 +291,16 @@ class CommonMiddlewareTest(SimpleTestCase): res = StreamingHttpResponse(['content']) self.assertFalse(CommonMiddleware().process_response(req, res).has_header('ETag')) @override_settings(USE_ETAGS=True) def test_if_none_match(self): first_req = HttpRequest() first_res = CommonMiddleware().process_response(first_req, HttpResponse('content')) second_req = HttpRequest() second_req.method = 'GET' second_req.META['HTTP_IF_NONE_MATCH'] = first_res['ETag'] second_res = CommonMiddleware().process_response(second_req, HttpResponse('content')) self.assertEqual(second_res.status_code, 304) # Other tests @override_settings(DISALLOWED_USER_AGENTS=[re.compile(r'foo')]) Loading