brendanhay / amazonka

A comprehensive Amazon Web Services SDK for Haskell.
https://amazonka.brendanhay.nz
Other
605 stars 226 forks source link

RFC822 time parser does not handle single digit day #1009

Open tjdett opened 3 weeks ago

tjdett commented 3 weeks ago
Failed reading: Failure parsing Time from value: "Mon, 4 Nov 2024 06:48:27 GMT"

While references like MDN refer to <day> as being two digit, it is actually defined as 1*2DIGIT in both the original RFC822 and in the more recent RFC5322.

According to RFC1945, this means it can be validly be either one or two digits:

*rule
       The character "*" preceding an element indicates repetition. The
       full form is "<n>*<m>element" indicating at least <n> and at
       most <m> occurrences of element. Default values are 0 and
       infinity so that "*(element)" allows any number, including zero;
       "1*element" requires at least one; and "1*2element" allows one
       or two.

This was discovered when testing functionality using Amazonka 2.x against the rclone serve s3 server.