Lucu-0.4.2: HTTP Daemonic Library



This module parses and prints RFC 1123 Date and Time string.

In general you don't have to use this module directly.



formatRFC1123DateTime :: ZonedTime -> StringSource

Format a System.Time.CalendarTime to RFC 1123 Date and Time string.

formatHTTPDateTime :: UTCTime -> StringSource

Format a System.Time.ClockTime to HTTP Date and Time. Time zone will be always UTC but prints as GMT.

parseHTTPDateTime :: ByteString -> Maybe UTCTimeSource

Parse an HTTP Date and Time.

Limitation: RFC 2616 (HTTP/1.1) says we must accept these three formats:

  • Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
  • Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
  • Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format

...but currently this function only supports the RFC 1123 format. This is a violation of RFC 2616 so this should be fixed later. What a bother!