where
import Control.Monad
+import Data.ByteString.Base (LazyByteString)
import Network.HTTP.Lucu.Format
import Network.HTTP.Lucu.Parser
import System.Time
week :: [String]
week = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
--- |Format a @CalendarTime@ to RFC 1123 Date and Time string.
+-- |Format a 'System.Time.CalendarTime' to RFC 1123 Date and Time
+-- string.
formatRFC1123DateTime :: CalendarTime -> String
formatRFC1123DateTime time
= time `seq`
id (ctTZName time)
--- |Format a @ClockTime@ to HTTP Date and Time. Time zone will be
--- always UTC but prints as GMT.
+-- |Format a 'System.Time.ClockTime' to HTTP Date and Time. Time zone
+-- will be always UTC but prints as GMT.
formatHTTPDateTime :: ClockTime -> String
formatHTTPDateTime time
= time `seq`
-- ...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!
-parseHTTPDateTime :: String -> Maybe ClockTime
+parseHTTPDateTime :: LazyByteString -> Maybe ClockTime
parseHTTPDateTime src
- = case parseStr httpDateTime src of
+ = case parse httpDateTime src of
(# Success ct, _ #) -> Just ct
(# _ , _ #) -> Nothing