guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] web: Accept dates with space-padded hour field.


From: Ricardo Wurmus
Subject: [PATCH] web: Accept dates with space-padded hour field.
Date: Mon, 2 May 2016 17:13:07 +0200

Fixes <http://bugs.gnu.org/23421>.

* module/web/http.scm (parse-rfc-822-date): Accept dates with
  space-padded hour field.
---
 module/web/http.scm | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/module/web/http.scm b/module/web/http.scm
index 8a07f6d..5ba2574 100644
--- a/module/web/http.scm
+++ b/module/web/http.scm
@@ -751,6 +751,22 @@ as an ordered alist."
                (minute (parse-non-negative-integer str 19 21))
                (second (parse-non-negative-integer str 22 24)))
            (make-date 0 second minute hour date month year zone-offset)))
+        ((string-match? (substring str 0 space) "aaa, dd aaa dddd  d:dd:dd")
+         (let ((date (parse-non-negative-integer str 5 7))
+               (month (parse-month str 8 11))
+               (year (parse-non-negative-integer str 12 16))
+               (hour (parse-non-negative-integer str 18 19))
+               (minute (parse-non-negative-integer str 20 22))
+               (second (parse-non-negative-integer str 23 25)))
+           (make-date 0 second minute hour date month year zone-offset)))
+        ((string-match? (substring str 0 space) "aaa, d aaa dddd  d:dd:dd")
+         (let ((date (parse-non-negative-integer str 5 6))
+               (month (parse-month str 7 10))
+               (year (parse-non-negative-integer str 11 15))
+               (hour (parse-non-negative-integer str 17 18))
+               (minute (parse-non-negative-integer str 19 21))
+               (second (parse-non-negative-integer str 22 24)))
+           (make-date 0 second minute hour date month year zone-offset)))
         (else
          (bad-header 'date str)         ; prevent tail call
          #f)))
-- 
2.7.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]