diff options
author | Anthony Baxter <anthonybaxter@gmail.com> | 2004-10-11 13:53:08 (GMT) |
---|---|---|
committer | Anthony Baxter <anthonybaxter@gmail.com> | 2004-10-11 13:53:08 (GMT) |
commit | 3dd9e461618b0964312fa3c649cf03c7bfe27827 (patch) | |
tree | b8c98e967b38f936410f4e3fddda413bc9c8db3d /Lib/urllib.py | |
parent | 7f468f29f49786988e4f1a005174578fc83c7eb9 (diff) | |
download | cpython-3dd9e461618b0964312fa3c649cf03c7bfe27827.zip cpython-3dd9e461618b0964312fa3c649cf03c7bfe27827.tar.gz cpython-3dd9e461618b0964312fa3c649cf03c7bfe27827.tar.bz2 |
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).
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r-- | Lib/urllib.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index 2969ef0..e2f01c5 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -410,7 +410,7 @@ class URLopener: def open_local_file(self, url): """Use local file.""" - import mimetypes, mimetools, rfc822, StringIO + import mimetypes, mimetools, email.Utils, StringIO host, file = splithost(url) localname = url2pathname(file) try: @@ -418,7 +418,7 @@ class URLopener: except OSError, e: raise IOError(e.errno, e.strerror, e.filename) size = stats.st_size - modified = rfc822.formatdate(stats.st_mtime) + modified = email.Utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' % |