[web/http_headers] do not crash when IfModifiedSince is empty string (closes #16527954) 3.24
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Sun, 04 Dec 2016 23:45:52 +0100
branch3.24
changeset 11883 0cb36982db94
parent 11882 ccf61228a802
child 11889 207e6d088791
[web/http_headers] do not crash when IfModifiedSince is empty string (closes #16527954)
cubicweb/web/http_headers.py
--- a/cubicweb/web/http_headers.py	Wed Dec 07 14:07:35 2016 +0100
+++ b/cubicweb/web/http_headers.py	Sun Dec 04 23:45:52 2016 +0100
@@ -164,7 +164,7 @@
     """Convert an HTTP date string (one of three formats) to seconds since epoch."""
     parts = dateString.split()
 
-    if not parts[0][0:3].lower() in weekdayname_lower:
+    if parts and not parts[0][0:3].lower() in weekdayname_lower:
         # Weekday is stupid. Might have been omitted.
         try:
             return parseDateTime("Sun, "+dateString)