From 2d0f560bea358c65a314a03554a28d0dfcdbe815 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 19 Aug 2013 12:51:47 +0300 Subject: [PATCH 01/16] wai 2.0 --- yesod-core/Yesod/Core/Handler.hs | 23 ++++++++++- yesod-core/Yesod/Core/Internal/Response.hs | 15 ++++++- yesod-core/Yesod/Core/Internal/Run.hs | 46 +++++++++++++++++++--- yesod-core/yesod-core.cabal | 4 +- yesod-eventsource/yesod-eventsource.cabal | 4 +- yesod-static/yesod-static.cabal | 4 +- yesod/yesod.cabal | 6 +-- 7 files changed, 84 insertions(+), 18 deletions(-) diff --git a/yesod-core/Yesod/Core/Handler.hs b/yesod-core/Yesod/Core/Handler.hs index f3b1799b..c956abc4 100644 --- a/yesod-core/Yesod/Core/Handler.hs +++ b/yesod-core/Yesod/Core/Handler.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleInstances #-} @@ -229,11 +230,19 @@ runRequestBody = do Just rbc -> return rbc Nothing -> do rr <- waiRequest +#if MIN_VERSION_wai(0, 2, 0) + rbc <- liftIO $ rbHelper upload rr +#else rbc <- liftResourceT $ rbHelper upload rr +#endif put x { ghsRBC = Just rbc } return rbc +#if MIN_VERSION_wai(2, 0, 0) +rbHelper :: FileUpload -> W.Request -> IO RequestBodyContents +#else rbHelper :: FileUpload -> W.Request -> ResourceT IO RequestBodyContents +#endif rbHelper upload = case upload of FileUploadMemory s -> rbHelper' s mkFileInfoLBS @@ -243,7 +252,11 @@ rbHelper upload = rbHelper' :: NWP.BackEnd x -> (Text -> Text -> x -> FileInfo) -> W.Request +#if MIN_VERSION_wai(2, 0, 0) + -> IO ([(Text, Text)], [(Text, FileInfo)]) +#else -> ResourceT IO ([(Text, Text)], [(Text, FileInfo)]) +#endif rbHelper' backend mkFI req = (map fix1 *** mapMaybe fix2) <$> (NWP.parseRequestBody backend req) where @@ -916,7 +929,7 @@ selectRep w = do ]) reps -- match on the type for sub-type wildcards. - -- If the accept is text/* it should match a provided text/html + -- If the accept is text/ * it should match a provided text/html mainTypeMap = Map.fromList $ reverse $ map (\v@(ProvidedRep ct _) -> (fst $ contentTypeTypes ct, v)) reps @@ -972,7 +985,13 @@ provideRepType ct handler = rawRequestBody :: MonadHandler m => Source m S.ByteString rawRequestBody = do req <- lift waiRequest - transPipe liftResourceT $ W.requestBody req + transPipe +#if MIN_VERSION_wai(0, 2, 0) + liftIO +#else + liftResourceT +#endif + (W.requestBody req) -- | Stream the data from the file. Since Yesod 1.2, this has been generalized -- to work in any @MonadResource@. diff --git a/yesod-core/Yesod/Core/Internal/Response.hs b/yesod-core/Yesod/Core/Internal/Response.hs index b71ea5c2..411713ac 100644 --- a/yesod-core/Yesod/Core/Internal/Response.hs +++ b/yesod-core/Yesod/Core/Internal/Response.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE RankNTypes #-} @@ -12,6 +13,11 @@ import qualified Data.ByteString.Char8 as S8 import Data.CaseInsensitive (CI) import qualified Data.CaseInsensitive as CI import Network.Wai +#if MIN_VERSION_wai(2, 0, 0) +import Data.Conduit (transPipe) +import Control.Monad.Trans.Resource (runInternalState) +import Network.Wai.Internal +#endif import Prelude hiding (catch) import Web.Cookie (renderSetCookie) import Yesod.Core.Content @@ -30,9 +36,10 @@ yarToResponse :: Monad m => YesodResponse -> (SessionMap -> m [Header]) -- ^ save session -> YesodRequest + -> Request -> m Response -yarToResponse (YRWai a) _ _ = return a -yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq = do +yarToResponse (YRWai a) _ _ _ = return a +yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq req = do extraHeaders <- do let nsToken = maybe newSess @@ -47,7 +54,11 @@ yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq = do let hs' = maybe finalHeaders finalHeaders' mlen in ResponseBuilder s hs' b go (ContentFile fp p) = ResponseFile s finalHeaders fp p +#if MIN_VERSION_wai(0, 2, 0) + go (ContentSource body) = ResponseSource s finalHeaders $ transPipe (flip runInternalState $ resourceInternalState req) body +#else go (ContentSource body) = ResponseSource s finalHeaders body +#endif go (ContentDontEvaluate c') = go c' return $ go c where diff --git a/yesod-core/Yesod/Core/Internal/Run.hs b/yesod-core/Yesod/Core/Internal/Run.hs index 35f1d3fd..f60dd701 100644 --- a/yesod-core/Yesod/Core/Internal/Run.hs +++ b/yesod-core/Yesod/Core/Internal/Run.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE RankNTypes #-} @@ -15,7 +16,7 @@ import Control.Monad.IO.Class (MonadIO) import Control.Monad.IO.Class (liftIO) import Control.Monad.Logger (LogLevel (LevelError), LogSource, liftLoc) -import Control.Monad.Trans.Resource (runResourceT, withInternalState, runInternalState) +import Control.Monad.Trans.Resource (runResourceT, withInternalState, runInternalState, getInternalState) import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as S8 import qualified Data.IORef as I @@ -31,6 +32,9 @@ import Data.Text.Encoding.Error (lenientDecode) import Language.Haskell.TH.Syntax (Loc, qLocation) import qualified Network.HTTP.Types as H import Network.Wai +#if MIN_VERSION_wai(0, 2, 0) +import Network.Wai.Internal +#endif import Prelude hiding (catch) import System.Log.FastLogger (Logger) import System.Log.FastLogger (LogStr, toLogStr) @@ -161,9 +165,16 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do ret <- I.newIORef (Left $ InternalError "runFakeHandler: no result") let handler' = do liftIO . I.writeIORef ret . Right =<< handler return () +#if MIN_VERSION_wai(0, 2, 0) + let yapp internalState = runHandler +#else let yapp = runHandler +#endif RunHandlerEnv - { rheRender = yesodRender site $ resolveApproot site fakeWaiRequest + { rheRender = yesodRender site $ resolveApproot site $ fakeWaiRequest +#if MIN_VERSION_wai(0, 2, 0) + internalState +#endif , rheRoute = Nothing , rheSite = site , rheUpload = fileUpload site @@ -179,14 +190,22 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do typePlain (toContent ("runFakeHandler: errHandler" :: S8.ByteString)) (reqSession req) - fakeWaiRequest = + fakeWaiRequest +#if MIN_VERSION_wai(0, 2, 0) + internalState +#endif + = Request { requestMethod = "POST" , httpVersion = H.http11 , rawPathInfo = "/runFakeHandler/pathInfo" , rawQueryString = "" +#if MIN_VERSION_wai(0, 2, 0) + , resourceInternalState = internalState +#else , serverName = "runFakeHandler-serverName" , serverPort = 80 +#endif , requestHeaders = [] , isSecure = False , remoteHost = error "runFakeHandler-remoteHost" @@ -196,17 +215,30 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do , vault = mempty , requestBodyLength = KnownLength 0 } +#if MIN_VERSION_wai(0, 2, 0) + fakeRequest internalState = +#else fakeRequest = +#endif YesodRequest { reqGetParams = [] , reqCookies = [] , reqWaiRequest = fakeWaiRequest +#if MIN_VERSION_wai(0, 2, 0) + internalState +#endif , reqLangs = [] , reqToken = Just "NaN" -- not a nonce =) , reqAccept = [] , reqSession = fakeSessionMap } +#if MIN_VERSION_wai(0, 2, 0) + _ <- runResourceT $ do + is <- getInternalState + yapp is $ fakeRequest is +#else _ <- runResourceT $ yapp fakeRequest +#endif I.readIORef ret {-# WARNING runFakeHandler "Usually you should *not* use runFakeHandler unless you really understand how it works and why you need it." #-} @@ -243,8 +275,12 @@ yesodRunner handler' YesodRunnerEnv {..} route req rhe = rheSafe { rheOnError = runHandler rheSafe . errorHandler } - yar <- runHandler rhe handler yreq - liftIO $ yarToResponse yar saveSession yreq + yar <- +#if MIN_VERSION_wai(0, 2, 0) + flip runInternalState (resourceInternalState req) $ +#endif + runHandler rhe handler yreq + liftIO $ yarToResponse yar saveSession yreq req where mmaxLen = maximumContentLength yreSite route handler = yesodMiddleware handler' diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index ce3217e3..8d25bb9a 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -26,8 +26,8 @@ library build-depends: base >= 4.3 && < 5 , time >= 1.1.4 , yesod-routes >= 1.2 && < 1.3 - , wai >= 1.4 && < 1.5 - , wai-extra >= 1.3 && < 1.4 + , wai >= 1.4 + , wai-extra >= 1.3 , bytestring >= 0.9.1.4 , text >= 0.7 && < 0.12 , template-haskell diff --git a/yesod-eventsource/yesod-eventsource.cabal b/yesod-eventsource/yesod-eventsource.cabal index f0abaee6..68978054 100644 --- a/yesod-eventsource/yesod-eventsource.cabal +++ b/yesod-eventsource/yesod-eventsource.cabal @@ -30,8 +30,8 @@ library build-depends: base >= 4 && < 5 , yesod-core == 1.2.* , conduit >= 0.5 && < 1.1 - , wai >= 1.3 && < 1.5 - , wai-eventsource >= 1.3 && < 1.4 + , wai >= 1.3 + , wai-eventsource >= 1.3 , blaze-builder , transformers exposed-modules: Yesod.EventSource diff --git a/yesod-static/yesod-static.cabal b/yesod-static/yesod-static.cabal index 62e819e9..be492e91 100644 --- a/yesod-static/yesod-static.cabal +++ b/yesod-static/yesod-static.cabal @@ -30,8 +30,8 @@ library , template-haskell , directory >= 1.0 , transformers >= 0.2.2 - , wai-app-static >= 1.3 && < 1.4 - , wai >= 1.3 && < 1.5 + , wai-app-static >= 1.3 + , wai >= 1.3 , text >= 0.9 , file-embed >= 0.0.4.1 && < 0.5 , http-types >= 0.7 diff --git a/yesod/yesod.cabal b/yesod/yesod.cabal index 33c43d5f..4869d881 100644 --- a/yesod/yesod.cabal +++ b/yesod/yesod.cabal @@ -28,12 +28,12 @@ library , yesod-form >= 1.3 && < 1.4 , monad-control >= 0.3 && < 0.4 , transformers >= 0.2.2 && < 0.4 - , wai >= 1.3 && < 1.5 - , wai-extra >= 1.3 && < 1.4 + , wai >= 1.3 + , wai-extra >= 1.3 , hamlet >= 1.1 && < 1.2 , shakespeare-js >= 1.0.2 && < 1.2 , shakespeare-css >= 1.0 && < 1.1 - , warp >= 1.3 && < 1.4 + , warp >= 1.3 , blaze-html >= 0.5 , blaze-markup >= 0.5.1 , aeson From 366127527acf7907f49a6b1c4bc9e86f0a708143 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 19 Aug 2013 13:20:44 +0300 Subject: [PATCH 02/16] Fix some CPP --- yesod-core/Yesod/Core/Handler.hs | 4 ++-- yesod-core/Yesod/Core/Internal/Response.hs | 2 +- yesod-core/Yesod/Core/Internal/Run.hs | 18 +++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/yesod-core/Yesod/Core/Handler.hs b/yesod-core/Yesod/Core/Handler.hs index c956abc4..205e1a66 100644 --- a/yesod-core/Yesod/Core/Handler.hs +++ b/yesod-core/Yesod/Core/Handler.hs @@ -230,7 +230,7 @@ runRequestBody = do Just rbc -> return rbc Nothing -> do rr <- waiRequest -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) rbc <- liftIO $ rbHelper upload rr #else rbc <- liftResourceT $ rbHelper upload rr @@ -986,7 +986,7 @@ rawRequestBody :: MonadHandler m => Source m S.ByteString rawRequestBody = do req <- lift waiRequest transPipe -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) liftIO #else liftResourceT diff --git a/yesod-core/Yesod/Core/Internal/Response.hs b/yesod-core/Yesod/Core/Internal/Response.hs index 411713ac..c9151ed4 100644 --- a/yesod-core/Yesod/Core/Internal/Response.hs +++ b/yesod-core/Yesod/Core/Internal/Response.hs @@ -54,7 +54,7 @@ yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq req = do let hs' = maybe finalHeaders finalHeaders' mlen in ResponseBuilder s hs' b go (ContentFile fp p) = ResponseFile s finalHeaders fp p -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) go (ContentSource body) = ResponseSource s finalHeaders $ transPipe (flip runInternalState $ resourceInternalState req) body #else go (ContentSource body) = ResponseSource s finalHeaders body diff --git a/yesod-core/Yesod/Core/Internal/Run.hs b/yesod-core/Yesod/Core/Internal/Run.hs index f60dd701..615af0e2 100644 --- a/yesod-core/Yesod/Core/Internal/Run.hs +++ b/yesod-core/Yesod/Core/Internal/Run.hs @@ -32,7 +32,7 @@ import Data.Text.Encoding.Error (lenientDecode) import Language.Haskell.TH.Syntax (Loc, qLocation) import qualified Network.HTTP.Types as H import Network.Wai -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) import Network.Wai.Internal #endif import Prelude hiding (catch) @@ -165,14 +165,14 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do ret <- I.newIORef (Left $ InternalError "runFakeHandler: no result") let handler' = do liftIO . I.writeIORef ret . Right =<< handler return () -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) let yapp internalState = runHandler #else let yapp = runHandler #endif RunHandlerEnv { rheRender = yesodRender site $ resolveApproot site $ fakeWaiRequest -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) internalState #endif , rheRoute = Nothing @@ -191,7 +191,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do (toContent ("runFakeHandler: errHandler" :: S8.ByteString)) (reqSession req) fakeWaiRequest -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) internalState #endif = @@ -200,7 +200,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do , httpVersion = H.http11 , rawPathInfo = "/runFakeHandler/pathInfo" , rawQueryString = "" -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) , resourceInternalState = internalState #else , serverName = "runFakeHandler-serverName" @@ -215,7 +215,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do , vault = mempty , requestBodyLength = KnownLength 0 } -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) fakeRequest internalState = #else fakeRequest = @@ -224,7 +224,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do { reqGetParams = [] , reqCookies = [] , reqWaiRequest = fakeWaiRequest -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) internalState #endif , reqLangs = [] @@ -232,7 +232,7 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do , reqAccept = [] , reqSession = fakeSessionMap } -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) _ <- runResourceT $ do is <- getInternalState yapp is $ fakeRequest is @@ -276,7 +276,7 @@ yesodRunner handler' YesodRunnerEnv {..} route req { rheOnError = runHandler rheSafe . errorHandler } yar <- -#if MIN_VERSION_wai(0, 2, 0) +#if MIN_VERSION_wai(2, 0, 0) flip runInternalState (resourceInternalState req) $ #endif runHandler rhe handler yreq From d34c3f26dcac38be0aec9bf3fadb2e6ee229786d Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Sun, 10 Nov 2013 16:49:26 +0200 Subject: [PATCH 03/16] WAI 2.0 updates --- yesod-bin/Devel.hs | 9 ++++ yesod-bin/yesod-bin.cabal | 1 + yesod-core/Yesod/Core/Dispatch.hs | 2 + yesod-core/Yesod/Core/Handler.hs | 14 +++++- yesod-core/Yesod/Core/Internal/Response.hs | 50 +++++++++++++++++----- yesod-core/Yesod/Core/Internal/Run.hs | 45 +++++-------------- yesod-core/yesod-core.cabal | 1 + 7 files changed, 77 insertions(+), 45 deletions(-) diff --git a/yesod-bin/Devel.hs b/yesod-bin/Devel.hs index 3cf90d8b..3edf5cf3 100644 --- a/yesod-bin/Devel.hs +++ b/yesod-bin/Devel.hs @@ -67,7 +67,12 @@ import qualified Config as GHC import Data.Conduit.Network (HostPreference (HostIPv4), bindPort) import Network (withSocketsDo) +#if MIN_VERSION_http_conduit(2, 0, 0) +import Network.HTTP.Conduit (conduitManagerSettings, newManager) +import Data.Default (def) +#else import Network.HTTP.Conduit (def, newManager) +#endif import Network.HTTP.ReverseProxy (ProxyDest (ProxyDest), waiProxyToSettings, wpsTimeout, wpsOnExc) #if MIN_VERSION_http_reverse_proxy(0, 2, 0) @@ -121,7 +126,11 @@ cabalProgram opts | isCabalDev opts = "cabal-dev" -- 3001, give an appropriate message to the user. reverseProxy :: DevelOpts -> I.IORef Int -> IO () reverseProxy opts iappPort = do +#if MIN_VERSION_http_conduit(2, 0, 0) + manager <- newManager conduitManagerSettings +#else manager <- newManager def +#endif let loop = forever $ do run (develPort opts) $ waiProxyToSettings (const $ do diff --git a/yesod-bin/yesod-bin.cabal b/yesod-bin/yesod-bin.cabal index 27110e13..85ae9d95 100644 --- a/yesod-bin/yesod-bin.cabal +++ b/yesod-bin/yesod-bin.cabal @@ -87,6 +87,7 @@ executable yesod , transformers , warp >= 1.3.7.5 , wai >= 1.4 + , data-default ghc-options: -Wall -threaded main-is: main.hs diff --git a/yesod-core/Yesod/Core/Dispatch.hs b/yesod-core/Yesod/Core/Dispatch.hs index 335a15c8..48b08acf 100644 --- a/yesod-core/Yesod/Core/Dispatch.hs +++ b/yesod-core/Yesod/Core/Dispatch.hs @@ -146,6 +146,7 @@ warp :: YesodDispatch site => Int -> site -> IO () warp port site = toWaiApp site >>= Network.Wai.Handler.Warp.runSettings Network.Wai.Handler.Warp.defaultSettings { Network.Wai.Handler.Warp.settingsPort = port + {- FIXME , Network.Wai.Handler.Warp.settingsServerName = S8.pack $ concat [ "Warp/" , Network.Wai.Handler.Warp.warpVersion @@ -153,6 +154,7 @@ warp port site = toWaiApp site >>= Network.Wai.Handler.Warp.runSettings , showVersion Paths_yesod_core.version , " (core)" ] + -} } -- | A default set of middlewares. diff --git a/yesod-core/Yesod/Core/Handler.hs b/yesod-core/Yesod/Core/Handler.hs index 205e1a66..8bd149f7 100644 --- a/yesod-core/Yesod/Core/Handler.hs +++ b/yesod-core/Yesod/Core/Handler.hs @@ -195,6 +195,9 @@ import Control.Failure (failure) import Blaze.ByteString.Builder (Builder) import Safe (headMay) import Data.CaseInsensitive (CI) +#if MIN_VERSION_wai(2, 0, 0) +import qualified System.PosixCompat.Files as PC +#endif get :: MonadHandler m => m GHState get = liftHandlerT $ HandlerT $ I.readIORef . handlerState @@ -499,8 +502,17 @@ sendFilePart :: MonadHandler m -> Integer -- ^ offset -> Integer -- ^ count -> m a -sendFilePart ct fp off count = +sendFilePart ct fp off count = do +#if MIN_VERSION_wai(2, 0, 0) + fs <- liftIO $ PC.getFileStatus fp + handlerError $ HCSendFile ct fp $ Just W.FilePart + { W.filePartOffset = off + , W.filePartByteCount = count + , W.filePartFileSize = fromIntegral $ PC.fileSize fs + } +#else handlerError $ HCSendFile ct fp $ Just $ W.FilePart off count +#endif -- | Bypass remaining handler code and output the given content with a 200 -- status code. diff --git a/yesod-core/Yesod/Core/Internal/Response.hs b/yesod-core/Yesod/Core/Internal/Response.hs index c9151ed4..fce9e2e7 100644 --- a/yesod-core/Yesod/Core/Internal/Response.hs +++ b/yesod-core/Yesod/Core/Internal/Response.hs @@ -15,8 +15,10 @@ import qualified Data.CaseInsensitive as CI import Network.Wai #if MIN_VERSION_wai(2, 0, 0) import Data.Conduit (transPipe) -import Control.Monad.Trans.Resource (runInternalState) +import Control.Monad.Trans.Resource (runInternalState, getInternalState, runResourceT, InternalState, closeInternalState) +import Control.Monad.Trans.Class (lift) import Network.Wai.Internal +import Control.Exception (finally) #endif import Prelude hiding (catch) import Web.Cookie (renderSetCookie) @@ -32,14 +34,30 @@ import qualified Data.Map as Map import Yesod.Core.Internal.Request (tokenKey) import Data.Text.Encoding (encodeUtf8) -yarToResponse :: Monad m - => YesodResponse - -> (SessionMap -> m [Header]) -- ^ save session +yarToResponse :: YesodResponse + -> (SessionMap -> IO [Header]) -- ^ save session -> YesodRequest -> Request - -> m Response +#if MIN_VERSION_wai(2, 0, 0) + -> InternalState +#endif + -> IO Response +#if MIN_VERSION_wai(2, 0, 0) +yarToResponse (YRWai a) _ _ _ is = + case a of + ResponseSource s hs w -> return $ ResponseSource s hs $ \f -> + w f `finally` closeInternalState is + _ -> do + closeInternalState is + return a +#else yarToResponse (YRWai a) _ _ _ = return a -yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq req = do +#endif +yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq req +#if MIN_VERSION_wai(2, 0, 0) + is +#endif + = do extraHeaders <- do let nsToken = maybe newSess @@ -50,17 +68,29 @@ yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq req = do let finalHeaders = extraHeaders ++ map headerToPair hs finalHeaders' len = ("Content-Length", S8.pack $ show len) : finalHeaders + +#if MIN_VERSION_wai(2, 0, 0) + let go (ContentBuilder b mlen) = do + let hs' = maybe finalHeaders finalHeaders' mlen + closeInternalState is + return $ ResponseBuilder s hs' b + go (ContentFile fp p) = do + closeInternalState is + return $ ResponseFile s finalHeaders fp p + go (ContentSource body) = return $ ResponseSource s finalHeaders $ \f -> + f (transPipe (flip runInternalState is) body) `finally` + closeInternalState is + go (ContentDontEvaluate c') = go c' + go c +#else let go (ContentBuilder b mlen) = let hs' = maybe finalHeaders finalHeaders' mlen in ResponseBuilder s hs' b go (ContentFile fp p) = ResponseFile s finalHeaders fp p -#if MIN_VERSION_wai(2, 0, 0) - go (ContentSource body) = ResponseSource s finalHeaders $ transPipe (flip runInternalState $ resourceInternalState req) body -#else go (ContentSource body) = ResponseSource s finalHeaders body -#endif go (ContentDontEvaluate c') = go c' return $ go c +#endif where s | s' == defaultStatus = H.status200 diff --git a/yesod-core/Yesod/Core/Internal/Run.hs b/yesod-core/Yesod/Core/Internal/Run.hs index 615af0e2..ba65b3b1 100644 --- a/yesod-core/Yesod/Core/Internal/Run.hs +++ b/yesod-core/Yesod/Core/Internal/Run.hs @@ -10,13 +10,13 @@ module Yesod.Core.Internal.Run where import Yesod.Core.Internal.Response import Blaze.ByteString.Builder (toByteString) import Control.Applicative ((<$>)) -import Control.Exception (fromException) +import Control.Exception (fromException, bracketOnError) import Control.Exception.Lifted (catch) import Control.Monad.IO.Class (MonadIO) import Control.Monad.IO.Class (liftIO) import Control.Monad.Logger (LogLevel (LevelError), LogSource, liftLoc) -import Control.Monad.Trans.Resource (runResourceT, withInternalState, runInternalState, getInternalState) +import Control.Monad.Trans.Resource (runResourceT, withInternalState, runInternalState, createInternalState, closeInternalState) import qualified Data.ByteString as S import qualified Data.ByteString.Char8 as S8 import qualified Data.IORef as I @@ -165,16 +165,9 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do ret <- I.newIORef (Left $ InternalError "runFakeHandler: no result") let handler' = do liftIO . I.writeIORef ret . Right =<< handler return () -#if MIN_VERSION_wai(2, 0, 0) - let yapp internalState = runHandler -#else let yapp = runHandler -#endif RunHandlerEnv - { rheRender = yesodRender site $ resolveApproot site $ fakeWaiRequest -#if MIN_VERSION_wai(2, 0, 0) - internalState -#endif + { rheRender = yesodRender site $ resolveApproot site fakeWaiRequest , rheRoute = Nothing , rheSite = site , rheUpload = fileUpload site @@ -190,18 +183,13 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do typePlain (toContent ("runFakeHandler: errHandler" :: S8.ByteString)) (reqSession req) - fakeWaiRequest -#if MIN_VERSION_wai(2, 0, 0) - internalState -#endif - = - Request + fakeWaiRequest = Request { requestMethod = "POST" , httpVersion = H.http11 , rawPathInfo = "/runFakeHandler/pathInfo" , rawQueryString = "" #if MIN_VERSION_wai(2, 0, 0) - , resourceInternalState = internalState + , requestHeaderHost = Nothing #else , serverName = "runFakeHandler-serverName" , serverPort = 80 @@ -215,30 +203,17 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do , vault = mempty , requestBodyLength = KnownLength 0 } -#if MIN_VERSION_wai(2, 0, 0) - fakeRequest internalState = -#else fakeRequest = -#endif YesodRequest { reqGetParams = [] , reqCookies = [] , reqWaiRequest = fakeWaiRequest -#if MIN_VERSION_wai(2, 0, 0) - internalState -#endif , reqLangs = [] , reqToken = Just "NaN" -- not a nonce =) , reqAccept = [] , reqSession = fakeSessionMap } -#if MIN_VERSION_wai(2, 0, 0) - _ <- runResourceT $ do - is <- getInternalState - yapp is $ fakeRequest is -#else _ <- runResourceT $ yapp fakeRequest -#endif I.readIORef ret {-# WARNING runFakeHandler "Usually you should *not* use runFakeHandler unless you really understand how it works and why you need it." #-} @@ -275,12 +250,14 @@ yesodRunner handler' YesodRunnerEnv {..} route req rhe = rheSafe { rheOnError = runHandler rheSafe . errorHandler } - yar <- #if MIN_VERSION_wai(2, 0, 0) - flip runInternalState (resourceInternalState req) $ -#endif - runHandler rhe handler yreq + bracketOnError createInternalState closeInternalState $ \is -> do + yar <- runInternalState (runHandler rhe handler yreq) is + liftIO $ yarToResponse yar saveSession yreq req is +#else + yar <- runHandler rhe handler yreq liftIO $ yarToResponse yar saveSession yreq req +#endif where mmaxLen = maximumContentLength yreSite route handler = yesodMiddleware handler' diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 10ee5dda..3b664099 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -65,6 +65,7 @@ library , data-default , safe , warp >= 1.3.8 + , unix-compat exposed-modules: Yesod.Core Yesod.Core.Content From b81a9721fb1fa51a2ccbee45bba3ed69b7a4d749 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 21 Nov 2013 22:44:16 +0200 Subject: [PATCH 04/16] Disable CSS minification when combining stylesheets #623 --- yesod-static/Yesod/Static.hs | 5 ++++- yesod-static/yesod-static.cabal | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/yesod-static/Yesod/Static.hs b/yesod-static/Yesod/Static.hs index 85e95e87..ef27f1b8 100644 --- a/yesod-static/Yesod/Static.hs +++ b/yesod-static/Yesod/Static.hs @@ -101,7 +101,7 @@ import Filesystem (createTree) import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TLE import Data.Default -import Text.Lucius (luciusRTMinified) +--import Text.Lucius (luciusRTMinified) import Network.Wai.Application.Static ( StaticSettings (..) @@ -478,10 +478,13 @@ data CombineSettings = CombineSettings instance Default CombineSettings where def = CombineSettings { csStaticDir = "static" + {- Disabled due to: https://github.com/yesodweb/yesod/issues/623 , csCssPostProcess = \fps -> either (error . (errorIntro fps)) (return . TLE.encodeUtf8) . flip luciusRTMinified [] . TLE.decodeUtf8 + -} + , csCssPostProcess = const return , csJsPostProcess = const return -- FIXME The following borders on a hack. With combining of files, -- the final location of the CSS is no longer fixed, so relative diff --git a/yesod-static/yesod-static.cabal b/yesod-static/yesod-static.cabal index a599b4e4..840e9085 100644 --- a/yesod-static/yesod-static.cabal +++ b/yesod-static/yesod-static.cabal @@ -1,5 +1,5 @@ name: yesod-static -version: 1.2.1 +version: 1.2.1.1 license: MIT license-file: LICENSE author: Michael Snoyman From 6b2e4ef3a426a2a866ed7eb511ba9ad242e144b3 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 2 Dec 2013 07:59:26 +0200 Subject: [PATCH 05/16] Switch to EMBED_REFRESH --- yesod-bin/Devel.hs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/yesod-bin/Devel.hs b/yesod-bin/Devel.hs index a6b888c7..4d0e8bdb 100644 --- a/yesod-bin/Devel.hs +++ b/yesod-bin/Devel.hs @@ -1,9 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} -#ifdef EMBED_REFRESH {-# LANGUAGE TemplateHaskell #-} -#endif module Devel ( devel , DevelOpts(..) @@ -79,11 +77,7 @@ import Network.Socket (sClose) import Network.Wai (responseLBS) import Network.Wai.Handler.Warp (run) import SrcLoc (Located) -#ifdef EMBED_REFRESH import Data.FileEmbed (embedFile) -#else -import Paths_yesod_bin -#endif lockFile :: DevelOpts -> FilePath lockFile _opts = "yesod-devel/devel-terminate" @@ -128,11 +122,7 @@ cabalProgram opts | isCabalDev opts = "cabal-dev" reverseProxy :: DevelOpts -> I.IORef Int -> IO () reverseProxy opts iappPort = do manager <- newManager def -#ifdef EMBED_REFRESH let refreshHtml = LB.fromStrict $(embedFile "refreshing.html") -#else - refreshHtml <- liftIO $ getDataFileName "refreshing.html" >>= LB.readFile -#endif let onExc _ _ = return $ responseLBS status200 [ ("content-type", "text/html") , ("Refresh", "1") From b18e43c05027621011f9d941b218cc2b5a0988b9 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 2 Dec 2013 19:40:03 +0200 Subject: [PATCH 06/16] Incomplete fast-logger 2.0 changes --- yesod-core/Yesod/Core/Class/Yesod.hs | 8 +++++++- yesod-core/Yesod/Core/Types.hs | 10 ++++++++++ yesod-core/yesod-core.cabal | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/yesod-core/Yesod/Core/Class/Yesod.hs b/yesod-core/Yesod/Core/Class/Yesod.hs index cf02a1ad..ad55e23c 100644 --- a/yesod-core/Yesod/Core/Class/Yesod.hs +++ b/yesod-core/Yesod/Core/Class/Yesod.hs @@ -2,6 +2,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE CPP #-} module Yesod.Core.Class.Yesod where import Control.Monad.Logger (logErrorS) @@ -39,10 +40,15 @@ import Data.Default (def) import Network.Wai.Parse (lbsBackEnd, tempFileBackEnd) import System.IO (stdout) +#if MIN_VERSION_fast_logger(2, 0, 0) +import Network.Wai.Logger (ZonedDate) +import System.Log.FastLogger +#else +import System.Log.FastLogger.Date (ZonedDate) import System.Log.FastLogger (LogStr (..), Logger, loggerDate, loggerPutStr, mkLogger) -import System.Log.FastLogger.Date (ZonedDate) +#endif import Text.Blaze (customAttribute, textTag, toValue, (!)) import Text.Blaze (preEscapedToMarkup) diff --git a/yesod-core/Yesod/Core/Types.hs b/yesod-core/Yesod/Core/Types.hs index 3c44e78c..7bb3c501 100644 --- a/yesod-core/Yesod/Core/Types.hs +++ b/yesod-core/Yesod/Core/Types.hs @@ -5,6 +5,7 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE CPP #-} module Yesod.Core.Types where import qualified Blaze.ByteString.Builder as BBuilder @@ -46,7 +47,12 @@ import Network.Wai (FilePart, RequestBodyLength) import qualified Network.Wai as W import qualified Network.Wai.Parse as NWP +#if MIN_VERSION_fast_logger(2, 0, 0) +import System.Log.FastLogger (LogStr, LoggerSet, toLogStr) +import Network.Wai.Logger (DateCacheGetter) +#else import System.Log.FastLogger (LogStr, Logger, toLogStr) +#endif import Text.Blaze.Html (Html) import Text.Hamlet (HtmlUrl) import Text.Julius (JavascriptUrl) @@ -445,3 +451,7 @@ instance RenderRoute WaiSubsite where renderRoute (WaiSubsiteRoute ps qs) = (ps, qs) instance ParseRoute WaiSubsite where parseRoute (x, y) = Just $ WaiSubsiteRoute x y + +#if MIN_VERSION_fast_logger(2, 0, 0) +data Logger = Logger !LoggerSet !DateCacheGetter +#endif diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 3b664099..72e02dc3 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -55,6 +55,7 @@ library , vector >= 0.9 && < 0.11 , aeson >= 0.5 , fast-logger >= 0.2 + , wai-logger >= 0.2 , monad-logger >= 0.3.1 && < 0.4 , conduit >= 0.5 , resourcet >= 0.4.6 && < 0.5 From c670c54ba41c679911d046a417da8ca2021eef2f Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 3 Dec 2013 11:55:39 +0200 Subject: [PATCH 07/16] fast-logger 2.0 --- yesod-core/Yesod/Core/Class/Yesod.hs | 36 +++++++++++++++++++++++++-- yesod-core/Yesod/Core/Dispatch.hs | 5 ++++ yesod-core/Yesod/Core/Internal/Run.hs | 2 ++ yesod-core/Yesod/Core/Types.hs | 10 ++++++-- 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/yesod-core/Yesod/Core/Class/Yesod.hs b/yesod-core/Yesod/Core/Class/Yesod.hs index ad55e23c..a64d6ebc 100644 --- a/yesod-core/Yesod/Core/Class/Yesod.hs +++ b/yesod-core/Yesod/Core/Class/Yesod.hs @@ -41,8 +41,9 @@ import Network.Wai.Parse (lbsBackEnd, tempFileBackEnd) import System.IO (stdout) #if MIN_VERSION_fast_logger(2, 0, 0) -import Network.Wai.Logger (ZonedDate) +import Network.Wai.Logger (ZonedDate, clockDateCacher) import System.Log.FastLogger +import qualified GHC.IO.FD #else import System.Log.FastLogger.Date (ZonedDate) import System.Log.FastLogger (LogStr (..), Logger, @@ -215,7 +216,14 @@ class RenderRoute site => Yesod site where -- -- Default: Sends to stdout and automatically flushes on each write. makeLogger :: site -> IO Logger +#if MIN_VERSION_fast_logger(2, 0, 0) + makeLogger _ = do + loggerSet <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + return $! Logger loggerSet getter +#else makeLogger _ = mkLogger True stdout +#endif -- | Send a message to the @Logger@ provided by @getLogger@. -- @@ -529,6 +537,30 @@ asyncHelper render scripts jscript jsLoc = Nothing -> Nothing Just j -> Just $ jelper j +#if MIN_VERSION_fast_logger(2, 0, 0) +formatLogMessage :: IO ZonedDate + -> Loc + -> LogSource + -> LogLevel + -> LogStr -- ^ message + -> IO LogStr +formatLogMessage getdate loc src level msg = do + now <- getdate + return $ + toLogStr now `mappend` + " [" `mappend` + (case level of + LevelOther t -> toLogStr t + _ -> toLogStr $ drop 5 $ show level) `mappend` + (if T.null src + then mempty + else "#" `mappend` toLogStr src) `mappend` + "] " `mappend` + msg `mappend` + " @(" `mappend` + toLogStr (fileLocationToString loc) `mappend` + ")\n" +#else formatLogMessage :: IO ZonedDate -> Loc -> LogSource @@ -554,7 +586,7 @@ formatLogMessage getdate loc src level msg = do , LS $ fileLocationToString loc , LB ")\n" ] - +#endif -- | Customize the cookies used by the session backend. You may -- use this function on your definition of 'makeSessionBackend'. diff --git a/yesod-core/Yesod/Core/Dispatch.hs b/yesod-core/Yesod/Core/Dispatch.hs index 48b08acf..df822e2d 100644 --- a/yesod-core/Yesod/Core/Dispatch.hs +++ b/yesod-core/Yesod/Core/Dispatch.hs @@ -3,6 +3,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE CPP #-} module Yesod.Core.Dispatch ( -- * Quasi-quoted routing parseRoutes @@ -163,7 +164,11 @@ warp port site = toWaiApp site >>= Network.Wai.Handler.Warp.runSettings mkDefaultMiddlewares :: Logger -> IO W.Middleware mkDefaultMiddlewares logger = do logWare <- mkRequestLogger def +#if MIN_VERSION_fast_logger(2, 0, 0) + { destination = Network.Wai.Middleware.RequestLogger.Logger $ loggerSet logger +#else { destination = Logger logger +#endif , outputFormat = Apache FromSocket } return $ logWare diff --git a/yesod-core/Yesod/Core/Internal/Run.hs b/yesod-core/Yesod/Core/Internal/Run.hs index ba65b3b1..25f51f12 100644 --- a/yesod-core/Yesod/Core/Internal/Run.hs +++ b/yesod-core/Yesod/Core/Internal/Run.hs @@ -36,7 +36,9 @@ import Network.Wai import Network.Wai.Internal #endif import Prelude hiding (catch) +#if !MIN_VERSION_fast_logger(2, 0, 0) import System.Log.FastLogger (Logger) +#endif import System.Log.FastLogger (LogStr, toLogStr) import System.Random (newStdGen) import Yesod.Core.Content diff --git a/yesod-core/Yesod/Core/Types.hs b/yesod-core/Yesod/Core/Types.hs index 7bb3c501..fa20c621 100644 --- a/yesod-core/Yesod/Core/Types.hs +++ b/yesod-core/Yesod/Core/Types.hs @@ -48,7 +48,7 @@ import Network.Wai (FilePart, import qualified Network.Wai as W import qualified Network.Wai.Parse as NWP #if MIN_VERSION_fast_logger(2, 0, 0) -import System.Log.FastLogger (LogStr, LoggerSet, toLogStr) +import System.Log.FastLogger (LogStr, LoggerSet, toLogStr, pushLogStr) import Network.Wai.Logger (DateCacheGetter) #else import System.Log.FastLogger (LogStr, Logger, toLogStr) @@ -453,5 +453,11 @@ instance ParseRoute WaiSubsite where parseRoute (x, y) = Just $ WaiSubsiteRoute x y #if MIN_VERSION_fast_logger(2, 0, 0) -data Logger = Logger !LoggerSet !DateCacheGetter +data Logger = Logger + { loggerSet :: !LoggerSet + , loggerDate :: !DateCacheGetter + } + +loggerPutStr :: Logger -> LogStr -> IO () +loggerPutStr (Logger ls _) = pushLogStr ls #endif From f85b38e817cd6a9e702937f8dfdb5996b7d70b8c Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 3 Dec 2013 11:57:56 +0200 Subject: [PATCH 08/16] Fix tests: force HTTP/1.1 in a few places --- yesod-core/test/YesodCoreTest/Auth.hs | 2 ++ yesod-core/test/YesodCoreTest/Redirect.hs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/yesod-core/test/YesodCoreTest/Auth.hs b/yesod-core/test/YesodCoreTest/Auth.hs index 7daf209d..393737b9 100644 --- a/yesod-core/test/YesodCoreTest/Auth.hs +++ b/yesod-core/test/YesodCoreTest/Auth.hs @@ -8,6 +8,7 @@ import Network.Wai import qualified Data.ByteString.Char8 as S8 import qualified Data.Text as T import Data.List (isSuffixOf) +import qualified Network.HTTP.Types as H data App = App @@ -51,6 +52,7 @@ test method path f = it (method ++ " " ++ path) $ do , requestHeaders = if not $ isSuffixOf "json" path then [] else [("Accept", S8.pack "application/json")] + , httpVersion = H.http11 } f sres diff --git a/yesod-core/test/YesodCoreTest/Redirect.hs b/yesod-core/test/YesodCoreTest/Redirect.hs index da6f9725..3980cbc8 100644 --- a/yesod-core/test/YesodCoreTest/Redirect.hs +++ b/yesod-core/test/YesodCoreTest/Redirect.hs @@ -45,7 +45,8 @@ specs = describe "Redirect" $ do it "303 redirect for regular, HTTP 1.1" $ app $ do res <- request defaultRequest { - pathInfo = ["rregular"] + pathInfo = ["rregular"], + httpVersion = H.http11 } assertStatus 303 res assertBodyContains "" res From cca38cfe03f216d6e513fa2bee30a0478f26e765 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 3 Dec 2013 12:01:11 +0200 Subject: [PATCH 09/16] Expand prefix on generated identifiers #625 --- yesod-core/Yesod/Core/Handler.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yesod-core/Yesod/Core/Handler.hs b/yesod-core/Yesod/Core/Handler.hs index f3b1799b..2de59844 100644 --- a/yesod-core/Yesod/Core/Handler.hs +++ b/yesod-core/Yesod/Core/Handler.hs @@ -697,7 +697,7 @@ newIdent = do x <- get let i' = ghsIdent x + 1 put x { ghsIdent = i' } - return $ T.pack $ 'h' : show i' + return $ T.pack $ "hident" ++ show i' -- | Redirect to a POST resource. -- From 04893d6b0a0d4bd0ca65e89869c9b428a8a2ba1a Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 4 Dec 2013 05:26:51 +0200 Subject: [PATCH 10/16] Export credsKey --- yesod-auth/Yesod/Auth.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yesod-auth/Yesod/Auth.hs b/yesod-auth/Yesod/Auth.hs index a54f5dfd..f09b2b93 100644 --- a/yesod-auth/Yesod/Auth.hs +++ b/yesod-auth/Yesod/Auth.hs @@ -34,6 +34,8 @@ module Yesod.Auth , AuthException (..) -- * Helper , AuthHandler + -- * Internal + , credsKey ) where import Control.Monad (when) @@ -163,6 +165,9 @@ class (Yesod master, PathPiece (AuthId master), RenderMessage master FormMessage => HandlerT master IO (Maybe (AuthId master)) maybeAuthId = defaultMaybeAuthId +-- | Internal session key used to hold the authentication information. +-- +-- Since 1.2.3 credsKey :: Text credsKey = "_ID" From 4fe36c848e3452beede2c6008671625dd4b43a60 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 4 Dec 2013 06:09:28 +0200 Subject: [PATCH 11/16] Bump resourcet dep --- yesod-core/yesod-core.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 72e02dc3..005cd9da 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -58,7 +58,7 @@ library , wai-logger >= 0.2 , monad-logger >= 0.3.1 && < 0.4 , conduit >= 0.5 - , resourcet >= 0.4.6 && < 0.5 + , resourcet >= 0.4.9 && < 0.5 , lifted-base >= 0.1.2 , attoparsec-conduit , blaze-html >= 0.5 From 19f13fa3c714df7fcda5f7679a1cc05e6c39eaf9 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 4 Dec 2013 07:00:28 +0200 Subject: [PATCH 12/16] Scaffolding update --- yesod-bin/hsfiles/mongo.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/mysql.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/postgres-fay.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/postgres.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/simple.hsfiles | 35 +++++++++++++++++--------- yesod-bin/hsfiles/sqlite.hsfiles | 35 +++++++++++++++++--------- 6 files changed, 138 insertions(+), 72 deletions(-) diff --git a/yesod-bin/hsfiles/mongo.hsfiles b/yesod-bin/hsfiles/mongo.hsfiles index e3055394..ef8463b4 100644 --- a/yesod-bin/hsfiles/mongo.hsfiles +++ b/yesod-bin/hsfiles/mongo.hsfiles @@ -30,10 +30,16 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist -import Network.HTTP.Conduit (newManager, def) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -58,7 +64,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -69,14 +75,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/mongoDB.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf logger return foundation @@ -110,7 +120,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -395,16 +405,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/mysql.hsfiles b/yesod-bin/hsfiles/mysql.hsfiles index 2657e63e..c24c6055 100644 --- a/yesod-bin/hsfiles/mysql.hsfiles +++ b/yesod-bin/hsfiles/mysql.hsfiles @@ -30,12 +30,18 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist import Database.Persist.Sql (runMigration) -import Network.HTTP.Conduit (newManager, def) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) import Control.Monad.Logger (runLoggingT) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -60,7 +66,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -71,14 +77,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/mysql.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf logger -- Perform database migration using our application's logging settings. runLoggingT @@ -117,7 +127,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -399,16 +409,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/postgres-fay.hsfiles b/yesod-bin/hsfiles/postgres-fay.hsfiles index ded715f0..543559b8 100644 --- a/yesod-bin/hsfiles/postgres-fay.hsfiles +++ b/yesod-bin/hsfiles/postgres-fay.hsfiles @@ -31,13 +31,19 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist import Database.Persist.Sql (runMigration) -import Network.HTTP.Conduit (newManager, def) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) import Yesod.Fay (getFaySite) import Control.Monad.Logger (runLoggingT) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -63,7 +69,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -74,14 +80,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf onCommand logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf onCommand logger -- Perform database migration using our application's logging settings. runLoggingT @@ -120,7 +130,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Hamlet (hamletFile) import Yesod.Fay -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -436,16 +446,17 @@ library , shakespeare-js >= 1.2 && < 1.3 , shakespeare-text >= 1.0 && < 1.1 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/postgres.hsfiles b/yesod-bin/hsfiles/postgres.hsfiles index 9aef1ae3..32a9e2f5 100644 --- a/yesod-bin/hsfiles/postgres.hsfiles +++ b/yesod-bin/hsfiles/postgres.hsfiles @@ -30,12 +30,18 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist import Database.Persist.Sql (runMigration) -import Network.HTTP.Conduit (newManager, def) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) import Control.Monad.Logger (runLoggingT) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -60,7 +66,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -71,14 +77,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf logger -- Perform database migration using our application's logging settings. runLoggingT @@ -117,7 +127,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -399,16 +409,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/simple.hsfiles b/yesod-bin/hsfiles/simple.hsfiles index 73fc703c..2617e814 100644 --- a/yesod-bin/hsfiles/simple.hsfiles +++ b/yesod-bin/hsfiles/simple.hsfiles @@ -28,9 +28,15 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger -import Network.HTTP.Conduit (newManager, def) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger +import Network.HTTP.Conduit (newManager, conduitManagerSettings) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -55,7 +61,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -66,10 +72,14 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite - logger <- mkLogger True stdout - let foundation = App conf s manager logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s manager logger return foundation @@ -97,7 +107,7 @@ import Settings.StaticFiles import Settings (widgetFile, Extra (..)) import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -326,16 +336,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) diff --git a/yesod-bin/hsfiles/sqlite.hsfiles b/yesod-bin/hsfiles/sqlite.hsfiles index 9b7ca111..252dc12c 100644 --- a/yesod-bin/hsfiles/sqlite.hsfiles +++ b/yesod-bin/hsfiles/sqlite.hsfiles @@ -30,12 +30,18 @@ import Yesod.Default.Config import Yesod.Default.Main import Yesod.Default.Handlers import Network.Wai.Middleware.RequestLogger + ( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination + ) +import qualified Network.Wai.Middleware.RequestLogger as RequestLogger import qualified Database.Persist import Database.Persist.Sql (runMigration) -import Network.HTTP.Conduit (newManager, def) +import Network.HTTP.Conduit (newManager, conduitManagerSettings) import Control.Monad.Logger (runLoggingT) -import System.IO (stdout) -import System.Log.FastLogger (mkLogger) +import qualified GHC.IO.FD +import System.Log.FastLogger (newLoggerSet, defaultBufSize) +import Network.Wai.Logger (clockDateCacher) +import Data.Default (def) +import Yesod.Core.Types (loggerSet, Logger (Logger)) -- Import all relevant handler modules here. -- Don't forget to add new modules to your cabal file! @@ -60,7 +66,7 @@ makeApplication conf = do if development then Detailed True else Apache FromSocket - , destination = Logger $ appLogger foundation + , destination = RequestLogger.Logger $ loggerSet $ appLogger foundation } -- Create the WAI application and apply middlewares @@ -71,14 +77,18 @@ makeApplication conf = do -- performs some initialization. makeFoundation :: AppConfig DefaultEnv Extra -> IO App makeFoundation conf = do - manager <- newManager def + manager <- newManager conduitManagerSettings s <- staticSite dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf) Database.Persist.loadConfig >>= Database.Persist.applyEnv p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf) - logger <- mkLogger True stdout - let foundation = App conf s p manager dbconf logger + + loggerSet' <- newLoggerSet defaultBufSize GHC.IO.FD.stdout + (getter, _) <- clockDateCacher + + let logger = Yesod.Core.Types.Logger loggerSet' getter + foundation = App conf s p manager dbconf logger -- Perform database migration using our application's logging settings. runLoggingT @@ -117,7 +127,7 @@ import Settings (widgetFile, Extra (..)) import Model import Text.Jasmine (minifym) import Text.Hamlet (hamletFile) -import System.Log.FastLogger (Logger) +import Yesod.Core.Types (Logger) -- | The site argument for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -399,16 +409,17 @@ library , shakespeare-text >= 1.0 && < 1.1 , hjsmin >= 0.1 && < 0.2 , monad-control >= 0.3 && < 0.4 - , wai-extra >= 1.3 && < 1.4 + , wai-extra >= 2.0 && < 2.1 , yaml >= 0.8 && < 0.9 - , http-conduit >= 1.9 && < 1.10 + , http-conduit >= 2.0 && < 2.1 , directory >= 1.1 && < 1.3 - , warp >= 1.3 && < 1.4 + , warp >= 2.0 && < 2.1 , data-default , aeson , conduit >= 1.0 , monad-logger >= 0.3 - , fast-logger >= 0.3 + , fast-logger >= 2.0 + , wai-logger >= 2.0 executable PROJECTNAME if flag(library-only) From 02ab5320e3833b94d397d4b21ad7087479cdd1d6 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 4 Dec 2013 07:01:20 +0200 Subject: [PATCH 13/16] Version bumps --- yesod-auth/yesod-auth.cabal | 2 +- yesod-bin/yesod-bin.cabal | 2 +- yesod-core/yesod-core.cabal | 2 +- yesod-persistent/yesod-persistent.cabal | 2 +- yesod-static/yesod-static.cabal | 2 +- yesod/yesod.cabal | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/yesod-auth/yesod-auth.cabal b/yesod-auth/yesod-auth.cabal index 591ced53..881b76d1 100644 --- a/yesod-auth/yesod-auth.cabal +++ b/yesod-auth/yesod-auth.cabal @@ -1,5 +1,5 @@ name: yesod-auth -version: 1.2.3 +version: 1.2.4 license: MIT license-file: LICENSE author: Michael Snoyman, Patrick Brisbin diff --git a/yesod-bin/yesod-bin.cabal b/yesod-bin/yesod-bin.cabal index 1374f3aa..fd6b1baa 100644 --- a/yesod-bin/yesod-bin.cabal +++ b/yesod-bin/yesod-bin.cabal @@ -1,5 +1,5 @@ name: yesod-bin -version: 1.2.4.1 +version: 1.2.5 license: MIT license-file: LICENSE author: Michael Snoyman diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 005cd9da..fea5c4a3 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 1.2.5 +version: 1.2.6 license: MIT license-file: LICENSE author: Michael Snoyman diff --git a/yesod-persistent/yesod-persistent.cabal b/yesod-persistent/yesod-persistent.cabal index 98c21466..69787503 100644 --- a/yesod-persistent/yesod-persistent.cabal +++ b/yesod-persistent/yesod-persistent.cabal @@ -1,5 +1,5 @@ name: yesod-persistent -version: 1.2.1 +version: 1.2.2 license: MIT license-file: LICENSE author: Michael Snoyman diff --git a/yesod-static/yesod-static.cabal b/yesod-static/yesod-static.cabal index 0dbe06b5..df05ecf5 100644 --- a/yesod-static/yesod-static.cabal +++ b/yesod-static/yesod-static.cabal @@ -1,5 +1,5 @@ name: yesod-static -version: 1.2.1.1 +version: 1.2.2 license: MIT license-file: LICENSE author: Michael Snoyman diff --git a/yesod/yesod.cabal b/yesod/yesod.cabal index 9c6bf504..88aff16b 100644 --- a/yesod/yesod.cabal +++ b/yesod/yesod.cabal @@ -1,5 +1,5 @@ name: yesod -version: 1.2.3 +version: 1.2.4 license: MIT license-file: LICENSE author: Michael Snoyman From 1747e2fdc857973d791866150ea08808fdf48c54 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 4 Dec 2013 14:16:25 +0200 Subject: [PATCH 14/16] Don't use fromStrict --- yesod-bin/Devel.hs | 2 +- yesod-bin/yesod-bin.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/yesod-bin/Devel.hs b/yesod-bin/Devel.hs index f9978946..f957e0f2 100644 --- a/yesod-bin/Devel.hs +++ b/yesod-bin/Devel.hs @@ -131,7 +131,7 @@ reverseProxy opts iappPort = do #else manager <- newManager def #endif - let refreshHtml = LB.fromStrict $(embedFile "refreshing.html") + let refreshHtml = LB.fromChunks $ return $(embedFile "refreshing.html") let onExc _ _ = return $ responseLBS status200 [ ("content-type", "text/html") , ("Refresh", "1") diff --git a/yesod-bin/yesod-bin.cabal b/yesod-bin/yesod-bin.cabal index fd6b1baa..7dbca88f 100644 --- a/yesod-bin/yesod-bin.cabal +++ b/yesod-bin/yesod-bin.cabal @@ -1,5 +1,5 @@ name: yesod-bin -version: 1.2.5 +version: 1.2.5.1 license: MIT license-file: LICENSE author: Michael Snoyman From 853e7ad7b57a3f6de8fff92517e9d889e060040b Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 4 Dec 2013 15:01:07 +0200 Subject: [PATCH 15/16] Remove text upper bounds --- yesod-core/yesod-core.cabal | 4 ++-- yesod-eventsource/yesod-eventsource.cabal | 2 +- yesod-routes/yesod-routes.cabal | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index fea5c4a3..98993d21 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 1.2.6 +version: 1.2.6.1 license: MIT license-file: LICENSE author: Michael Snoyman @@ -29,7 +29,7 @@ library , wai >= 1.4 , wai-extra >= 1.3 , bytestring >= 0.9.1.4 - , text >= 0.7 && < 0.12 + , text >= 0.7 , template-haskell , path-pieces >= 0.1.2 && < 0.2 , hamlet >= 1.1 && < 1.2 diff --git a/yesod-eventsource/yesod-eventsource.cabal b/yesod-eventsource/yesod-eventsource.cabal index 68978054..f658d14d 100644 --- a/yesod-eventsource/yesod-eventsource.cabal +++ b/yesod-eventsource/yesod-eventsource.cabal @@ -1,5 +1,5 @@ name: yesod-eventsource -version: 1.1 +version: 1.1.0.1 license: MIT license-file: LICENSE author: Felipe Lessa diff --git a/yesod-routes/yesod-routes.cabal b/yesod-routes/yesod-routes.cabal index 0b245f26..120d0e64 100644 --- a/yesod-routes/yesod-routes.cabal +++ b/yesod-routes/yesod-routes.cabal @@ -1,5 +1,5 @@ name: yesod-routes -version: 1.2.0.1 +version: 1.2.0.2 license: MIT license-file: LICENSE author: Michael Snoyman @@ -16,7 +16,7 @@ extra-source-files: library build-depends: base >= 4 && < 5 - , text >= 0.5 && < 0.12 + , text >= 0.5 , vector >= 0.8 && < 0.11 , containers >= 0.2 , template-haskell @@ -42,7 +42,7 @@ test-suite runtests build-depends: base >= 4.3 && < 5 , yesod-routes - , text >= 0.5 && < 0.12 + , text >= 0.5 , HUnit >= 1.2 && < 1.3 , hspec >= 1.3 , containers From 72af90d54129f6d14586a7f47f8c8152b447ceb1 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 10 Dec 2013 18:24:47 +0200 Subject: [PATCH 16/16] yesod-platform update --- yesod-platform/yesod-platform.cabal | 151 +++++++++++++++------------- 1 file changed, 79 insertions(+), 72 deletions(-) diff --git a/yesod-platform/yesod-platform.cabal b/yesod-platform/yesod-platform.cabal index 864d4fc5..b80b6e48 100644 --- a/yesod-platform/yesod-platform.cabal +++ b/yesod-platform/yesod-platform.cabal @@ -1,5 +1,5 @@ name: yesod-platform -version: 1.2.4.4 +version: 1.2.5 license: MIT license-file: LICENSE author: Michael Snoyman @@ -15,38 +15,40 @@ homepage: http://www.yesodweb.com/ library build-depends: base >= 4 && < 5 , SHA == 1.6.1 - , aeson == 0.6.2.0 + , aeson == 0.6.2.1 , ansi-terminal == 0.6 , asn1-data == 0.7.1 - , asn1-types == 0.2.0 + , asn1-types == 0.2.2 , attoparsec == 0.10.4.0 , attoparsec-conduit == 1.0.1.2 , authenticate == 1.3.2.6 , base-unicode-symbols == 0.2.2.4 , base64-bytestring == 1.0.0.1 - , blaze-builder == 0.3.1.1 + , blaze-builder == 0.3.3.2 , blaze-builder-conduit == 1.0.0 - , blaze-html == 0.6.1.1 - , blaze-markup == 0.5.1.5 + , blaze-html == 0.6.1.2 + , blaze-markup == 0.5.1.6 , byteable == 0.1.1 , byteorder == 1.0.4 - , case-insensitive == 1.1 - , cereal == 0.3.5.2 - , certificate == 1.3.8 - , cipher-aes == 0.2.5 - , cipher-rc4 == 0.1.2 + , case-insensitive == 1.1.0.2 + , cereal == 0.4.0.1 + , certificate == 1.3.9 + , cipher-aes == 0.2.6 + , cipher-rc4 == 0.1.4 , clientsession == 0.9.0.3 - , conduit == 1.0.7.4 + , conduit == 1.0.9.3 + , connection == 0.1.3.1 + , control-monad-loop == 0.1 , cookie == 0.4.0.1 , cprng-aes == 0.5.2 , crypto-api == 0.12.2.2 - , crypto-cipher-types == 0.0.4 - , crypto-conduit == 0.5.2 - , crypto-numbers == 0.2.1 - , crypto-pubkey == 0.2.1 - , crypto-pubkey-types == 0.4.0 + , crypto-cipher-types == 0.0.9 + , crypto-conduit == 0.5.2.1 + , crypto-numbers == 0.2.3 + , crypto-pubkey == 0.2.3 + , crypto-pubkey-types == 0.4.1 , crypto-random == 0.0.7 - , cryptohash == 0.10.0 + , cryptohash == 0.11.1 , cryptohash-cryptoapi == 0.1.0 , css-text == 0.1.1 , data-default == 0.5.3 @@ -55,89 +57,94 @@ library , data-default-instances-containers == 0.0.1 , data-default-instances-dlist == 0.0.1 , data-default-instances-old-locale == 0.0.1 - , date-cache == 0.3.0 - , dlist == 0.5 + , dlist == 0.6.0.1 , email-validate == 1.0.0 , entropy == 0.2.2.4 , failure == 0.2.0.1 - , fast-logger == 0.3.3 - , file-embed == 0.0.4.9 + , fast-logger == 2.0.0 + , file-embed == 0.0.6 , filesystem-conduit == 1.0.0.1 - , hamlet == 1.1.7.2 - , hjsmin == 0.1.4.1 - , hspec == 1.7.2 - , hspec-expectations == 0.3.3 - , html-conduit == 1.1.0 + , hamlet == 1.1.7.5 + , hjsmin == 0.1.4.4 + , hspec == 1.8.1.1 + , hspec-expectations == 0.5.0.1 + , html-conduit == 1.1.0.1 , http-attoparsec == 0.1.0 - , http-conduit == 1.9.4.5 + , http-client == 0.2.0.2 + , http-client-conduit == 0.2.0.0 + , http-client-tls == 0.2.0.0 + , http-conduit == 2.0.0.2 , http-date == 0.0.4 - , http-types == 0.8.1 - , language-javascript == 0.5.7 - , lifted-base == 0.2.1.0 + , http-types == 0.8.3 + , language-javascript == 0.5.8 + , lifted-base == 0.2.1.1 , mime-mail == 0.4.2.1 , mime-types == 0.1.0.3 , mmorph == 1.0.0 - , monad-control == 0.3.2.1 - , monad-logger == 0.3.1.1 + , monad-control == 0.3.2.2 + , monad-logger == 0.3.3.1 + , monad-loops == 0.4.2 , network-conduit == 1.0.0 - , path-pieces == 0.1.2 - , pem == 0.1.2 + , path-pieces == 0.1.3 + , pem == 0.2.1 , persistent == 1.2.3.0 - , persistent-template == 1.2.0.2 + , persistent-template == 1.2.0.5 , pool-conduit == 0.1.2 - , primitive == 0.5.0.1 + , primitive == 0.5.1.0 + , process-conduit == 1.0.0.1 , publicsuffixlist == 0.1 , pureMD5 == 2.1.2.1 - , pwstore-fast == 2.3 + , pwstore-fast == 2.4.1 , quickcheck-io == 0.1.0 , resource-pool == 0.2.1.1 - , resourcet == 0.4.8 + , resourcet == 0.4.9 , safe == 0.3.3 , securemem == 0.1.3 - , semigroups == 0.9.2 - , setenv == 0.1.0 - , shakespeare == 1.2.0 - , shakespeare-css == 1.0.6.3 - , shakespeare-i18n == 1.0.0.4 - , shakespeare-js == 1.2.0 - , shakespeare-text == 1.0.0.7 + , semigroups == 0.12.1 + , setenv == 0.1.1 + , shakespeare == 1.2.0.3 + , shakespeare-css == 1.0.6.6 + , shakespeare-i18n == 1.0.0.5 + , shakespeare-js == 1.2.0.2 + , shakespeare-text == 1.0.0.10 , silently == 1.2.4.1 - , simple-sendfile == 0.2.12 - , skein == 1.0.6 - , socks == 0.5.3 - , stringsearch == 0.3.6.4 + , simple-sendfile == 0.2.13 + , skein == 1.0.8 + , socks == 0.5.4 + , stm-chans == 3.0.0 + , stringsearch == 0.3.6.5 , system-fileio == 0.3.11 - , system-filepath == 0.4.7 + , system-filepath == 0.4.8 , tagged == 0.7 , tagsoup == 0.13 - , tagstream-conduit == 0.5.4 + , tagstream-conduit == 0.5.4.1 , tls == 1.1.5 - , tls-extra == 0.6.5 + , tls-extra == 0.6.6 , transformers-base == 0.4.1 , unix-compat == 0.4.1.1 - , unordered-containers == 0.2.3.2 - , utf8-light == 0.4.0.1 + , unordered-containers == 0.2.3.3 + , utf8-light == 0.4.2 , utf8-string == 0.3.7 - , vector == 0.10.0.1 + , vector == 0.10.9.1 , void == 0.6.1 - , wai == 1.4.0.2 - , wai-app-static == 1.3.1.4 - , wai-extra == 1.3.4.4 - , wai-logger == 0.3.1 - , wai-test == 1.3.1.1 - , warp == 1.3.9.2 - , word8 == 0.0.3 - , xml-conduit == 1.1.0.7 + , wai == 2.0.0 + , wai-app-static == 2.0.0.1 + , wai-extra == 2.0.0.1 + , wai-logger == 2.0.1 + , wai-test == 2.0.0.1 + , warp == 2.0.0.1 + , word8 == 0.0.4 + , xml-conduit == 1.1.0.9 , xml-types == 0.3.4 , xss-sanitize == 0.3.4 - , yaml == 0.8.4.1 - , yesod == 1.2.2.1 - , yesod-auth == 1.2.2.1 - , yesod-core == 1.2.4.2 - , yesod-form == 1.3.2.1 - , yesod-persistent == 1.2.1 - , yesod-routes == 1.2.0.1 - , yesod-static == 1.2.0.1 + , yaml == 0.8.5.2 + , yesod == 1.2.4 + , yesod-auth == 1.2.4 + , yesod-core == 1.2.6.1 + , yesod-form == 1.3.4 + , yesod-persistent == 1.2.2 + , yesod-routes == 1.2.0.2 + , yesod-static == 1.2.2 , yesod-test == 1.2.1 , zlib-bindings == 0.1.1.3 , zlib-conduit == 1.0.0