[Issue 12886] std.datetime cannot parse HTTP date

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 18 13:08:35 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12886

--- Comment #5 from github-bugzilla at puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/daab9927fa0e7c224e1b2200c2c287957580aa03
Implement issue# 12886: function for parsing RFC822/5322 date-time format.

The RFC 822 / 5322 date-time format should be taken out and shot, but
unfortunately, it _is_ used in e-mail, HTTP, RTSP, etc. Most code which
deals with it is probably going to need to handle the rest of whatever
spec it's interacting with rather than just the date-time format, but
there are cases where this would be useful on its own (e.g. Martin
apparently needs something like this in the dmd installer), so I'm
adding a function to parse this format and return a SysTime to
std.datetime.

However, that's all I'm adding. I find it very hard to believe that
anyone who needs to produce this particular format doesn't need a lot of
other functionality specific to whatever spec they're dealing with, and
the function for generating the date-time format presumably will be
included with that (and I definitely don't want to encourage this
format's use anyway, since it's a horrible format). So, I'm just adding
a function for parsing the format, not generating it.

parseRFC822DateTime _should_ fully and correctly implement the format as
outlined in RFC 5322 (including the obsolete syntax from RFC 822 that no
one is supposed to be generating anymore and the comment folding
whitespace nonsense that should never have been legal anywhere but at
the end). And the tests are quite thorough, so it's unlikely that I
missed anything, but you never know.

https://github.com/D-Programming-Language/phobos/commit/e63514cea498c1b97a36cec3c93058fbc18eac17
Merge pull request #2253 from jmdavis/rfc822

Implement issue# 12886: function for parsing RFC822/5322 date-time format.

--


More information about the Digitalmars-d-bugs mailing list