mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #4199 -- Changed date formatting in HTTP expires header to be spec
compliant. Thanks, Chris Bennett. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5712 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import datetime
|
||||
from email.Utils import formatdate
|
||||
|
||||
class ConditionalGetMiddleware(object):
|
||||
"""
|
||||
@@ -11,8 +11,7 @@ class ConditionalGetMiddleware(object):
|
||||
Also sets the Date and Content-Length response-headers.
|
||||
"""
|
||||
def process_response(self, request, response):
|
||||
now = datetime.datetime.utcnow()
|
||||
response['Date'] = now.strftime('%a, %d %b %Y %H:%M:%S GMT')
|
||||
response['Date'] = formatdate()[:26] + "GMT"
|
||||
if not response.has_header('Content-Length'):
|
||||
response['Content-Length'] = str(len(response.content))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user