Code

Ticket #13600: 13600.diff

File 13600.diff, 1.3 KB (added by SmileyChris, 4 years ago)
Line 
1diff --git a/django/views/static.py b/django/views/static.py
2index d9117f2..475df23 100644
3--- a/django/views/static.py
4+++ b/django/views/static.py
5@@ -132,6 +132,6 @@ def was_modified_since(header=None, mtime=0, size=0):
6             raise ValueError
7         if mtime > header_mtime:
8             raise ValueError
9-    except (AttributeError, ValueError):
10+    except (AttributeError, ValueError, OverflowError):
11         return True
12     return False
13diff --git a/tests/regressiontests/views/tests/static.py b/tests/regressiontests/views/tests/static.py
14index d7e87d1..62a9786 100644
15--- a/tests/regressiontests/views/tests/static.py
16+++ b/tests/regressiontests/views/tests/static.py
17@@ -25,3 +25,12 @@ class StaticTests(TestCase):
18         file = open(path.join(media_dir, file_name))
19         self.assertEquals(file.read(), response.content)
20 
21+    def test_crazydate(self):
22+        crazy_date = 'Mon, 28 May 999999999999 28:25:26 GMT'
23+        filename = 'file.txt'
24+        response = self.client.get('/views/site_media/%s' % filename,
25+                                   HTTP_IF_MODIFIED_SINCE=crazy_date)
26+        file = open(path.join(media_dir, filename))
27+        self.assertEquals(file.read(), response.content)
28+        self.assertEquals(len(response.content),
29+                          int(response['Content-Length']))