1
0
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:
Malcolm Tredinnick
2007-07-16 03:50:22 +00:00
parent d5129eee59
commit 5dd9a2ab38
5 changed files with 28 additions and 15 deletions

View File

@@ -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))