Skip to content

Commit 57d408d

Browse files
author
Richard Jones
committed
better if-modified-since handling for cgi-bin
1 parent 12116cc commit 57d408d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

roundup/cgi/client.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.101 2003-02-27 05:43:01 richard Exp $
1+
# $Id: client.py,v 1.102 2003-03-07 21:51:31 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -443,9 +443,10 @@ def serve_file(self, designator, dre=re.compile(r'([^\d]+)(\d+)')):
443443

444444
def serve_static_file(self, file):
445445
# see if there's an if-modified-since...
446-
ims = self.request.headers.getheader('if-modified-since')
447-
# cgi will put the header in the env var
448-
if not ims and self.env.has_key('HTTP_IF_MODIFIED_SINCE'):
446+
if hasattr(self.request, 'headers'):
447+
ims = self.request.headers.getheader('if-modified-since')
448+
elif self.env.has_key('HTTP_IF_MODIFIED_SINCE'):
449+
# cgi will put the header in the env var
449450
ims = self.env['HTTP_IF_MODIFIED_SINCE']
450451
filename = os.path.join(self.instance.config.TEMPLATES, file)
451452
lmt = os.stat(filename)[stat.ST_MTIME]

0 commit comments

Comments
 (0)