@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE Rank2Types, ScopedTypeVariables #-}
23---------------------------------------------------------
34-- |
@@ -35,7 +36,11 @@ import Control.Exception (try, SomeException)
3536import qualified Data.Set as Set
3637import Network.Wai.Header
3738import Network.Wai.Internal
39+#if MIN_VERSION_streaming_commons(0, 2, 0)
40+import qualified Data.Streaming.ByteString.Builder as B
41+#else
3842import qualified Data.Streaming.Blaze as B
43+#endif
3944import qualified Data.Streaming.Zlib as Z
4045import qualified Blaze.ByteString.Builder as Blaze
4146import Control.Monad (unless)
@@ -69,7 +74,7 @@ instance Default GzipSettings where
6974 def = GzipSettings GzipIgnore defaultCheckMime
7075
7176-- | MIME types that will be compressed by default:
72−-- @text/*@, @application/json@, @application/javascript@,
77+-- @text/@ @*@, @application/json@, @application/javascript@,
7378-- @application/ecmascript@, @image/x-icon@.
7479defaultCheckMime :: S.ByteString -> Bool
7580defaultCheckMime bs =
@@ -182,7 +187,11 @@ compressE set res sendResponse =
182187 Just m | gzipCheckMime set m ->
183188 let hs' = fixHeaders hs
184189 in wb $ \body -> sendResponse $ responseStream s hs' $ \sendChunk flush -> do
190+#if MIN_VERSION_streaming_commons(0, 2, 0)
191+ (blazeRecv, _) <- B.newBuilderRecv B.defaultStrategy
192+#else
185193 (blazeRecv, _) <- B.newBlazeRecv B.defaultStrategy
194+#endif
186195 deflate <- Z.initDeflate 1 (Z.WindowBits 31)
187196 let sendBuilder builder = do
188197 popper <- blazeRecv builder