diff options
author | Braedon Vickers <braedon.vickers@gmail.com> | 2021-10-11 13:53:49 +0800 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2022-02-02 13:34:31 +0100 |
commit | eb1982ea22937a042f5a6e98c5709f779a8fd66c (patch) | |
tree | 88401e84478c11e37ead312111f0f652fee568bd /test/test_sendfile.py | |
parent | a885fd02737508de84ba7c0422b5d076ba6d3265 (diff) | |
download | bottle-eb1982ea22937a042f5a6e98c5709f779a8fd66c.tar.gz |
Fix handling of empty If-Modified-Since header for static files
Previously, if the If-Modified-Since header was an empty string it wouldn't
be parsed into an int (or None), but would still be compared to the int
mtime, causing a TypeError.
Diffstat (limited to 'test/test_sendfile.py')
-rwxr-xr-x | test/test_sendfile.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/test_sendfile.py b/test/test_sendfile.py index d6693c2..ef8eef5 100755 --- a/test/test_sendfile.py +++ b/test/test_sendfile.py @@ -95,6 +95,11 @@ class TestSendFile(unittest.TestCase): request.environ['HTTP_IF_MODIFIED_SINCE'] = bottle.http_date(100) self.assertEqual(open(__file__,'rb').read(), static_file(basename, root=root).body.read()) + def test_ims_empty(self): + """ SendFile: Empty If-Modified-Since""" + request.environ['HTTP_IF_MODIFIED_SINCE'] = '' + self.assertEqual(open(__file__, 'rb').read(), static_file(basename, root=root).body.read()) + def test_etag(self): """ SendFile: If-Modified-Since""" res = static_file(basename, root=root) |