Network.HTTP.Date

http-date-0.0.11: HTTP Date parser/formatter

Safe Haskell | None
Language | Haskell2010

Network.HTTP.Date

Contents

- Utility functions

Description

Fast parser and formatter for HTTP Date.

Synopsis

- epochTimeToHTTPDate :: EpochTime -> HTTPDate
- httpDateToUTC :: HTTPDate -> UTCTime
- utcToHTTPDate :: UTCTime -> HTTPDate
- data HTTPDate
- defaultHTTPDate :: HTTPDate
- parseHTTPDate :: ByteString -> Maybe HTTPDate
- formatHTTPDate :: HTTPDate -> ByteString

# Documentation

epochTimeToHTTPDate :: EpochTime -> HTTPDate #

Translating `EpochTime` to `HTTPDate`.

httpDateToUTC :: HTTPDate -> UTCTime #

Translating `HTTPDate` to `UTCTime`.

Since 0.0.7.

utcToHTTPDate :: UTCTime -> HTTPDate #

Translating `UTCTime` to `HTTPDate`.

Since 0.0.7.

data HTTPDate #

Data structure for HTTP Date. This value should be specified with `defaultHTTPDate` and its field labels.

#### Instances

Instances details

Show HTTPDate # |
Instance details Defined in Network.HTTP.Date.Types Methods showsPrec :: Int -> HTTPDate -> ShowS # show :: HTTPDate -> String # showList :: [HTTPDate] -> ShowS #
Eq HTTPDate # |
Instance details Defined in Network.HTTP.Date.Types Methods (==) :: HTTPDate -> HTTPDate -> Bool # (/=) :: HTTPDate -> HTTPDate -> Bool #
Ord HTTPDate # |
Instance details Defined in Network.HTTP.Date.Types Methods compare :: HTTPDate -> HTTPDate -> Ordering # (<) :: HTTPDate -> HTTPDate -> Bool # (<=) :: HTTPDate -> HTTPDate -> Bool # (>) :: HTTPDate -> HTTPDate -> Bool # (>=) :: HTTPDate -> HTTPDate -> Bool # max :: HTTPDate -> HTTPDate -> HTTPDate # min :: HTTPDate -> HTTPDate -> HTTPDate #

defaultHTTPDate :: HTTPDate #

A default value for `HTTPDate`.

# Utility functions

parseHTTPDate :: ByteString -> Maybe HTTPDate #

Parsing HTTP Date. Currently only RFC1123 style is supported.

    >>> parseHTTPDate "Tue, 15 Nov 1994 08:12:31 GMT"
    Just (HTTPDate {hdYear = 1994, hdMonth = 11, hdDay = 15, hdHour = 8, hdMinute = 12, hdSecond = 31, hdWkday = 2})

formatHTTPDate :: HTTPDate -> ByteString #

Generating HTTP Date in RFC1123 style.

    >>> formatHTTPDate defaultHTTPDate {hdYear = 1994, hdMonth = 11, hdDay = 15, hdHour = 8, hdMinute = 12, hdSecond = 31, hdWkday = 2}
    "Tue, 15 Nov 1994 08:12:31 GMT"