diff -r 66d0f6ef2a7f Lib/http/server.py --- a/Lib/http/server.py Thu Feb 28 18:03:16 2013 +0200 +++ b/Lib/http/server.py Thu Feb 28 21:39:42 2013 -0500 @@ -87,6 +87,7 @@ import html import email.message import email.parser +import email.utils import http.client import io import mimetypes @@ -538,27 +539,20 @@ """Return the current date and time formatted for a message header.""" if timestamp is None: timestamp = time.time() - year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp) - s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( - self.weekdayname[wd], - day, self.monthname[month], year, - hh, mm, ss) + s = email.utils.formatdate(timestamp, False, True) return s def log_date_time_string(self): """Return the current time formatted for logging.""" + monthname = [None, + 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', + 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] now = time.time() year, month, day, hh, mm, ss, x, y, z = time.localtime(now) s = "%02d/%3s/%04d %02d:%02d:%02d" % ( - day, self.monthname[month], year, hh, mm, ss) + day, monthname[month], year, hh, mm, ss) return s - weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] - - monthname = [None, - 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', - 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] - def address_string(self): """Return the client address."""