diff --git a/module/web/http.scm b/module/web/http.scm index 216fddd..2ab5bd0 100644 --- a/module/web/http.scm +++ b/module/web/http.scm @@ -1,6 +1,6 @@ ;;; HTTP messages -;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. +;; Copyright (C) 2010, 2011, 2012, 2013 Free Software Foundation, Inc. ;; This library is free software; you can redistribute it and/or ;; modify it under the terms of the GNU Lesser General Public @@ -732,6 +732,20 @@ 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 0))) + ((string-match? str "aaa, dd aaa dddd dd:dd:dd .0000") + (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 17 19)) + (minute (parse-non-negative-integer str 20 22)) + (second (parse-non-negative-integer str 23 25)) + (tz (parse-non-negative-integer str 28 31)) + (tz-sign (case (string-ref str 27) + ((#\+) +1) + ((#\-) -1) + (else (bad-header 'date str) #f)))) + (make-date 0 second minute hour date month year + (* tz-sign tz)))) (else (bad-header 'date str) ; prevent tail call #f))) @@ -778,7 +792,8 @@ as an ordered alist." (make-date 0 second minute hour date month year 0))) (define (parse-date str) - (if (string-suffix? " GMT" str) + (if (or (string-suffix? " GMT" str) + (string-match "[+-][0-9]{4}$" str)) (let ((comma (string-index str #\,))) (cond ((not comma) (bad-header 'date str)) ((= comma 3) (parse-rfc-822-date str))