Merge branch 'master' of github.com:yesodweb/yesod
This commit is contained in:
commit
fbfd1b65e4
@ -34,6 +34,8 @@ module Yesod.Auth
|
|||||||
, AuthException (..)
|
, AuthException (..)
|
||||||
-- * Helper
|
-- * Helper
|
||||||
, AuthHandler
|
, AuthHandler
|
||||||
|
-- * Internal
|
||||||
|
, credsKey
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad (when)
|
import Control.Monad (when)
|
||||||
@ -163,6 +165,9 @@ class (Yesod master, PathPiece (AuthId master), RenderMessage master FormMessage
|
|||||||
=> HandlerT master IO (Maybe (AuthId master))
|
=> HandlerT master IO (Maybe (AuthId master))
|
||||||
maybeAuthId = defaultMaybeAuthId
|
maybeAuthId = defaultMaybeAuthId
|
||||||
|
|
||||||
|
-- | Internal session key used to hold the authentication information.
|
||||||
|
--
|
||||||
|
-- Since 1.2.3
|
||||||
credsKey :: Text
|
credsKey :: Text
|
||||||
credsKey = "_ID"
|
credsKey = "_ID"
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-auth
|
name: yesod-auth
|
||||||
version: 1.2.3
|
version: 1.2.4
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman, Patrick Brisbin
|
author: Michael Snoyman, Patrick Brisbin
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
{-# LANGUAGE CPP #-}
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
#ifdef EMBED_REFRESH
|
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
#endif
|
|
||||||
module Devel
|
module Devel
|
||||||
( devel
|
( devel
|
||||||
, DevelOpts(..)
|
, DevelOpts(..)
|
||||||
@ -69,7 +67,12 @@ import qualified Config as GHC
|
|||||||
import Data.Conduit.Network (HostPreference (HostIPv4),
|
import Data.Conduit.Network (HostPreference (HostIPv4),
|
||||||
bindPort)
|
bindPort)
|
||||||
import Network (withSocketsDo)
|
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)
|
import Network.HTTP.Conduit (def, newManager)
|
||||||
|
#endif
|
||||||
import Network.HTTP.ReverseProxy (ProxyDest (ProxyDest),
|
import Network.HTTP.ReverseProxy (ProxyDest (ProxyDest),
|
||||||
waiProxyToSettings, wpsTimeout, wpsOnExc)
|
waiProxyToSettings, wpsTimeout, wpsOnExc)
|
||||||
#if MIN_VERSION_http_reverse_proxy(0, 2, 0)
|
#if MIN_VERSION_http_reverse_proxy(0, 2, 0)
|
||||||
@ -80,11 +83,7 @@ import Network.Socket (sClose)
|
|||||||
import Network.Wai (responseLBS)
|
import Network.Wai (responseLBS)
|
||||||
import Network.Wai.Handler.Warp (run)
|
import Network.Wai.Handler.Warp (run)
|
||||||
import SrcLoc (Located)
|
import SrcLoc (Located)
|
||||||
#ifdef EMBED_REFRESH
|
|
||||||
import Data.FileEmbed (embedFile)
|
import Data.FileEmbed (embedFile)
|
||||||
#else
|
|
||||||
import Paths_yesod_bin
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lockFile :: DevelOpts -> FilePath
|
lockFile :: DevelOpts -> FilePath
|
||||||
lockFile _opts = "yesod-devel/devel-terminate"
|
lockFile _opts = "yesod-devel/devel-terminate"
|
||||||
@ -131,12 +130,12 @@ cabalProgram opts | isCabalDev opts = "cabal-dev"
|
|||||||
-- 3001, give an appropriate message to the user.
|
-- 3001, give an appropriate message to the user.
|
||||||
reverseProxy :: DevelOpts -> I.IORef Int -> IO ()
|
reverseProxy :: DevelOpts -> I.IORef Int -> IO ()
|
||||||
reverseProxy opts iappPort = do
|
reverseProxy opts iappPort = do
|
||||||
manager <- newManager def
|
#if MIN_VERSION_http_conduit(2, 0, 0)
|
||||||
#ifdef EMBED_REFRESH
|
manager <- newManager conduitManagerSettings
|
||||||
let refreshHtml = LB.fromStrict $(embedFile "refreshing.html")
|
|
||||||
#else
|
#else
|
||||||
refreshHtml <- liftIO $ getDataFileName "refreshing.html" >>= LB.readFile
|
manager <- newManager def
|
||||||
#endif
|
#endif
|
||||||
|
let refreshHtml = LB.fromChunks $ return $(embedFile "refreshing.html")
|
||||||
let onExc _ _ = return $ responseLBS status200
|
let onExc _ _ = return $ responseLBS status200
|
||||||
[ ("content-type", "text/html")
|
[ ("content-type", "text/html")
|
||||||
, ("Refresh", "1")
|
, ("Refresh", "1")
|
||||||
|
|||||||
@ -30,10 +30,16 @@ import Yesod.Default.Config
|
|||||||
import Yesod.Default.Main
|
import Yesod.Default.Main
|
||||||
import Yesod.Default.Handlers
|
import Yesod.Default.Handlers
|
||||||
import Network.Wai.Middleware.RequestLogger
|
import Network.Wai.Middleware.RequestLogger
|
||||||
|
( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination
|
||||||
|
)
|
||||||
|
import qualified Network.Wai.Middleware.RequestLogger as RequestLogger
|
||||||
import qualified Database.Persist
|
import qualified Database.Persist
|
||||||
import Network.HTTP.Conduit (newManager, def)
|
import Network.HTTP.Conduit (newManager, conduitManagerSettings)
|
||||||
import System.IO (stdout)
|
import qualified GHC.IO.FD
|
||||||
import System.Log.FastLogger (mkLogger)
|
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.
|
-- Import all relevant handler modules here.
|
||||||
-- Don't forget to add new modules to your cabal file!
|
-- Don't forget to add new modules to your cabal file!
|
||||||
@ -58,7 +64,7 @@ makeApplication conf = do
|
|||||||
if development
|
if development
|
||||||
then Detailed True
|
then Detailed True
|
||||||
else Apache FromSocket
|
else Apache FromSocket
|
||||||
, destination = Logger $ appLogger foundation
|
, destination = RequestLogger.Logger $ loggerSet $ appLogger foundation
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Create the WAI application and apply middlewares
|
-- Create the WAI application and apply middlewares
|
||||||
@ -69,14 +75,18 @@ makeApplication conf = do
|
|||||||
-- performs some initialization.
|
-- performs some initialization.
|
||||||
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
||||||
makeFoundation conf = do
|
makeFoundation conf = do
|
||||||
manager <- newManager def
|
manager <- newManager conduitManagerSettings
|
||||||
s <- staticSite
|
s <- staticSite
|
||||||
dbconf <- withYamlEnvironment "config/mongoDB.yml" (appEnv conf)
|
dbconf <- withYamlEnvironment "config/mongoDB.yml" (appEnv conf)
|
||||||
Database.Persist.loadConfig >>=
|
Database.Persist.loadConfig >>=
|
||||||
Database.Persist.applyEnv
|
Database.Persist.applyEnv
|
||||||
p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf)
|
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
|
return foundation
|
||||||
|
|
||||||
@ -110,7 +120,7 @@ import Settings (widgetFile, Extra (..))
|
|||||||
import Model
|
import Model
|
||||||
import Text.Jasmine (minifym)
|
import Text.Jasmine (minifym)
|
||||||
import Text.Hamlet (hamletFile)
|
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
|
-- | The site argument for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
@ -395,16 +405,17 @@ library
|
|||||||
, shakespeare-text >= 1.0 && < 1.1
|
, shakespeare-text >= 1.0 && < 1.1
|
||||||
, hjsmin >= 0.1 && < 0.2
|
, hjsmin >= 0.1 && < 0.2
|
||||||
, monad-control >= 0.3 && < 0.4
|
, monad-control >= 0.3 && < 0.4
|
||||||
, wai-extra >= 1.3 && < 1.4
|
, wai-extra >= 2.0 && < 2.1
|
||||||
, yaml >= 0.8 && < 0.9
|
, yaml >= 0.8 && < 0.9
|
||||||
, http-conduit >= 1.9 && < 1.10
|
, http-conduit >= 2.0 && < 2.1
|
||||||
, directory >= 1.1 && < 1.3
|
, directory >= 1.1 && < 1.3
|
||||||
, warp >= 1.3 && < 1.4
|
, warp >= 2.0 && < 2.1
|
||||||
, data-default
|
, data-default
|
||||||
, aeson
|
, aeson
|
||||||
, conduit >= 1.0
|
, conduit >= 1.0
|
||||||
, monad-logger >= 0.3
|
, monad-logger >= 0.3
|
||||||
, fast-logger >= 0.3
|
, fast-logger >= 2.0
|
||||||
|
, wai-logger >= 2.0
|
||||||
|
|
||||||
executable PROJECTNAME
|
executable PROJECTNAME
|
||||||
if flag(library-only)
|
if flag(library-only)
|
||||||
|
|||||||
@ -30,12 +30,18 @@ import Yesod.Default.Config
|
|||||||
import Yesod.Default.Main
|
import Yesod.Default.Main
|
||||||
import Yesod.Default.Handlers
|
import Yesod.Default.Handlers
|
||||||
import Network.Wai.Middleware.RequestLogger
|
import Network.Wai.Middleware.RequestLogger
|
||||||
|
( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination
|
||||||
|
)
|
||||||
|
import qualified Network.Wai.Middleware.RequestLogger as RequestLogger
|
||||||
import qualified Database.Persist
|
import qualified Database.Persist
|
||||||
import Database.Persist.Sql (runMigration)
|
import Database.Persist.Sql (runMigration)
|
||||||
import Network.HTTP.Conduit (newManager, def)
|
import Network.HTTP.Conduit (newManager, conduitManagerSettings)
|
||||||
import Control.Monad.Logger (runLoggingT)
|
import Control.Monad.Logger (runLoggingT)
|
||||||
import System.IO (stdout)
|
import qualified GHC.IO.FD
|
||||||
import System.Log.FastLogger (mkLogger)
|
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.
|
-- Import all relevant handler modules here.
|
||||||
-- Don't forget to add new modules to your cabal file!
|
-- Don't forget to add new modules to your cabal file!
|
||||||
@ -60,7 +66,7 @@ makeApplication conf = do
|
|||||||
if development
|
if development
|
||||||
then Detailed True
|
then Detailed True
|
||||||
else Apache FromSocket
|
else Apache FromSocket
|
||||||
, destination = Logger $ appLogger foundation
|
, destination = RequestLogger.Logger $ loggerSet $ appLogger foundation
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Create the WAI application and apply middlewares
|
-- Create the WAI application and apply middlewares
|
||||||
@ -71,14 +77,18 @@ makeApplication conf = do
|
|||||||
-- performs some initialization.
|
-- performs some initialization.
|
||||||
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
||||||
makeFoundation conf = do
|
makeFoundation conf = do
|
||||||
manager <- newManager def
|
manager <- newManager conduitManagerSettings
|
||||||
s <- staticSite
|
s <- staticSite
|
||||||
dbconf <- withYamlEnvironment "config/mysql.yml" (appEnv conf)
|
dbconf <- withYamlEnvironment "config/mysql.yml" (appEnv conf)
|
||||||
Database.Persist.loadConfig >>=
|
Database.Persist.loadConfig >>=
|
||||||
Database.Persist.applyEnv
|
Database.Persist.applyEnv
|
||||||
p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf)
|
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.
|
-- Perform database migration using our application's logging settings.
|
||||||
runLoggingT
|
runLoggingT
|
||||||
@ -117,7 +127,7 @@ import Settings (widgetFile, Extra (..))
|
|||||||
import Model
|
import Model
|
||||||
import Text.Jasmine (minifym)
|
import Text.Jasmine (minifym)
|
||||||
import Text.Hamlet (hamletFile)
|
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
|
-- | The site argument for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
@ -399,16 +409,17 @@ library
|
|||||||
, shakespeare-text >= 1.0 && < 1.1
|
, shakespeare-text >= 1.0 && < 1.1
|
||||||
, hjsmin >= 0.1 && < 0.2
|
, hjsmin >= 0.1 && < 0.2
|
||||||
, monad-control >= 0.3 && < 0.4
|
, monad-control >= 0.3 && < 0.4
|
||||||
, wai-extra >= 1.3 && < 1.4
|
, wai-extra >= 2.0 && < 2.1
|
||||||
, yaml >= 0.8 && < 0.9
|
, yaml >= 0.8 && < 0.9
|
||||||
, http-conduit >= 1.9 && < 1.10
|
, http-conduit >= 2.0 && < 2.1
|
||||||
, directory >= 1.1 && < 1.3
|
, directory >= 1.1 && < 1.3
|
||||||
, warp >= 1.3 && < 1.4
|
, warp >= 2.0 && < 2.1
|
||||||
, data-default
|
, data-default
|
||||||
, aeson
|
, aeson
|
||||||
, conduit >= 1.0
|
, conduit >= 1.0
|
||||||
, monad-logger >= 0.3
|
, monad-logger >= 0.3
|
||||||
, fast-logger >= 0.3
|
, fast-logger >= 2.0
|
||||||
|
, wai-logger >= 2.0
|
||||||
|
|
||||||
executable PROJECTNAME
|
executable PROJECTNAME
|
||||||
if flag(library-only)
|
if flag(library-only)
|
||||||
|
|||||||
@ -31,13 +31,19 @@ import Yesod.Default.Config
|
|||||||
import Yesod.Default.Main
|
import Yesod.Default.Main
|
||||||
import Yesod.Default.Handlers
|
import Yesod.Default.Handlers
|
||||||
import Network.Wai.Middleware.RequestLogger
|
import Network.Wai.Middleware.RequestLogger
|
||||||
|
( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination
|
||||||
|
)
|
||||||
|
import qualified Network.Wai.Middleware.RequestLogger as RequestLogger
|
||||||
import qualified Database.Persist
|
import qualified Database.Persist
|
||||||
import Database.Persist.Sql (runMigration)
|
import Database.Persist.Sql (runMigration)
|
||||||
import Network.HTTP.Conduit (newManager, def)
|
import Network.HTTP.Conduit (newManager, conduitManagerSettings)
|
||||||
import Yesod.Fay (getFaySite)
|
import Yesod.Fay (getFaySite)
|
||||||
import Control.Monad.Logger (runLoggingT)
|
import Control.Monad.Logger (runLoggingT)
|
||||||
import System.IO (stdout)
|
import qualified GHC.IO.FD
|
||||||
import System.Log.FastLogger (mkLogger)
|
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.
|
-- Import all relevant handler modules here.
|
||||||
-- Don't forget to add new modules to your cabal file!
|
-- Don't forget to add new modules to your cabal file!
|
||||||
@ -63,7 +69,7 @@ makeApplication conf = do
|
|||||||
if development
|
if development
|
||||||
then Detailed True
|
then Detailed True
|
||||||
else Apache FromSocket
|
else Apache FromSocket
|
||||||
, destination = Logger $ appLogger foundation
|
, destination = RequestLogger.Logger $ loggerSet $ appLogger foundation
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Create the WAI application and apply middlewares
|
-- Create the WAI application and apply middlewares
|
||||||
@ -74,14 +80,18 @@ makeApplication conf = do
|
|||||||
-- performs some initialization.
|
-- performs some initialization.
|
||||||
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
||||||
makeFoundation conf = do
|
makeFoundation conf = do
|
||||||
manager <- newManager def
|
manager <- newManager conduitManagerSettings
|
||||||
s <- staticSite
|
s <- staticSite
|
||||||
dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf)
|
dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf)
|
||||||
Database.Persist.loadConfig >>=
|
Database.Persist.loadConfig >>=
|
||||||
Database.Persist.applyEnv
|
Database.Persist.applyEnv
|
||||||
p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf)
|
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.
|
-- Perform database migration using our application's logging settings.
|
||||||
runLoggingT
|
runLoggingT
|
||||||
@ -120,7 +130,7 @@ import Settings (widgetFile, Extra (..))
|
|||||||
import Model
|
import Model
|
||||||
import Text.Hamlet (hamletFile)
|
import Text.Hamlet (hamletFile)
|
||||||
import Yesod.Fay
|
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
|
-- | The site argument for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
@ -436,16 +446,17 @@ library
|
|||||||
, shakespeare-js >= 1.2 && < 1.3
|
, shakespeare-js >= 1.2 && < 1.3
|
||||||
, shakespeare-text >= 1.0 && < 1.1
|
, shakespeare-text >= 1.0 && < 1.1
|
||||||
, monad-control >= 0.3 && < 0.4
|
, monad-control >= 0.3 && < 0.4
|
||||||
, wai-extra >= 1.3 && < 1.4
|
, wai-extra >= 2.0 && < 2.1
|
||||||
, yaml >= 0.8 && < 0.9
|
, yaml >= 0.8 && < 0.9
|
||||||
, http-conduit >= 1.9 && < 1.10
|
, http-conduit >= 2.0 && < 2.1
|
||||||
, directory >= 1.1 && < 1.3
|
, directory >= 1.1 && < 1.3
|
||||||
, warp >= 1.3 && < 1.4
|
, warp >= 2.0 && < 2.1
|
||||||
, data-default
|
, data-default
|
||||||
, aeson
|
, aeson
|
||||||
, conduit >= 1.0
|
, conduit >= 1.0
|
||||||
, monad-logger >= 0.3
|
, monad-logger >= 0.3
|
||||||
, fast-logger >= 0.3
|
, fast-logger >= 2.0
|
||||||
|
, wai-logger >= 2.0
|
||||||
|
|
||||||
executable PROJECTNAME
|
executable PROJECTNAME
|
||||||
if flag(library-only)
|
if flag(library-only)
|
||||||
|
|||||||
@ -30,12 +30,18 @@ import Yesod.Default.Config
|
|||||||
import Yesod.Default.Main
|
import Yesod.Default.Main
|
||||||
import Yesod.Default.Handlers
|
import Yesod.Default.Handlers
|
||||||
import Network.Wai.Middleware.RequestLogger
|
import Network.Wai.Middleware.RequestLogger
|
||||||
|
( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination
|
||||||
|
)
|
||||||
|
import qualified Network.Wai.Middleware.RequestLogger as RequestLogger
|
||||||
import qualified Database.Persist
|
import qualified Database.Persist
|
||||||
import Database.Persist.Sql (runMigration)
|
import Database.Persist.Sql (runMigration)
|
||||||
import Network.HTTP.Conduit (newManager, def)
|
import Network.HTTP.Conduit (newManager, conduitManagerSettings)
|
||||||
import Control.Monad.Logger (runLoggingT)
|
import Control.Monad.Logger (runLoggingT)
|
||||||
import System.IO (stdout)
|
import qualified GHC.IO.FD
|
||||||
import System.Log.FastLogger (mkLogger)
|
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.
|
-- Import all relevant handler modules here.
|
||||||
-- Don't forget to add new modules to your cabal file!
|
-- Don't forget to add new modules to your cabal file!
|
||||||
@ -60,7 +66,7 @@ makeApplication conf = do
|
|||||||
if development
|
if development
|
||||||
then Detailed True
|
then Detailed True
|
||||||
else Apache FromSocket
|
else Apache FromSocket
|
||||||
, destination = Logger $ appLogger foundation
|
, destination = RequestLogger.Logger $ loggerSet $ appLogger foundation
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Create the WAI application and apply middlewares
|
-- Create the WAI application and apply middlewares
|
||||||
@ -71,14 +77,18 @@ makeApplication conf = do
|
|||||||
-- performs some initialization.
|
-- performs some initialization.
|
||||||
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
||||||
makeFoundation conf = do
|
makeFoundation conf = do
|
||||||
manager <- newManager def
|
manager <- newManager conduitManagerSettings
|
||||||
s <- staticSite
|
s <- staticSite
|
||||||
dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf)
|
dbconf <- withYamlEnvironment "config/postgresql.yml" (appEnv conf)
|
||||||
Database.Persist.loadConfig >>=
|
Database.Persist.loadConfig >>=
|
||||||
Database.Persist.applyEnv
|
Database.Persist.applyEnv
|
||||||
p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf)
|
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.
|
-- Perform database migration using our application's logging settings.
|
||||||
runLoggingT
|
runLoggingT
|
||||||
@ -117,7 +127,7 @@ import Settings (widgetFile, Extra (..))
|
|||||||
import Model
|
import Model
|
||||||
import Text.Jasmine (minifym)
|
import Text.Jasmine (minifym)
|
||||||
import Text.Hamlet (hamletFile)
|
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
|
-- | The site argument for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
@ -399,16 +409,17 @@ library
|
|||||||
, shakespeare-text >= 1.0 && < 1.1
|
, shakespeare-text >= 1.0 && < 1.1
|
||||||
, hjsmin >= 0.1 && < 0.2
|
, hjsmin >= 0.1 && < 0.2
|
||||||
, monad-control >= 0.3 && < 0.4
|
, monad-control >= 0.3 && < 0.4
|
||||||
, wai-extra >= 1.3 && < 1.4
|
, wai-extra >= 2.0 && < 2.1
|
||||||
, yaml >= 0.8 && < 0.9
|
, yaml >= 0.8 && < 0.9
|
||||||
, http-conduit >= 1.9 && < 1.10
|
, http-conduit >= 2.0 && < 2.1
|
||||||
, directory >= 1.1 && < 1.3
|
, directory >= 1.1 && < 1.3
|
||||||
, warp >= 1.3 && < 1.4
|
, warp >= 2.0 && < 2.1
|
||||||
, data-default
|
, data-default
|
||||||
, aeson
|
, aeson
|
||||||
, conduit >= 1.0
|
, conduit >= 1.0
|
||||||
, monad-logger >= 0.3
|
, monad-logger >= 0.3
|
||||||
, fast-logger >= 0.3
|
, fast-logger >= 2.0
|
||||||
|
, wai-logger >= 2.0
|
||||||
|
|
||||||
executable PROJECTNAME
|
executable PROJECTNAME
|
||||||
if flag(library-only)
|
if flag(library-only)
|
||||||
|
|||||||
@ -28,9 +28,15 @@ import Yesod.Default.Config
|
|||||||
import Yesod.Default.Main
|
import Yesod.Default.Main
|
||||||
import Yesod.Default.Handlers
|
import Yesod.Default.Handlers
|
||||||
import Network.Wai.Middleware.RequestLogger
|
import Network.Wai.Middleware.RequestLogger
|
||||||
import Network.HTTP.Conduit (newManager, def)
|
( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination
|
||||||
import System.IO (stdout)
|
)
|
||||||
import System.Log.FastLogger (mkLogger)
|
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.
|
-- Import all relevant handler modules here.
|
||||||
-- Don't forget to add new modules to your cabal file!
|
-- Don't forget to add new modules to your cabal file!
|
||||||
@ -55,7 +61,7 @@ makeApplication conf = do
|
|||||||
if development
|
if development
|
||||||
then Detailed True
|
then Detailed True
|
||||||
else Apache FromSocket
|
else Apache FromSocket
|
||||||
, destination = Logger $ appLogger foundation
|
, destination = RequestLogger.Logger $ loggerSet $ appLogger foundation
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Create the WAI application and apply middlewares
|
-- Create the WAI application and apply middlewares
|
||||||
@ -66,10 +72,14 @@ makeApplication conf = do
|
|||||||
-- performs some initialization.
|
-- performs some initialization.
|
||||||
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
||||||
makeFoundation conf = do
|
makeFoundation conf = do
|
||||||
manager <- newManager def
|
manager <- newManager conduitManagerSettings
|
||||||
s <- staticSite
|
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
|
return foundation
|
||||||
|
|
||||||
@ -97,7 +107,7 @@ import Settings.StaticFiles
|
|||||||
import Settings (widgetFile, Extra (..))
|
import Settings (widgetFile, Extra (..))
|
||||||
import Text.Jasmine (minifym)
|
import Text.Jasmine (minifym)
|
||||||
import Text.Hamlet (hamletFile)
|
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
|
-- | The site argument for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
@ -326,16 +336,17 @@ library
|
|||||||
, shakespeare-text >= 1.0 && < 1.1
|
, shakespeare-text >= 1.0 && < 1.1
|
||||||
, hjsmin >= 0.1 && < 0.2
|
, hjsmin >= 0.1 && < 0.2
|
||||||
, monad-control >= 0.3 && < 0.4
|
, monad-control >= 0.3 && < 0.4
|
||||||
, wai-extra >= 1.3 && < 1.4
|
, wai-extra >= 2.0 && < 2.1
|
||||||
, yaml >= 0.8 && < 0.9
|
, yaml >= 0.8 && < 0.9
|
||||||
, http-conduit >= 1.9 && < 1.10
|
, http-conduit >= 2.0 && < 2.1
|
||||||
, directory >= 1.1 && < 1.3
|
, directory >= 1.1 && < 1.3
|
||||||
, warp >= 1.3 && < 1.4
|
, warp >= 2.0 && < 2.1
|
||||||
, data-default
|
, data-default
|
||||||
, aeson
|
, aeson
|
||||||
, conduit >= 1.0
|
, conduit >= 1.0
|
||||||
, monad-logger >= 0.3
|
, monad-logger >= 0.3
|
||||||
, fast-logger >= 0.3
|
, fast-logger >= 2.0
|
||||||
|
, wai-logger >= 2.0
|
||||||
|
|
||||||
executable PROJECTNAME
|
executable PROJECTNAME
|
||||||
if flag(library-only)
|
if flag(library-only)
|
||||||
|
|||||||
@ -30,12 +30,18 @@ import Yesod.Default.Config
|
|||||||
import Yesod.Default.Main
|
import Yesod.Default.Main
|
||||||
import Yesod.Default.Handlers
|
import Yesod.Default.Handlers
|
||||||
import Network.Wai.Middleware.RequestLogger
|
import Network.Wai.Middleware.RequestLogger
|
||||||
|
( mkRequestLogger, outputFormat, OutputFormat (..), IPAddrSource (..), destination
|
||||||
|
)
|
||||||
|
import qualified Network.Wai.Middleware.RequestLogger as RequestLogger
|
||||||
import qualified Database.Persist
|
import qualified Database.Persist
|
||||||
import Database.Persist.Sql (runMigration)
|
import Database.Persist.Sql (runMigration)
|
||||||
import Network.HTTP.Conduit (newManager, def)
|
import Network.HTTP.Conduit (newManager, conduitManagerSettings)
|
||||||
import Control.Monad.Logger (runLoggingT)
|
import Control.Monad.Logger (runLoggingT)
|
||||||
import System.IO (stdout)
|
import qualified GHC.IO.FD
|
||||||
import System.Log.FastLogger (mkLogger)
|
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.
|
-- Import all relevant handler modules here.
|
||||||
-- Don't forget to add new modules to your cabal file!
|
-- Don't forget to add new modules to your cabal file!
|
||||||
@ -60,7 +66,7 @@ makeApplication conf = do
|
|||||||
if development
|
if development
|
||||||
then Detailed True
|
then Detailed True
|
||||||
else Apache FromSocket
|
else Apache FromSocket
|
||||||
, destination = Logger $ appLogger foundation
|
, destination = RequestLogger.Logger $ loggerSet $ appLogger foundation
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Create the WAI application and apply middlewares
|
-- Create the WAI application and apply middlewares
|
||||||
@ -71,14 +77,18 @@ makeApplication conf = do
|
|||||||
-- performs some initialization.
|
-- performs some initialization.
|
||||||
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
makeFoundation :: AppConfig DefaultEnv Extra -> IO App
|
||||||
makeFoundation conf = do
|
makeFoundation conf = do
|
||||||
manager <- newManager def
|
manager <- newManager conduitManagerSettings
|
||||||
s <- staticSite
|
s <- staticSite
|
||||||
dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf)
|
dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf)
|
||||||
Database.Persist.loadConfig >>=
|
Database.Persist.loadConfig >>=
|
||||||
Database.Persist.applyEnv
|
Database.Persist.applyEnv
|
||||||
p <- Database.Persist.createPoolConfig (dbconf :: Settings.PersistConf)
|
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.
|
-- Perform database migration using our application's logging settings.
|
||||||
runLoggingT
|
runLoggingT
|
||||||
@ -117,7 +127,7 @@ import Settings (widgetFile, Extra (..))
|
|||||||
import Model
|
import Model
|
||||||
import Text.Jasmine (minifym)
|
import Text.Jasmine (minifym)
|
||||||
import Text.Hamlet (hamletFile)
|
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
|
-- | The site argument for your application. This can be a good place to
|
||||||
-- keep settings and values requiring initialization before your application
|
-- keep settings and values requiring initialization before your application
|
||||||
@ -399,16 +409,17 @@ library
|
|||||||
, shakespeare-text >= 1.0 && < 1.1
|
, shakespeare-text >= 1.0 && < 1.1
|
||||||
, hjsmin >= 0.1 && < 0.2
|
, hjsmin >= 0.1 && < 0.2
|
||||||
, monad-control >= 0.3 && < 0.4
|
, monad-control >= 0.3 && < 0.4
|
||||||
, wai-extra >= 1.3 && < 1.4
|
, wai-extra >= 2.0 && < 2.1
|
||||||
, yaml >= 0.8 && < 0.9
|
, yaml >= 0.8 && < 0.9
|
||||||
, http-conduit >= 1.9 && < 1.10
|
, http-conduit >= 2.0 && < 2.1
|
||||||
, directory >= 1.1 && < 1.3
|
, directory >= 1.1 && < 1.3
|
||||||
, warp >= 1.3 && < 1.4
|
, warp >= 2.0 && < 2.1
|
||||||
, data-default
|
, data-default
|
||||||
, aeson
|
, aeson
|
||||||
, conduit >= 1.0
|
, conduit >= 1.0
|
||||||
, monad-logger >= 0.3
|
, monad-logger >= 0.3
|
||||||
, fast-logger >= 0.3
|
, fast-logger >= 2.0
|
||||||
|
, wai-logger >= 2.0
|
||||||
|
|
||||||
executable PROJECTNAME
|
executable PROJECTNAME
|
||||||
if flag(library-only)
|
if flag(library-only)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-bin
|
name: yesod-bin
|
||||||
version: 1.2.5
|
version: 1.2.5.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
@ -93,6 +93,7 @@ executable yesod
|
|||||||
, transformers
|
, transformers
|
||||||
, warp >= 1.3.7.5
|
, warp >= 1.3.7.5
|
||||||
, wai >= 1.4
|
, wai >= 1.4
|
||||||
|
, data-default
|
||||||
|
|
||||||
ghc-options: -Wall -threaded
|
ghc-options: -Wall -threaded
|
||||||
main-is: main.hs
|
main-is: main.hs
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE QuasiQuotes #-}
|
{-# LANGUAGE QuasiQuotes #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
module Yesod.Core.Class.Yesod where
|
module Yesod.Core.Class.Yesod where
|
||||||
|
|
||||||
import Control.Monad.Logger (logErrorS)
|
import Control.Monad.Logger (logErrorS)
|
||||||
@ -39,10 +40,16 @@ import Data.Default (def)
|
|||||||
import Network.Wai.Parse (lbsBackEnd,
|
import Network.Wai.Parse (lbsBackEnd,
|
||||||
tempFileBackEnd)
|
tempFileBackEnd)
|
||||||
import System.IO (stdout)
|
import System.IO (stdout)
|
||||||
|
#if MIN_VERSION_fast_logger(2, 0, 0)
|
||||||
|
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,
|
import System.Log.FastLogger (LogStr (..), Logger,
|
||||||
loggerDate, loggerPutStr,
|
loggerDate, loggerPutStr,
|
||||||
mkLogger)
|
mkLogger)
|
||||||
import System.Log.FastLogger.Date (ZonedDate)
|
#endif
|
||||||
import Text.Blaze (customAttribute, textTag,
|
import Text.Blaze (customAttribute, textTag,
|
||||||
toValue, (!))
|
toValue, (!))
|
||||||
import Text.Blaze (preEscapedToMarkup)
|
import Text.Blaze (preEscapedToMarkup)
|
||||||
@ -209,7 +216,14 @@ class RenderRoute site => Yesod site where
|
|||||||
--
|
--
|
||||||
-- Default: Sends to stdout and automatically flushes on each write.
|
-- Default: Sends to stdout and automatically flushes on each write.
|
||||||
makeLogger :: site -> IO Logger
|
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
|
makeLogger _ = mkLogger True stdout
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | Send a message to the @Logger@ provided by @getLogger@.
|
-- | Send a message to the @Logger@ provided by @getLogger@.
|
||||||
--
|
--
|
||||||
@ -523,6 +537,30 @@ asyncHelper render scripts jscript jsLoc =
|
|||||||
Nothing -> Nothing
|
Nothing -> Nothing
|
||||||
Just j -> Just $ jelper j
|
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
|
formatLogMessage :: IO ZonedDate
|
||||||
-> Loc
|
-> Loc
|
||||||
-> LogSource
|
-> LogSource
|
||||||
@ -548,7 +586,7 @@ formatLogMessage getdate loc src level msg = do
|
|||||||
, LS $ fileLocationToString loc
|
, LS $ fileLocationToString loc
|
||||||
, LB ")\n"
|
, LB ")\n"
|
||||||
]
|
]
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | Customize the cookies used by the session backend. You may
|
-- | Customize the cookies used by the session backend. You may
|
||||||
-- use this function on your definition of 'makeSessionBackend'.
|
-- use this function on your definition of 'makeSessionBackend'.
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
module Yesod.Core.Dispatch
|
module Yesod.Core.Dispatch
|
||||||
( -- * Quasi-quoted routing
|
( -- * Quasi-quoted routing
|
||||||
parseRoutes
|
parseRoutes
|
||||||
@ -146,6 +147,7 @@ warp :: YesodDispatch site => Int -> site -> IO ()
|
|||||||
warp port site = toWaiApp site >>= Network.Wai.Handler.Warp.runSettings
|
warp port site = toWaiApp site >>= Network.Wai.Handler.Warp.runSettings
|
||||||
Network.Wai.Handler.Warp.defaultSettings
|
Network.Wai.Handler.Warp.defaultSettings
|
||||||
{ Network.Wai.Handler.Warp.settingsPort = port
|
{ Network.Wai.Handler.Warp.settingsPort = port
|
||||||
|
{- FIXME
|
||||||
, Network.Wai.Handler.Warp.settingsServerName = S8.pack $ concat
|
, Network.Wai.Handler.Warp.settingsServerName = S8.pack $ concat
|
||||||
[ "Warp/"
|
[ "Warp/"
|
||||||
, Network.Wai.Handler.Warp.warpVersion
|
, Network.Wai.Handler.Warp.warpVersion
|
||||||
@ -153,6 +155,7 @@ warp port site = toWaiApp site >>= Network.Wai.Handler.Warp.runSettings
|
|||||||
, showVersion Paths_yesod_core.version
|
, showVersion Paths_yesod_core.version
|
||||||
, " (core)"
|
, " (core)"
|
||||||
]
|
]
|
||||||
|
-}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- | A default set of middlewares.
|
-- | A default set of middlewares.
|
||||||
@ -161,7 +164,11 @@ warp port site = toWaiApp site >>= Network.Wai.Handler.Warp.runSettings
|
|||||||
mkDefaultMiddlewares :: Logger -> IO W.Middleware
|
mkDefaultMiddlewares :: Logger -> IO W.Middleware
|
||||||
mkDefaultMiddlewares logger = do
|
mkDefaultMiddlewares logger = do
|
||||||
logWare <- mkRequestLogger def
|
logWare <- mkRequestLogger def
|
||||||
|
#if MIN_VERSION_fast_logger(2, 0, 0)
|
||||||
|
{ destination = Network.Wai.Middleware.RequestLogger.Logger $ loggerSet logger
|
||||||
|
#else
|
||||||
{ destination = Logger logger
|
{ destination = Logger logger
|
||||||
|
#endif
|
||||||
, outputFormat = Apache FromSocket
|
, outputFormat = Apache FromSocket
|
||||||
}
|
}
|
||||||
return $ logWare
|
return $ logWare
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE ConstraintKinds #-}
|
{-# LANGUAGE ConstraintKinds #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
@ -194,6 +195,9 @@ import Control.Failure (failure)
|
|||||||
import Blaze.ByteString.Builder (Builder)
|
import Blaze.ByteString.Builder (Builder)
|
||||||
import Safe (headMay)
|
import Safe (headMay)
|
||||||
import Data.CaseInsensitive (CI)
|
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 :: MonadHandler m => m GHState
|
||||||
get = liftHandlerT $ HandlerT $ I.readIORef . handlerState
|
get = liftHandlerT $ HandlerT $ I.readIORef . handlerState
|
||||||
@ -229,11 +233,19 @@ runRequestBody = do
|
|||||||
Just rbc -> return rbc
|
Just rbc -> return rbc
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
rr <- waiRequest
|
rr <- waiRequest
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
rbc <- liftIO $ rbHelper upload rr
|
||||||
|
#else
|
||||||
rbc <- liftResourceT $ rbHelper upload rr
|
rbc <- liftResourceT $ rbHelper upload rr
|
||||||
|
#endif
|
||||||
put x { ghsRBC = Just rbc }
|
put x { ghsRBC = Just rbc }
|
||||||
return rbc
|
return rbc
|
||||||
|
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
rbHelper :: FileUpload -> W.Request -> IO RequestBodyContents
|
||||||
|
#else
|
||||||
rbHelper :: FileUpload -> W.Request -> ResourceT IO RequestBodyContents
|
rbHelper :: FileUpload -> W.Request -> ResourceT IO RequestBodyContents
|
||||||
|
#endif
|
||||||
rbHelper upload =
|
rbHelper upload =
|
||||||
case upload of
|
case upload of
|
||||||
FileUploadMemory s -> rbHelper' s mkFileInfoLBS
|
FileUploadMemory s -> rbHelper' s mkFileInfoLBS
|
||||||
@ -243,7 +255,11 @@ rbHelper upload =
|
|||||||
rbHelper' :: NWP.BackEnd x
|
rbHelper' :: NWP.BackEnd x
|
||||||
-> (Text -> Text -> x -> FileInfo)
|
-> (Text -> Text -> x -> FileInfo)
|
||||||
-> W.Request
|
-> W.Request
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
-> IO ([(Text, Text)], [(Text, FileInfo)])
|
||||||
|
#else
|
||||||
-> ResourceT IO ([(Text, Text)], [(Text, FileInfo)])
|
-> ResourceT IO ([(Text, Text)], [(Text, FileInfo)])
|
||||||
|
#endif
|
||||||
rbHelper' backend mkFI req =
|
rbHelper' backend mkFI req =
|
||||||
(map fix1 *** mapMaybe fix2) <$> (NWP.parseRequestBody backend req)
|
(map fix1 *** mapMaybe fix2) <$> (NWP.parseRequestBody backend req)
|
||||||
where
|
where
|
||||||
@ -486,8 +502,17 @@ sendFilePart :: MonadHandler m
|
|||||||
-> Integer -- ^ offset
|
-> Integer -- ^ offset
|
||||||
-> Integer -- ^ count
|
-> Integer -- ^ count
|
||||||
-> m a
|
-> 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
|
handlerError $ HCSendFile ct fp $ Just $ W.FilePart off count
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | Bypass remaining handler code and output the given content with a 200
|
-- | Bypass remaining handler code and output the given content with a 200
|
||||||
-- status code.
|
-- status code.
|
||||||
@ -697,7 +722,7 @@ newIdent = do
|
|||||||
x <- get
|
x <- get
|
||||||
let i' = ghsIdent x + 1
|
let i' = ghsIdent x + 1
|
||||||
put x { ghsIdent = i' }
|
put x { ghsIdent = i' }
|
||||||
return $ T.pack $ 'h' : show i'
|
return $ T.pack $ "hident" ++ show i'
|
||||||
|
|
||||||
-- | Redirect to a POST resource.
|
-- | Redirect to a POST resource.
|
||||||
--
|
--
|
||||||
@ -916,7 +941,7 @@ selectRep w = do
|
|||||||
]) reps
|
]) reps
|
||||||
|
|
||||||
-- match on the type for sub-type wildcards.
|
-- 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
|
mainTypeMap = Map.fromList $ reverse $ map
|
||||||
(\v@(ProvidedRep ct _) -> (fst $ contentTypeTypes ct, v)) reps
|
(\v@(ProvidedRep ct _) -> (fst $ contentTypeTypes ct, v)) reps
|
||||||
|
|
||||||
@ -972,7 +997,13 @@ provideRepType ct handler =
|
|||||||
rawRequestBody :: MonadHandler m => Source m S.ByteString
|
rawRequestBody :: MonadHandler m => Source m S.ByteString
|
||||||
rawRequestBody = do
|
rawRequestBody = do
|
||||||
req <- lift waiRequest
|
req <- lift waiRequest
|
||||||
transPipe liftResourceT $ W.requestBody req
|
transPipe
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
liftIO
|
||||||
|
#else
|
||||||
|
liftResourceT
|
||||||
|
#endif
|
||||||
|
(W.requestBody req)
|
||||||
|
|
||||||
-- | Stream the data from the file. Since Yesod 1.2, this has been generalized
|
-- | Stream the data from the file. Since Yesod 1.2, this has been generalized
|
||||||
-- to work in any @MonadResource@.
|
-- to work in any @MonadResource@.
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE PatternGuards #-}
|
{-# LANGUAGE PatternGuards #-}
|
||||||
{-# LANGUAGE RankNTypes #-}
|
{-# LANGUAGE RankNTypes #-}
|
||||||
@ -12,6 +13,13 @@ import qualified Data.ByteString.Char8 as S8
|
|||||||
import Data.CaseInsensitive (CI)
|
import Data.CaseInsensitive (CI)
|
||||||
import qualified Data.CaseInsensitive as CI
|
import qualified Data.CaseInsensitive as CI
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
import Data.Conduit (transPipe)
|
||||||
|
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 Prelude hiding (catch)
|
||||||
import Web.Cookie (renderSetCookie)
|
import Web.Cookie (renderSetCookie)
|
||||||
import Yesod.Core.Content
|
import Yesod.Core.Content
|
||||||
@ -26,13 +34,30 @@ import qualified Data.Map as Map
|
|||||||
import Yesod.Core.Internal.Request (tokenKey)
|
import Yesod.Core.Internal.Request (tokenKey)
|
||||||
import Data.Text.Encoding (encodeUtf8)
|
import Data.Text.Encoding (encodeUtf8)
|
||||||
|
|
||||||
yarToResponse :: Monad m
|
yarToResponse :: YesodResponse
|
||||||
=> YesodResponse
|
-> (SessionMap -> IO [Header]) -- ^ save session
|
||||||
-> (SessionMap -> m [Header]) -- ^ save session
|
|
||||||
-> YesodRequest
|
-> YesodRequest
|
||||||
-> m Response
|
-> Request
|
||||||
yarToResponse (YRWai a) _ _ = return a
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq = do
|
-> 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
|
||||||
|
#endif
|
||||||
|
yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq req
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
is
|
||||||
|
#endif
|
||||||
|
= do
|
||||||
extraHeaders <- do
|
extraHeaders <- do
|
||||||
let nsToken = maybe
|
let nsToken = maybe
|
||||||
newSess
|
newSess
|
||||||
@ -43,6 +68,21 @@ yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq = do
|
|||||||
let finalHeaders = extraHeaders ++ map headerToPair hs
|
let finalHeaders = extraHeaders ++ map headerToPair hs
|
||||||
finalHeaders' len = ("Content-Length", S8.pack $ show len)
|
finalHeaders' len = ("Content-Length", S8.pack $ show len)
|
||||||
: finalHeaders
|
: 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 go (ContentBuilder b mlen) =
|
||||||
let hs' = maybe finalHeaders finalHeaders' mlen
|
let hs' = maybe finalHeaders finalHeaders' mlen
|
||||||
in ResponseBuilder s hs' b
|
in ResponseBuilder s hs' b
|
||||||
@ -50,6 +90,7 @@ yarToResponse (YRPlain s' hs ct c newSess) saveSession yreq = do
|
|||||||
go (ContentSource body) = ResponseSource s finalHeaders body
|
go (ContentSource body) = ResponseSource s finalHeaders body
|
||||||
go (ContentDontEvaluate c') = go c'
|
go (ContentDontEvaluate c') = go c'
|
||||||
return $ go c
|
return $ go c
|
||||||
|
#endif
|
||||||
where
|
where
|
||||||
s
|
s
|
||||||
| s' == defaultStatus = H.status200
|
| s' == defaultStatus = H.status200
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE PatternGuards #-}
|
{-# LANGUAGE PatternGuards #-}
|
||||||
{-# LANGUAGE RankNTypes #-}
|
{-# LANGUAGE RankNTypes #-}
|
||||||
@ -9,13 +10,13 @@ module Yesod.Core.Internal.Run where
|
|||||||
import Yesod.Core.Internal.Response
|
import Yesod.Core.Internal.Response
|
||||||
import Blaze.ByteString.Builder (toByteString)
|
import Blaze.ByteString.Builder (toByteString)
|
||||||
import Control.Applicative ((<$>))
|
import Control.Applicative ((<$>))
|
||||||
import Control.Exception (fromException)
|
import Control.Exception (fromException, bracketOnError)
|
||||||
import Control.Exception.Lifted (catch)
|
import Control.Exception.Lifted (catch)
|
||||||
import Control.Monad.IO.Class (MonadIO)
|
import Control.Monad.IO.Class (MonadIO)
|
||||||
import Control.Monad.IO.Class (liftIO)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
import Control.Monad.Logger (LogLevel (LevelError), LogSource,
|
import Control.Monad.Logger (LogLevel (LevelError), LogSource,
|
||||||
liftLoc)
|
liftLoc)
|
||||||
import Control.Monad.Trans.Resource (runResourceT, withInternalState, runInternalState)
|
import Control.Monad.Trans.Resource (runResourceT, withInternalState, runInternalState, createInternalState, closeInternalState)
|
||||||
import qualified Data.ByteString as S
|
import qualified Data.ByteString as S
|
||||||
import qualified Data.ByteString.Char8 as S8
|
import qualified Data.ByteString.Char8 as S8
|
||||||
import qualified Data.IORef as I
|
import qualified Data.IORef as I
|
||||||
@ -31,8 +32,13 @@ import Data.Text.Encoding.Error (lenientDecode)
|
|||||||
import Language.Haskell.TH.Syntax (Loc, qLocation)
|
import Language.Haskell.TH.Syntax (Loc, qLocation)
|
||||||
import qualified Network.HTTP.Types as H
|
import qualified Network.HTTP.Types as H
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
import Network.Wai.Internal
|
||||||
|
#endif
|
||||||
import Prelude hiding (catch)
|
import Prelude hiding (catch)
|
||||||
|
#if !MIN_VERSION_fast_logger(2, 0, 0)
|
||||||
import System.Log.FastLogger (Logger)
|
import System.Log.FastLogger (Logger)
|
||||||
|
#endif
|
||||||
import System.Log.FastLogger (LogStr, toLogStr)
|
import System.Log.FastLogger (LogStr, toLogStr)
|
||||||
import System.Random (newStdGen)
|
import System.Random (newStdGen)
|
||||||
import Yesod.Core.Content
|
import Yesod.Core.Content
|
||||||
@ -179,14 +185,17 @@ runFakeHandler fakeSessionMap logger site handler = liftIO $ do
|
|||||||
typePlain
|
typePlain
|
||||||
(toContent ("runFakeHandler: errHandler" :: S8.ByteString))
|
(toContent ("runFakeHandler: errHandler" :: S8.ByteString))
|
||||||
(reqSession req)
|
(reqSession req)
|
||||||
fakeWaiRequest =
|
fakeWaiRequest = Request
|
||||||
Request
|
|
||||||
{ requestMethod = "POST"
|
{ requestMethod = "POST"
|
||||||
, httpVersion = H.http11
|
, httpVersion = H.http11
|
||||||
, rawPathInfo = "/runFakeHandler/pathInfo"
|
, rawPathInfo = "/runFakeHandler/pathInfo"
|
||||||
, rawQueryString = ""
|
, rawQueryString = ""
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
, requestHeaderHost = Nothing
|
||||||
|
#else
|
||||||
, serverName = "runFakeHandler-serverName"
|
, serverName = "runFakeHandler-serverName"
|
||||||
, serverPort = 80
|
, serverPort = 80
|
||||||
|
#endif
|
||||||
, requestHeaders = []
|
, requestHeaders = []
|
||||||
, isSecure = False
|
, isSecure = False
|
||||||
, remoteHost = error "runFakeHandler-remoteHost"
|
, remoteHost = error "runFakeHandler-remoteHost"
|
||||||
@ -243,8 +252,14 @@ yesodRunner handler' YesodRunnerEnv {..} route req
|
|||||||
rhe = rheSafe
|
rhe = rheSafe
|
||||||
{ rheOnError = runHandler rheSafe . errorHandler
|
{ rheOnError = runHandler rheSafe . errorHandler
|
||||||
}
|
}
|
||||||
|
#if MIN_VERSION_wai(2, 0, 0)
|
||||||
|
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
|
yar <- runHandler rhe handler yreq
|
||||||
liftIO $ yarToResponse yar saveSession yreq
|
liftIO $ yarToResponse yar saveSession yreq req
|
||||||
|
#endif
|
||||||
where
|
where
|
||||||
mmaxLen = maximumContentLength yreSite route
|
mmaxLen = maximumContentLength yreSite route
|
||||||
handler = yesodMiddleware handler'
|
handler = yesodMiddleware handler'
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||||
{-# LANGUAGE TypeFamilies #-}
|
{-# LANGUAGE TypeFamilies #-}
|
||||||
{-# LANGUAGE UndecidableInstances #-}
|
{-# LANGUAGE UndecidableInstances #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
module Yesod.Core.Types where
|
module Yesod.Core.Types where
|
||||||
|
|
||||||
import qualified Blaze.ByteString.Builder as BBuilder
|
import qualified Blaze.ByteString.Builder as BBuilder
|
||||||
@ -46,7 +47,12 @@ import Network.Wai (FilePart,
|
|||||||
RequestBodyLength)
|
RequestBodyLength)
|
||||||
import qualified Network.Wai as W
|
import qualified Network.Wai as W
|
||||||
import qualified Network.Wai.Parse as NWP
|
import qualified Network.Wai.Parse as NWP
|
||||||
|
#if MIN_VERSION_fast_logger(2, 0, 0)
|
||||||
|
import System.Log.FastLogger (LogStr, LoggerSet, toLogStr, pushLogStr)
|
||||||
|
import Network.Wai.Logger (DateCacheGetter)
|
||||||
|
#else
|
||||||
import System.Log.FastLogger (LogStr, Logger, toLogStr)
|
import System.Log.FastLogger (LogStr, Logger, toLogStr)
|
||||||
|
#endif
|
||||||
import Text.Blaze.Html (Html)
|
import Text.Blaze.Html (Html)
|
||||||
import Text.Hamlet (HtmlUrl)
|
import Text.Hamlet (HtmlUrl)
|
||||||
import Text.Julius (JavascriptUrl)
|
import Text.Julius (JavascriptUrl)
|
||||||
@ -445,3 +451,13 @@ instance RenderRoute WaiSubsite where
|
|||||||
renderRoute (WaiSubsiteRoute ps qs) = (ps, qs)
|
renderRoute (WaiSubsiteRoute ps qs) = (ps, qs)
|
||||||
instance ParseRoute WaiSubsite where
|
instance ParseRoute WaiSubsite where
|
||||||
parseRoute (x, y) = Just $ WaiSubsiteRoute x y
|
parseRoute (x, y) = Just $ WaiSubsiteRoute x y
|
||||||
|
|
||||||
|
#if MIN_VERSION_fast_logger(2, 0, 0)
|
||||||
|
data Logger = Logger
|
||||||
|
{ loggerSet :: !LoggerSet
|
||||||
|
, loggerDate :: !DateCacheGetter
|
||||||
|
}
|
||||||
|
|
||||||
|
loggerPutStr :: Logger -> LogStr -> IO ()
|
||||||
|
loggerPutStr (Logger ls _) = pushLogStr ls
|
||||||
|
#endif
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import Network.Wai
|
|||||||
import qualified Data.ByteString.Char8 as S8
|
import qualified Data.ByteString.Char8 as S8
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import Data.List (isSuffixOf)
|
import Data.List (isSuffixOf)
|
||||||
|
import qualified Network.HTTP.Types as H
|
||||||
|
|
||||||
data App = App
|
data App = App
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ test method path f = it (method ++ " " ++ path) $ do
|
|||||||
, requestHeaders =
|
, requestHeaders =
|
||||||
if not $ isSuffixOf "json" path then [] else
|
if not $ isSuffixOf "json" path then [] else
|
||||||
[("Accept", S8.pack "application/json")]
|
[("Accept", S8.pack "application/json")]
|
||||||
|
, httpVersion = H.http11
|
||||||
}
|
}
|
||||||
f sres
|
f sres
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,8 @@ specs = describe "Redirect" $ do
|
|||||||
|
|
||||||
it "303 redirect for regular, HTTP 1.1" $ app $ do
|
it "303 redirect for regular, HTTP 1.1" $ app $ do
|
||||||
res <- request defaultRequest {
|
res <- request defaultRequest {
|
||||||
pathInfo = ["rregular"]
|
pathInfo = ["rregular"],
|
||||||
|
httpVersion = H.http11
|
||||||
}
|
}
|
||||||
assertStatus 303 res
|
assertStatus 303 res
|
||||||
assertBodyContains "" res
|
assertBodyContains "" res
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-core
|
name: yesod-core
|
||||||
version: 1.2.5
|
version: 1.2.6.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
@ -26,10 +26,10 @@ library
|
|||||||
build-depends: base >= 4.3 && < 5
|
build-depends: base >= 4.3 && < 5
|
||||||
, time >= 1.1.4
|
, time >= 1.1.4
|
||||||
, yesod-routes >= 1.2 && < 1.3
|
, yesod-routes >= 1.2 && < 1.3
|
||||||
, wai >= 1.4 && < 1.5
|
, wai >= 1.4
|
||||||
, wai-extra >= 1.3 && < 1.4
|
, wai-extra >= 1.3
|
||||||
, bytestring >= 0.9.1.4
|
, bytestring >= 0.9.1.4
|
||||||
, text >= 0.7 && < 0.12
|
, text >= 0.7
|
||||||
, template-haskell
|
, template-haskell
|
||||||
, path-pieces >= 0.1.2 && < 0.2
|
, path-pieces >= 0.1.2 && < 0.2
|
||||||
, hamlet >= 1.1 && < 1.2
|
, hamlet >= 1.1 && < 1.2
|
||||||
@ -55,9 +55,10 @@ library
|
|||||||
, vector >= 0.9 && < 0.11
|
, vector >= 0.9 && < 0.11
|
||||||
, aeson >= 0.5
|
, aeson >= 0.5
|
||||||
, fast-logger >= 0.2
|
, fast-logger >= 0.2
|
||||||
|
, wai-logger >= 0.2
|
||||||
, monad-logger >= 0.3.1 && < 0.4
|
, monad-logger >= 0.3.1 && < 0.4
|
||||||
, conduit >= 0.5
|
, conduit >= 0.5
|
||||||
, resourcet >= 0.4.6 && < 0.5
|
, resourcet >= 0.4.9 && < 0.5
|
||||||
, lifted-base >= 0.1.2
|
, lifted-base >= 0.1.2
|
||||||
, attoparsec-conduit
|
, attoparsec-conduit
|
||||||
, blaze-html >= 0.5
|
, blaze-html >= 0.5
|
||||||
@ -65,6 +66,7 @@ library
|
|||||||
, data-default
|
, data-default
|
||||||
, safe
|
, safe
|
||||||
, warp >= 1.3.8
|
, warp >= 1.3.8
|
||||||
|
, unix-compat
|
||||||
|
|
||||||
exposed-modules: Yesod.Core
|
exposed-modules: Yesod.Core
|
||||||
Yesod.Core.Content
|
Yesod.Core.Content
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-eventsource
|
name: yesod-eventsource
|
||||||
version: 1.1
|
version: 1.1.0.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Felipe Lessa <felipe.lessa@gmail.com>
|
author: Felipe Lessa <felipe.lessa@gmail.com>
|
||||||
@ -30,8 +30,8 @@ library
|
|||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, yesod-core == 1.2.*
|
, yesod-core == 1.2.*
|
||||||
, conduit >= 0.5 && < 1.1
|
, conduit >= 0.5 && < 1.1
|
||||||
, wai >= 1.3 && < 1.5
|
, wai >= 1.3
|
||||||
, wai-eventsource >= 1.3 && < 1.4
|
, wai-eventsource >= 1.3
|
||||||
, blaze-builder
|
, blaze-builder
|
||||||
, transformers
|
, transformers
|
||||||
exposed-modules: Yesod.EventSource
|
exposed-modules: Yesod.EventSource
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-persistent
|
name: yesod-persistent
|
||||||
version: 1.2.1
|
version: 1.2.2
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-platform
|
name: yesod-platform
|
||||||
version: 1.2.4.4
|
version: 1.2.5
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
@ -15,38 +15,40 @@ homepage: http://www.yesodweb.com/
|
|||||||
library
|
library
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, SHA == 1.6.1
|
, SHA == 1.6.1
|
||||||
, aeson == 0.6.2.0
|
, aeson == 0.6.2.1
|
||||||
, ansi-terminal == 0.6
|
, ansi-terminal == 0.6
|
||||||
, asn1-data == 0.7.1
|
, asn1-data == 0.7.1
|
||||||
, asn1-types == 0.2.0
|
, asn1-types == 0.2.2
|
||||||
, attoparsec == 0.10.4.0
|
, attoparsec == 0.10.4.0
|
||||||
, attoparsec-conduit == 1.0.1.2
|
, attoparsec-conduit == 1.0.1.2
|
||||||
, authenticate == 1.3.2.6
|
, authenticate == 1.3.2.6
|
||||||
, base-unicode-symbols == 0.2.2.4
|
, base-unicode-symbols == 0.2.2.4
|
||||||
, base64-bytestring == 1.0.0.1
|
, 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-builder-conduit == 1.0.0
|
||||||
, blaze-html == 0.6.1.1
|
, blaze-html == 0.6.1.2
|
||||||
, blaze-markup == 0.5.1.5
|
, blaze-markup == 0.5.1.6
|
||||||
, byteable == 0.1.1
|
, byteable == 0.1.1
|
||||||
, byteorder == 1.0.4
|
, byteorder == 1.0.4
|
||||||
, case-insensitive == 1.1
|
, case-insensitive == 1.1.0.2
|
||||||
, cereal == 0.3.5.2
|
, cereal == 0.4.0.1
|
||||||
, certificate == 1.3.8
|
, certificate == 1.3.9
|
||||||
, cipher-aes == 0.2.5
|
, cipher-aes == 0.2.6
|
||||||
, cipher-rc4 == 0.1.2
|
, cipher-rc4 == 0.1.4
|
||||||
, clientsession == 0.9.0.3
|
, 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
|
, cookie == 0.4.0.1
|
||||||
, cprng-aes == 0.5.2
|
, cprng-aes == 0.5.2
|
||||||
, crypto-api == 0.12.2.2
|
, crypto-api == 0.12.2.2
|
||||||
, crypto-cipher-types == 0.0.4
|
, crypto-cipher-types == 0.0.9
|
||||||
, crypto-conduit == 0.5.2
|
, crypto-conduit == 0.5.2.1
|
||||||
, crypto-numbers == 0.2.1
|
, crypto-numbers == 0.2.3
|
||||||
, crypto-pubkey == 0.2.1
|
, crypto-pubkey == 0.2.3
|
||||||
, crypto-pubkey-types == 0.4.0
|
, crypto-pubkey-types == 0.4.1
|
||||||
, crypto-random == 0.0.7
|
, crypto-random == 0.0.7
|
||||||
, cryptohash == 0.10.0
|
, cryptohash == 0.11.1
|
||||||
, cryptohash-cryptoapi == 0.1.0
|
, cryptohash-cryptoapi == 0.1.0
|
||||||
, css-text == 0.1.1
|
, css-text == 0.1.1
|
||||||
, data-default == 0.5.3
|
, data-default == 0.5.3
|
||||||
@ -55,89 +57,94 @@ library
|
|||||||
, data-default-instances-containers == 0.0.1
|
, data-default-instances-containers == 0.0.1
|
||||||
, data-default-instances-dlist == 0.0.1
|
, data-default-instances-dlist == 0.0.1
|
||||||
, data-default-instances-old-locale == 0.0.1
|
, data-default-instances-old-locale == 0.0.1
|
||||||
, date-cache == 0.3.0
|
, dlist == 0.6.0.1
|
||||||
, dlist == 0.5
|
|
||||||
, email-validate == 1.0.0
|
, email-validate == 1.0.0
|
||||||
, entropy == 0.2.2.4
|
, entropy == 0.2.2.4
|
||||||
, failure == 0.2.0.1
|
, failure == 0.2.0.1
|
||||||
, fast-logger == 0.3.3
|
, fast-logger == 2.0.0
|
||||||
, file-embed == 0.0.4.9
|
, file-embed == 0.0.6
|
||||||
, filesystem-conduit == 1.0.0.1
|
, filesystem-conduit == 1.0.0.1
|
||||||
, hamlet == 1.1.7.2
|
, hamlet == 1.1.7.5
|
||||||
, hjsmin == 0.1.4.1
|
, hjsmin == 0.1.4.4
|
||||||
, hspec == 1.7.2
|
, hspec == 1.8.1.1
|
||||||
, hspec-expectations == 0.3.3
|
, hspec-expectations == 0.5.0.1
|
||||||
, html-conduit == 1.1.0
|
, html-conduit == 1.1.0.1
|
||||||
, http-attoparsec == 0.1.0
|
, 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-date == 0.0.4
|
||||||
, http-types == 0.8.1
|
, http-types == 0.8.3
|
||||||
, language-javascript == 0.5.7
|
, language-javascript == 0.5.8
|
||||||
, lifted-base == 0.2.1.0
|
, lifted-base == 0.2.1.1
|
||||||
, mime-mail == 0.4.2.1
|
, mime-mail == 0.4.2.1
|
||||||
, mime-types == 0.1.0.3
|
, mime-types == 0.1.0.3
|
||||||
, mmorph == 1.0.0
|
, mmorph == 1.0.0
|
||||||
, monad-control == 0.3.2.1
|
, monad-control == 0.3.2.2
|
||||||
, monad-logger == 0.3.1.1
|
, monad-logger == 0.3.3.1
|
||||||
|
, monad-loops == 0.4.2
|
||||||
, network-conduit == 1.0.0
|
, network-conduit == 1.0.0
|
||||||
, path-pieces == 0.1.2
|
, path-pieces == 0.1.3
|
||||||
, pem == 0.1.2
|
, pem == 0.2.1
|
||||||
, persistent == 1.2.3.0
|
, persistent == 1.2.3.0
|
||||||
, persistent-template == 1.2.0.2
|
, persistent-template == 1.2.0.5
|
||||||
, pool-conduit == 0.1.2
|
, pool-conduit == 0.1.2
|
||||||
, primitive == 0.5.0.1
|
, primitive == 0.5.1.0
|
||||||
|
, process-conduit == 1.0.0.1
|
||||||
, publicsuffixlist == 0.1
|
, publicsuffixlist == 0.1
|
||||||
, pureMD5 == 2.1.2.1
|
, pureMD5 == 2.1.2.1
|
||||||
, pwstore-fast == 2.3
|
, pwstore-fast == 2.4.1
|
||||||
, quickcheck-io == 0.1.0
|
, quickcheck-io == 0.1.0
|
||||||
, resource-pool == 0.2.1.1
|
, resource-pool == 0.2.1.1
|
||||||
, resourcet == 0.4.8
|
, resourcet == 0.4.9
|
||||||
, safe == 0.3.3
|
, safe == 0.3.3
|
||||||
, securemem == 0.1.3
|
, securemem == 0.1.3
|
||||||
, semigroups == 0.9.2
|
, semigroups == 0.12.1
|
||||||
, setenv == 0.1.0
|
, setenv == 0.1.1
|
||||||
, shakespeare == 1.2.0
|
, shakespeare == 1.2.0.3
|
||||||
, shakespeare-css == 1.0.6.3
|
, shakespeare-css == 1.0.6.6
|
||||||
, shakespeare-i18n == 1.0.0.4
|
, shakespeare-i18n == 1.0.0.5
|
||||||
, shakespeare-js == 1.2.0
|
, shakespeare-js == 1.2.0.2
|
||||||
, shakespeare-text == 1.0.0.7
|
, shakespeare-text == 1.0.0.10
|
||||||
, silently == 1.2.4.1
|
, silently == 1.2.4.1
|
||||||
, simple-sendfile == 0.2.12
|
, simple-sendfile == 0.2.13
|
||||||
, skein == 1.0.6
|
, skein == 1.0.8
|
||||||
, socks == 0.5.3
|
, socks == 0.5.4
|
||||||
, stringsearch == 0.3.6.4
|
, stm-chans == 3.0.0
|
||||||
|
, stringsearch == 0.3.6.5
|
||||||
, system-fileio == 0.3.11
|
, system-fileio == 0.3.11
|
||||||
, system-filepath == 0.4.7
|
, system-filepath == 0.4.8
|
||||||
, tagged == 0.7
|
, tagged == 0.7
|
||||||
, tagsoup == 0.13
|
, tagsoup == 0.13
|
||||||
, tagstream-conduit == 0.5.4
|
, tagstream-conduit == 0.5.4.1
|
||||||
, tls == 1.1.5
|
, tls == 1.1.5
|
||||||
, tls-extra == 0.6.5
|
, tls-extra == 0.6.6
|
||||||
, transformers-base == 0.4.1
|
, transformers-base == 0.4.1
|
||||||
, unix-compat == 0.4.1.1
|
, unix-compat == 0.4.1.1
|
||||||
, unordered-containers == 0.2.3.2
|
, unordered-containers == 0.2.3.3
|
||||||
, utf8-light == 0.4.0.1
|
, utf8-light == 0.4.2
|
||||||
, utf8-string == 0.3.7
|
, utf8-string == 0.3.7
|
||||||
, vector == 0.10.0.1
|
, vector == 0.10.9.1
|
||||||
, void == 0.6.1
|
, void == 0.6.1
|
||||||
, wai == 1.4.0.2
|
, wai == 2.0.0
|
||||||
, wai-app-static == 1.3.1.4
|
, wai-app-static == 2.0.0.1
|
||||||
, wai-extra == 1.3.4.4
|
, wai-extra == 2.0.0.1
|
||||||
, wai-logger == 0.3.1
|
, wai-logger == 2.0.1
|
||||||
, wai-test == 1.3.1.1
|
, wai-test == 2.0.0.1
|
||||||
, warp == 1.3.9.2
|
, warp == 2.0.0.1
|
||||||
, word8 == 0.0.3
|
, word8 == 0.0.4
|
||||||
, xml-conduit == 1.1.0.7
|
, xml-conduit == 1.1.0.9
|
||||||
, xml-types == 0.3.4
|
, xml-types == 0.3.4
|
||||||
, xss-sanitize == 0.3.4
|
, xss-sanitize == 0.3.4
|
||||||
, yaml == 0.8.4.1
|
, yaml == 0.8.5.2
|
||||||
, yesod == 1.2.2.1
|
, yesod == 1.2.4
|
||||||
, yesod-auth == 1.2.2.1
|
, yesod-auth == 1.2.4
|
||||||
, yesod-core == 1.2.4.2
|
, yesod-core == 1.2.6.1
|
||||||
, yesod-form == 1.3.2.1
|
, yesod-form == 1.3.4
|
||||||
, yesod-persistent == 1.2.1
|
, yesod-persistent == 1.2.2
|
||||||
, yesod-routes == 1.2.0.1
|
, yesod-routes == 1.2.0.2
|
||||||
, yesod-static == 1.2.0.1
|
, yesod-static == 1.2.2
|
||||||
, yesod-test == 1.2.1
|
, yesod-test == 1.2.1
|
||||||
, zlib-bindings == 0.1.1.3
|
, zlib-bindings == 0.1.1.3
|
||||||
, zlib-conduit == 1.0.0
|
, zlib-conduit == 1.0.0
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-routes
|
name: yesod-routes
|
||||||
version: 1.2.0.1
|
version: 1.2.0.2
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
@ -16,7 +16,7 @@ extra-source-files:
|
|||||||
|
|
||||||
library
|
library
|
||||||
build-depends: base >= 4 && < 5
|
build-depends: base >= 4 && < 5
|
||||||
, text >= 0.5 && < 0.12
|
, text >= 0.5
|
||||||
, vector >= 0.8 && < 0.11
|
, vector >= 0.8 && < 0.11
|
||||||
, containers >= 0.2
|
, containers >= 0.2
|
||||||
, template-haskell
|
, template-haskell
|
||||||
@ -42,7 +42,7 @@ test-suite runtests
|
|||||||
|
|
||||||
build-depends: base >= 4.3 && < 5
|
build-depends: base >= 4.3 && < 5
|
||||||
, yesod-routes
|
, yesod-routes
|
||||||
, text >= 0.5 && < 0.12
|
, text >= 0.5
|
||||||
, HUnit >= 1.2 && < 1.3
|
, HUnit >= 1.2 && < 1.3
|
||||||
, hspec >= 1.3
|
, hspec >= 1.3
|
||||||
, containers
|
, containers
|
||||||
|
|||||||
@ -101,7 +101,7 @@ import Filesystem (createTree)
|
|||||||
import qualified Data.Text.Lazy as TL
|
import qualified Data.Text.Lazy as TL
|
||||||
import qualified Data.Text.Lazy.Encoding as TLE
|
import qualified Data.Text.Lazy.Encoding as TLE
|
||||||
import Data.Default
|
import Data.Default
|
||||||
import Text.Lucius (luciusRTMinified)
|
--import Text.Lucius (luciusRTMinified)
|
||||||
|
|
||||||
import Network.Wai.Application.Static
|
import Network.Wai.Application.Static
|
||||||
( StaticSettings (..)
|
( StaticSettings (..)
|
||||||
@ -478,10 +478,13 @@ data CombineSettings = CombineSettings
|
|||||||
instance Default CombineSettings where
|
instance Default CombineSettings where
|
||||||
def = CombineSettings
|
def = CombineSettings
|
||||||
{ csStaticDir = "static"
|
{ csStaticDir = "static"
|
||||||
|
{- Disabled due to: https://github.com/yesodweb/yesod/issues/623
|
||||||
, csCssPostProcess = \fps ->
|
, csCssPostProcess = \fps ->
|
||||||
either (error . (errorIntro fps)) (return . TLE.encodeUtf8)
|
either (error . (errorIntro fps)) (return . TLE.encodeUtf8)
|
||||||
. flip luciusRTMinified []
|
. flip luciusRTMinified []
|
||||||
. TLE.decodeUtf8
|
. TLE.decodeUtf8
|
||||||
|
-}
|
||||||
|
, csCssPostProcess = const return
|
||||||
, csJsPostProcess = const return
|
, csJsPostProcess = const return
|
||||||
-- FIXME The following borders on a hack. With combining of files,
|
-- FIXME The following borders on a hack. With combining of files,
|
||||||
-- the final location of the CSS is no longer fixed, so relative
|
-- the final location of the CSS is no longer fixed, so relative
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-static
|
name: yesod-static
|
||||||
version: 1.2.1
|
version: 1.2.2
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
@ -34,8 +34,8 @@ library
|
|||||||
, template-haskell
|
, template-haskell
|
||||||
, directory >= 1.0
|
, directory >= 1.0
|
||||||
, transformers >= 0.2.2
|
, transformers >= 0.2.2
|
||||||
, wai-app-static >= 1.3.2 && < 1.4
|
, wai-app-static >= 1.3.2
|
||||||
, wai >= 1.3 && < 1.5
|
, wai >= 1.3
|
||||||
, text >= 0.9
|
, text >= 0.9
|
||||||
, file-embed >= 0.0.4.1 && < 0.5
|
, file-embed >= 0.0.4.1 && < 0.5
|
||||||
, http-types >= 0.7
|
, http-types >= 0.7
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod
|
name: yesod
|
||||||
version: 1.2.3
|
version: 1.2.4
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
@ -28,12 +28,12 @@ library
|
|||||||
, yesod-form >= 1.3 && < 1.4
|
, yesod-form >= 1.3 && < 1.4
|
||||||
, monad-control >= 0.3 && < 0.4
|
, monad-control >= 0.3 && < 0.4
|
||||||
, transformers >= 0.2.2 && < 0.4
|
, transformers >= 0.2.2 && < 0.4
|
||||||
, wai >= 1.3 && < 1.5
|
, wai >= 1.3
|
||||||
, wai-extra >= 1.3 && < 1.4
|
, wai-extra >= 1.3
|
||||||
, hamlet >= 1.1 && < 1.2
|
, hamlet >= 1.1 && < 1.2
|
||||||
, shakespeare-js >= 1.0.2 && < 1.3
|
, shakespeare-js >= 1.0.2 && < 1.3
|
||||||
, shakespeare-css >= 1.0 && < 1.1
|
, shakespeare-css >= 1.0 && < 1.1
|
||||||
, warp >= 1.3 && < 1.4
|
, warp >= 1.3
|
||||||
, blaze-html >= 0.5
|
, blaze-html >= 0.5
|
||||||
, blaze-markup >= 0.5.1
|
, blaze-markup >= 0.5.1
|
||||||
, aeson
|
, aeson
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user