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/urllib2.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/urllib2.py')
-rw-r--r-- | Lib/urllib2.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py index f1c94e1..644b380 100644 --- a/Lib/urllib2.py +++ b/Lib/urllib2.py @@ -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' % |