]> git.dolda2000.com Git - wrw.git/commitdiff
Fix phttpdate bug.
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 27 Jan 2025 19:56:26 +0000 (20:56 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 27 Jan 2025 19:56:26 +0000 (20:56 +0100)
wrw/proto.py

index 5a2fee7a02ae1da137e3cbf6f4a8ebe5a26e8b45..fe907ea9058f5101994f0173963c8d689b0f715f 100644 (file)
@@ -47,7 +47,7 @@ def httpdate(ts):
 def phttpdate(dstr):
     tz = dstr[-6:]
     dstr = dstr[:-6]
-    if tz[0] != " " or (tz[1] != "+" and tz[1] != "-") or not tz[2:].isdigit():
+    if len(tz) < 6 or tz[0] != " " or (tz[1] != "+" and tz[1] != "-") or not tz[2:].isdigit():
         return None
     tz = int(tz[1:])
     tz = (((tz / 100) * 60) + (tz % 100)) * 60