unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] web: Accept dates with space-padded hour field.
@ 2016-05-02 15:13 Ricardo Wurmus
  0 siblings, 0 replies; only message in thread
From: Ricardo Wurmus @ 2016-05-02 15:13 UTC (permalink / raw)
  To: guile-devel

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




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-02 15:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-02 15:13 [PATCH] web: Accept dates with space-padded hour field Ricardo Wurmus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).