Am 2024-01-30 23:56, schrieb Jonas Vautherin via Postfix-users:

...
Received: from mx5 ([15.102.1.34])
 by compute1.internal (LMTPProxy); Fri, 05 Jan 2024 16:48:38 -0500
Received: from mx5.messagingengine.com (localhost [127.0.0.1])
        by mailmx.nyi.internal (Postfix) with ESMTP id DACD72720075
        for <[email protected]>; Fri,  5 Jan 2024 16:48:37 -0500 (EST)

Somehow the date first appears as "Fri, 05 Jan 2024 16:48:38 -0500", and then as "Fri, 5 Jan 2024 16:48:37 -0500 (EST)". Note that the '0' was replaced by a white space, ending up with two white spaces between "Fri," and "5 Jan". If this is a valid date format, then I need to contribute a fix in isync. But is it
valid?

I tried to find the specifications for a date, and ended up on RFC5322 [2],
which defines:

```
date-time       =   [ day-of-week "," ] date time [CFWS]
```

To me, this looks like only one white space is allowed between `[ day-of-week
"," ]` and `date`.


No, that is a wrong interpretation: day-of-week, ",", date, time, CFWS are all syntatic tokens and [] means optional. The blanks between the tokens do not belong to the syntax. If you generate a date-time with all optional fields it would be

day-of-week,datetimeCFWS

without any blanks. Blanks could only be there if the tokens itself include blank(s).


Therefore you have to look for the definition of each token. In this case the definition of date is relevant:

date            =   day month year

This means date is build of three tokens: day, month, year. Let's look at day:

day             =   ([FWS] 1*2DIGIT FWS) / obs-day

This says a day can consist of one or two digits preceded by an optional folding white space (FWS):

FWS             =   ([*WSP CRLF] 1*WSP) /  obs-FWS

A FWS can be a single WSP or a folded line.

Therefore the date "Fri, 5 Jan 2024 16:48:37 -0500 (EST)" is syntactically incorrect, because there can be only one blank between "," and "5", not two by the syntax of RFC 5322. However, if you look at the obs-*** definitions, they allow multiple WSPs which should not be generated by new software. But a parser should be able to handle multiple blanks.

Hope this helps.

Michael
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to