Ticket #10681: 10681.diff

File 10681.diff, 1.4 KB (added by Ivan Sagalaev, 16 years ago)

Patch

  • django/views/decorators/http.py

    === modified file 'django/views/decorators/http.py'
     
    7575            if if_none_match or if_match:
    7676                # There can be more than one ETag in the request, so we
    7777                # consider the list of values.
    78                 etags = parse_etags(if_none_match or if_match)
     78                try:
     79                    etags = parse_etags(if_none_match or if_match)
     80                except ValueError:
     81                    # In case of invalid etag ignore all etag headers
     82                    if_none_match = None
     83                    if_match = None
    7984
    8085            # Compute values (if any) for the requested resource.
    8186            if etag_func:
  • tests/regressiontests/conditional_processing/models.py

    === modified file 'tests/regressiontests/conditional_processing/models.py'
     
    112112        response = self.client.get('/condition/last_modified2/')
    113113        self.assertFullResponse(response, check_etag=False)
    114114
     115    def testInvalidETag(self):
     116        self.client.defaults['HTTP_IF_NONE_MATCH'] = '"\\"'
     117        response = self.client.get('/condition/etag/')
     118        self.assertFullResponse(response, check_last_modified=False)
     119
    115120
    116121class ETagProcesing(TestCase):
    117122    def testParsing(self):
Back to Top