Ticket #3206: etag_304.diff

File etag_304.diff, 625 bytes (added by Vinay Sajip <vinay_sajip@…>, 8 years ago)

Patch for HTTP 304 being returned inappropriately

  • django/middleware/common.py

     
    7373        # Use ETags, if requested.
    7474        if settings.USE_ETAGS:
    7575            etag = md5.new(response.content).hexdigest()
    76             if request.META.get('HTTP_IF_NONE_MATCH') == etag:
     76            if (response.status_code == 200) and (request.META.get('HTTP_IF_NONE_MATCH') == etag):
    7777                response = http.HttpResponseNotModified()
    7878            else:
    7979                response['ETag'] = etag
Back to Top