Index: Lib/BaseHTTPServer.py =================================================================== --- Lib/BaseHTTPServer.py (revision 76430) +++ Lib/BaseHTTPServer.py (working copy) @@ -72,6 +72,7 @@ import sys import time +import rfc822 import socket # For gethostbyaddr() from warnings import filterwarnings, catch_warnings with catch_warnings(): @@ -460,14 +461,7 @@ def date_time_string(self, timestamp=None): """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) - return s + return rfc822.formatdate(timestamp) def log_date_time_string(self): """Return the current time formatted for logging.""" @@ -477,8 +471,6 @@ day, self.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'] Index: Lib/rfc822.py =================================================================== --- Lib/rfc822.py (revision 76430) +++ Lib/rfc822.py (working copy) @@ -956,7 +956,7 @@ According to RFC 1123, day and month names must always be in English. If not for that, this code could use strftime(). It - can't because strftime() honors the locale and could generated + can't because strftime() honors the locale and could generate non-English names. """ if timeval is None: