From 19d2b58465aa09c6ff0766b0accc2a94cc425415 Mon Sep 17 00:00:00 2001
From: Arun Isaac
Date: Sat, 5 Dec 2020 20:05:56 +0530
Subject: email: Support obsolete Received header.

* email/email.scm (received): Include obsolete pattern.
(parse-mime-entity): Post process obsolete received forms.
---
 email/email.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'email')

diff --git a/email/email.scm b/email/email.scm
index 398ddb3..e624a98 100644
--- a/email/email.scm
+++ b/email/email.scm
@@ -545,7 +545,8 @@
   (or angle-addr addr-spec domain word))
 
 (define-field-pattern received "Received"
-  (and (* received-token) (ignore ";") date-time))
+  (and (* received-token) (ignore ";") date-time)
+  (* received-token))
 
 (define-peg-pattern path body
   (or angle-addr (and (? cfws) (ignore "<") (? cfws) (ignore ">") (? cfws))))
@@ -1005,7 +1006,9 @@ list of header keys and values."
     (match-pattern fields headers))
    `((received . ,(match-lambda*
                     (`(received ,tokens ,timestamp)
-                     (list 'received (string-join tokens) timestamp))))
+                     (list 'received (string-join tokens) timestamp))
+                    (('received tokens ...)
+                     (list 'received (string-join tokens)))))
      (received-token . ,(match-lambda*
                           (`(received-token ,token) token)))
      (date-time . ,(lambda node
-- 
cgit v1.2.3