changeset 5301:ee5c26854fbc

AttachFile do=get crashing, bug somewhere in stdlib / werkzeug / user agent, collect data, avoid crash
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 22 Nov 2009 09:57:04 +0100
parents af42eec12f38
children abd4336edd29
files MoinMoin/action/AttachFile.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sat Nov 21 16:31:36 2009 +0100
+++ b/MoinMoin/action/AttachFile.py	Sun Nov 22 09:57:04 2009 +0100
@@ -815,7 +815,15 @@
         return # error msg already sent in _access_file
 
     timestamp = datetime.datetime.fromtimestamp(os.path.getmtime(fpath))
-    if_modified = request.if_modified_since
+    try:
+        if_modified = request.if_modified_since
+    except OverflowError:
+        # there is likely a bug somewhere in stdlib or werkzeug that triggers this
+        # we collect more data about it here and avoid moin crashing
+        logging.exception("HTTP_IF_MODIFIED_SINCE == %r caused an OverflowError" %
+                          request.environ.get('HTTP_IF_MODIFIED_SINCE'))
+        if_modified = None
+
     if if_modified and if_modified >= timestamp:
         request.status_code = 304
     else: