HTTP header date made independent of locale, fixes #1997

This commit is contained in:
Faelysse
2018-09-06 14:46:07 +02:00
parent 33c6dd9656
commit 6e0da9cea7
3 changed files with 52 additions and 4 deletions
+2 -1
View File
@@ -16,6 +16,7 @@ import time
import re
import errno
from gluon.http import HTTP
from gluon.utils import unlocalised_http_header_date
from gluon.contenttype import contenttype
from gluon._compat import PY2
@@ -74,7 +75,7 @@ def stream_file_or_304_or_206(
stat_file = os.stat(static_file)
fsize = stat_file[stat.ST_SIZE]
modified = stat_file[stat.ST_MTIME]
mtime = time.strftime('%a, %d %b %Y %H:%M:%S GMT', time.gmtime(modified))
mtime = unlocalised_http_header_date(time.gmtime(modified))
headers.setdefault('Content-Type', contenttype(static_file))
headers.setdefault('Last-Modified', mtime)
headers.setdefault('Pragma', 'cache')