Cookie expire dates fixed
This commit is contained in:
parent
09f1a03be2
commit
f80cfab5d7
@ -45,6 +45,7 @@ module Yesod.Content
|
||||
-- * Utilities
|
||||
, formatW3
|
||||
, formatRFC1123
|
||||
, formatCookieExpires
|
||||
#if TEST
|
||||
, testSuite
|
||||
#endif
|
||||
@ -249,10 +250,14 @@ caseTypeByExt = do
|
||||
Just typeHtml @=? lookup (ext "foo.html") typeByExt
|
||||
#endif
|
||||
|
||||
-- | Format a 'UTCTime' in W3 format; useful for setting cookies.
|
||||
-- | Format a 'UTCTime' in W3 format.
|
||||
formatW3 :: UTCTime -> String
|
||||
formatW3 = formatTime defaultTimeLocale "%FT%X-00:00"
|
||||
|
||||
-- | Format as per RFC 1123.
|
||||
formatRFC1123 :: UTCTime -> String
|
||||
formatRFC1123 = formatTime defaultTimeLocale "%a, %d %b %Y %X %Z"
|
||||
|
||||
-- | Format a 'UTCTime' for a cookie.
|
||||
formatCookieExpires :: UTCTime -> String
|
||||
formatCookieExpires = formatTime defaultTimeLocale "%a, %d-%b-%Y %X GMT"
|
||||
|
||||
@ -385,7 +385,7 @@ headerToPair getExpires (AddCookie minutes key value) =
|
||||
let expires = getExpires minutes
|
||||
in ("Set-Cookie", charsToBs
|
||||
$ key ++ "=" ++ value ++"; path=/; expires="
|
||||
++ formatW3 expires)
|
||||
++ formatCookieExpires expires)
|
||||
headerToPair _ (DeleteCookie key) =
|
||||
("Set-Cookie", charsToBs $
|
||||
key ++ "=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT")
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod
|
||||
version: 0.6.1.2
|
||||
version: 0.6.1.3
|
||||
license: BSD3
|
||||
license-file: LICENSE
|
||||
author: Michael Snoyman <michael@snoyman.com>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user