From fe2e0176809469d7af206f177dca253c22c915f3 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 19 Sep 2011 12:50:01 +0300 Subject: [PATCH] gzipCompressFiles --- yesod-core/Yesod/Dispatch.hs | 4 ++-- yesod-core/Yesod/Internal/Core.hs | 4 ++++ yesod-core/yesod-core.cabal | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/yesod-core/Yesod/Dispatch.hs b/yesod-core/Yesod/Dispatch.hs index 4421abc5..91147cb8 100644 --- a/yesod-core/Yesod/Dispatch.hs +++ b/yesod-core/Yesod/Dispatch.hs @@ -173,10 +173,10 @@ thResourceFromResource (Resource n _ _) = -- | Convert the given argument into a WAI application, executable with any WAI -- handler. This is the same as 'toWaiAppPlain', except it includes three --- middlewares: GZIP compression, JSON-P and path cleaning. This is the +-- middlewares: GZIP compression, JSON-P and autohead. This is the -- recommended approach for most users. toWaiApp :: (Yesod y, YesodDispatch y y) => y -> IO W.Application -toWaiApp y = gzip False . jsonp . autohead <$> toWaiAppPlain y +toWaiApp y = gzip (gzipCompressFiles y) . jsonp . autohead <$> toWaiAppPlain y -- | Convert the given argument into a WAI application, executable with any WAI -- handler. This differs from 'toWaiApp' in that it uses no middlewares. diff --git a/yesod-core/Yesod/Internal/Core.hs b/yesod-core/Yesod/Internal/Core.hs index ce0c4910..4ba14405 100644 --- a/yesod-core/Yesod/Internal/Core.hs +++ b/yesod-core/Yesod/Internal/Core.hs @@ -260,6 +260,10 @@ class RenderRoute (Route a) => Yesod a where formatLogMessage loc level msg >>= Data.Text.Lazy.IO.putStrLn + -- | Apply gzip compression to files. Default is false. + gzipCompressFiles :: a -> Bool + gzipCompressFiles _ = False + messageLoggerHandler :: (Yesod m, MonadIO mo) => Loc -> LogLevel -> Text -> GGHandler s m mo () messageLoggerHandler loc level msg = do diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 233b95c6..b2b9bbe3 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 0.9.2 +version: 0.9.3 license: BSD3 license-file: LICENSE author: Michael Snoyman