Django

Code

Changeset 7659

Show
Ignore:
Timestamp:
06/15/08 23:13:04 (3 months ago)
Author:
adrian
Message:

Fixed #7228 -- Fixed our ETag header creation to meet the HTTP spec, by quoting it. Thanks, skjohn@us.ibm.com

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/middleware/common.py

    r6852 r7659  
    109109                etag = response['ETag'] 
    110110            else: 
    111                 etag = md5.new(response.content).hexdigest() 
     111                etag = '"%s"' % md5.new(response.content).hexdigest() 
    112112            if response.status_code >= 200 and response.status_code < 300 and request.META.get('HTTP_IF_NONE_MATCH') == etag: 
    113113                cookies = response.cookies 
  • django/trunk/django/utils/cache.py

    r6736 r7659  
    105105        cache_timeout = 0 # Can't have max-age negative 
    106106    if not response.has_header('ETag'): 
    107         response['ETag'] = md5.new(response.content).hexdigest() 
     107        response['ETag'] = '"%s"' % md5.new(response.content).hexdigest() 
    108108    if not response.has_header('Last-Modified'): 
    109109        response['Last-Modified'] = http_date()