mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Added a usegmt flag to email.Utils.formatdate - this allows it to be
used to replace rfc822.formatdate for protocols like HTTP (where 'GMT' must be the timezone string).
This commit is contained in:
parent
7f468f29f4
commit
3dd9e46161
5 changed files with 28 additions and 7 deletions
|
|
@ -99,7 +99,6 @@ import os
|
|||
import posixpath
|
||||
import random
|
||||
import re
|
||||
import rfc822
|
||||
import sha
|
||||
import socket
|
||||
import sys
|
||||
|
|
@ -1129,12 +1128,13 @@ class FileHandler(BaseHandler):
|
|||
|
||||
# not entirely sure what the rules are here
|
||||
def open_local_file(self, req):
|
||||
import email.Utils
|
||||
host = req.get_host()
|
||||
file = req.get_selector()
|
||||
localfile = url2pathname(file)
|
||||
stats = os.stat(localfile)
|
||||
size = stats.st_size
|
||||
modified = rfc822.formatdate(stats.st_mtime)
|
||||
modified = email.Utils.formatdate(stats.st_mtime, usegmt=True)
|
||||
mtype = mimetypes.guess_type(file)[0]
|
||||
headers = mimetools.Message(StringIO(
|
||||
'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' %
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue