Skip to content

Commit

Permalink
Minor naming isssue handled.
Browse files Browse the repository at this point in the history
  • Loading branch information
paronsson committed Jan 29, 2012
1 parent 4796ad7 commit 88c3b12
Showing 1 changed file with 12 additions and 20 deletions.
32 changes: 12 additions & 20 deletions yesod-core/Yesod/Handler.hs
Expand Up @@ -59,6 +59,7 @@ module Yesod.Handler
, sendWaiResponse
-- * Setting headers
, setCookie
, getExpires
, deleteCookie
, setHeader
, setLanguage
Expand Down Expand Up @@ -120,7 +121,7 @@ module Yesod.Handler
import Prelude hiding (catch)
import Yesod.Internal.Request
import Yesod.Internal
import Data.Time (UTCTime)
import Data.Time (UTCTime, getCurrentTime, addUTCTime)

import Control.Exception hiding (Handler, catch, finally)
import Control.Applicative
Expand Down Expand Up @@ -629,6 +630,14 @@ setCookie :: SetCookie
-> GHandler sub master ()
setCookie = addHeader . AddCookie

-- | Helper function for setCookieExpires value
getExpires :: Int -- ^ minutes
-> IO UTCTime
getExpires m = do
now <- liftIO getCurrentTime
return $ fromIntegral (m * 60) `addUTCTime` now


-- | Unset the cookie on the client.
--
-- Note: although the value used for key and path is 'Text', you should only
Expand All @@ -638,6 +647,7 @@ deleteCookie :: Text -- ^ key
-> GHandler sub master ()
deleteCookie a = addHeader . DeleteCookie (encodeUtf8 a) . encodeUtf8


-- | Set the language in the user session. Will show up in 'languages' on the
-- next request.
setLanguage :: Text -> GHandler sub master ()
Expand Down Expand Up @@ -783,25 +793,7 @@ yarToResponse renderHeaders (YARPlain s hs ct c sessionFinal) =
finalHeaders = renderHeaders hs ct sessionFinal
finalHeaders' len = ("Content-Length", S8.pack $ show len)
: finalHeaders
{-
getExpires m = fromIntegral (m * 60) `addUTCTime` now
sessionVal =
case key' of
Nothing -> B.empty
Just key'' -> encodeSession key'' exp' host
$ Map.toList
$ Map.insert nonceKey (reqNonce rr) sessionFinal
hs' =
case key' of
Nothing -> hs
Just _ -> AddCookie
(clientSessionDuration y)
sessionName
(bsToChars sessionVal)
: hs
hs'' = map (headerToPair getExpires) hs'
hs''' = ("Content-Type", charsToBs ct) : hs''
-}


httpAccept :: W.Request -> [ContentType]
httpAccept = parseHttpAccept
Expand Down

0 comments on commit 88c3b12

Please sign in to comment.