summaryrefslogtreecommitdiffstats
path: root/Lib/BaseHTTPServer.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-02-17 13:34:16 (GMT)
committerGeorg Brandl <georg@python.org>2006-02-17 13:34:16 (GMT)
commit5d076961e285a74d3d5aeae88a52517c38c44846 (patch)
treed950098a3f739e74179fb91c21274749753bb5fd /Lib/BaseHTTPServer.py
parentbcd548bdb2f40bd739c6ff40f5903c74c190bc23 (diff)
downloadcpython-5d076961e285a74d3d5aeae88a52517c38c44846.zip
cpython-5d076961e285a74d3d5aeae88a52517c38c44846.tar.gz
cpython-5d076961e285a74d3d5aeae88a52517c38c44846.tar.bz2
Patch #1417555: SimpleHTTPServer now returns Last-Modified headers.
Diffstat (limited to 'Lib/BaseHTTPServer.py')
-rw-r--r--Lib/BaseHTTPServer.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py
index 722b50c..1b3d4db 100644
--- a/Lib/BaseHTTPServer.py
+++ b/Lib/BaseHTTPServer.py
@@ -436,10 +436,11 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
"""Return the server software version string."""
return self.server_version + ' ' + self.sys_version
- def date_time_string(self):
+ def date_time_string(self, timestamp=None):
"""Return the current date and time formatted for a message header."""
- now = time.time()
- year, month, day, hh, mm, ss, wd, y, z = time.gmtime(now)
+ 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,