Opened 14 years ago

Last modified 14 years ago

#13600 closed

OverflowError not caught in django.views.static.serve — at Version 1

Reported by: Konstantin Hlyzov Owned by: nobody
Component: HTTP handling Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Alex Gaynor)

I noticed that sometimes I get an "OverflowError: mktime argument out of range" error in django.views.static.serve, when a request is made with a strange date, say, request.META contents something like {'HTTP_IF_MODIFIED_SINCE': 'Mon, 28 May 3121 28:25:26 GMT'}.

Python docs say on this that the exceptions raised in mktime are either ValueError (if caught in Python layer) or OverflowError (if caught in C layer).

I suppose it could be fixed with replacing the third endmost line in django.views.static.was_modified_since from actual

    except (AttributeError, ValueError):

to

    except (AttributeError, ValueError, OverflowError):

Probably, there has been some reason not to catch OverflowErrors, then sorry.

Change History (1)

comment:1 by Alex Gaynor, 14 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top