on master help sign in
conduit 0.3
commitaf7d1a79cbcada0b18883bcc5e5e19a1cd06ae7b authorMichael Snoyman <michael@snoyman.com> dateSun 26 Feb 2012, 08:49 (15 years ago) parentcd8b45d
22 files changed+86−94
wai-app-static/wai-app-static.cabal+3−3 wai-eventsource/src/Network/Wai/EventSource.hs+5−12 wai-eventsource/wai-eventsource.cabal+4−4 wai-extra/Network/Wai/Handler/CGI.hs+3−3 wai-extra/Network/Wai/Parse.hs+7−7 wai-extra/wai-extra.cabal+5−5 wai-frontend-monadcgi/wai-frontend-monadcgi.cabal+2−2 wai-handler-devel/wai-handler-devel.cabal+4−4 wai-handler-fastcgi/wai-handler-fastcgi.cabal+3−3 wai-handler-launch/Network/Wai/Handler/Launch.hs+1−1 wai-handler-launch/wai-handler-launch.cabal+6−6 wai-handler-scgi/wai-handler-scgi.cabal+3−3 wai-handler-webkit/wai-handler-webkit.cabal+3−3 wai-test/wai-test.cabal+4−4 wai-websockets/Network/Wai/Handler/WebSockets.hs+3−3 wai-websockets/wai-websockets.cabal+3−3 wai/Network/Wai.hs+5−6 wai/wai.cabal+2−2 warp-static/warp-static.cabal+4−4 warp-tls/warp-tls.cabal+4−4 warp/Network/Wai/Handler/Warp.hs+8−8 warp/warp.cabal+4−4
wai-app-static/wai-app-static.cabal+3−3
@@ -1,5 +1,5 @@
11name: wai-app-static
2−version: 1.1.2
2+version: 1.2.0
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -24,7 +24,7 @@ Flag print
2424
2525library
2626 build-depends: base >= 4 && < 5
27− , wai >= 1.1 && < 1.2
27+ , wai >= 1.2 && < 1.3
2828 , bytestring >= 0.9.1.4 && < 0.10
2929 , http-types >= 0.6 && < 0.7
3030 , transformers >= 0.2.2 && < 0.3
@@ -59,7 +59,7 @@ test-suite runtests
5959 , time >= 1.1.4
6060 , old-locale >= 1.0.0.2 && < 1.1
6161 , http-date
62− , wai-app-static >= 1.0
62+ , wai-app-static >= 1.2
6363 , wai-test
6464 , wai
6565 , http-types
wai-eventsource/src/Network/Wai/EventSource.hs+5−12
@@ -1,7 +1,6 @@
11{-# LANGUAGE OverloadedStrings #-}
22module Network.Wai.EventSource (
33 ServerEvent(..),
4− eventSourceApp,
54 eventSourceAppChan,
65 eventSourceAppSource,
76 eventSourceAppIO
@@ -18,12 +17,6 @@ import Network.Wai (Application, Response(..))
1817
1918import Network.Wai.EventSource.EventStream
2019
21−-- | Make a new WAI EventSource application reading events from
22−-- the given channel.
23−eventSourceApp :: Chan ServerEvent -> Application
24−eventSourceApp = eventSourceAppChan
25−{-# DEPRECATED eventSourceApp "Use evnetSourceAppChan instead." #-}
26−
2720-- | Make a new WAI EventSource application reading events from
2821-- the given channel.
2922eventSourceAppChan :: Chan ServerEvent -> Application
@@ -33,7 +26,7 @@ eventSourceAppChan chan _ = do
3326
3427-- | Make a new WAI EventSource application reading events from
3528-- the given source.
36−eventSourceAppSource :: C.Source IO ServerEvent -> Application
29+eventSourceAppSource :: C.Source (C.ResourceT IO) ServerEvent -> Application
3730eventSourceAppSource src _ = return $ response sourceToSource src
3831
3932-- | Make a new WAI EventSource application reading events from
@@ -41,10 +34,10 @@ eventSourceAppSource src _ = return $ response sourceToSource src
4134eventSourceAppIO :: IO ServerEvent -> Application
4235eventSourceAppIO act _ = return $ response ioToSource act
4336
44−response :: (a -> C.Source IO (C.Flush Builder)) -> a -> Response
37+response :: (a -> C.Source (C.ResourceT IO) (C.Flush Builder)) -> a -> Response
4538response f a = ResponseSource status200 [("Content-Type", "text/event-stream")] $ f a
4639
47−chanToSource :: Chan ServerEvent -> C.Source IO (C.Flush Builder)
40+chanToSource :: Chan ServerEvent -> C.Source (C.ResourceT IO) (C.Flush Builder)
4841chanToSource chan =
4942 C.sourceState Nothing pull
5043 where
@@ -55,7 +48,7 @@ chanToSource chan =
5548 Just y -> C.StateOpen (Just C.Flush) (C.Chunk y)
5649 pull (Just x) = return $ C.StateOpen Nothing x
5750
58−ioToSource :: IO ServerEvent -> C.Source IO (C.Flush Builder)
51+ioToSource :: IO ServerEvent -> C.Source (C.ResourceT IO) (C.Flush Builder)
5952ioToSource act =
6053 C.sourceState Nothing pull
6154 where
@@ -66,7 +59,7 @@ ioToSource act =
6659 Just y -> C.StateOpen (Just C.Flush) (C.Chunk y)
6760 pull (Just x) = return $ C.StateOpen Nothing x
6861
69−sourceToSource :: C.Source IO ServerEvent -> C.Source IO (C.Flush Builder)
62+sourceToSource :: Monad m => C.Source m ServerEvent -> C.Source m (C.Flush Builder)
7063sourceToSource src = src $= CL.concatMap eventToFlushBuilder
7164 where
7265 eventToFlushBuilder event =
wai-eventsource/wai-eventsource.cabal+4−4
@@ -1,5 +1,5 @@
11Name: wai-eventsource
2−Version: 1.1.0.1
2+Version: 1.2.0
33Synopsis: WAI support for server-sent events
44Description: WAI support for server-sent events
55License: BSD3
@@ -17,10 +17,10 @@ Library
1717 base >= 4.3 && < 5
1818 , bytestring >= 0.9.1.4 && < 0.10
1919 , blaze-builder >= 0.3 && < 0.4
20− , conduit >= 0.2 && < 0.3
20+ , conduit >= 0.3 && < 0.4
2121 , http-types >= 0.6 && < 0.7
22− , wai >= 1.1
23− , warp >= 1.1
22+ , wai >= 1.2 && < 1.3
23+ , warp >= 1.2 && < 1.3
2424 , transformers
2525
2626 ghc-options: -Wall
wai-extra/Network/Wai/Handler/CGI.hs+3−3
@@ -66,7 +66,7 @@ runSendfile sf app = do
6666-- stick with 'run' or 'runSendfile'.
6767runGeneric
6868 :: [(String, String)] -- ^ all variables
69− -> (Int -> C.Source IO B.ByteString) -- ^ responseBody of input
69+ -> (Int -> C.Source (C.ResourceT IO) B.ByteString) -- ^ responseBody of input
7070 -> (B.ByteString -> IO ()) -- ^ destination for output
7171 -> Maybe B.ByteString -- ^ does the server support the X-Sendfile header?
7272 -> Application
@@ -166,12 +166,12 @@ cleanupVarName s =
166166 helper' (x:rest) = toLower x : helper' rest
167167 helper' [] = []
168168
169−requestBodyHandle :: Handle -> Int -> C.Source IO B.ByteString
169+requestBodyHandle :: Handle -> Int -> C.Source (C.ResourceT IO) B.ByteString
170170requestBodyHandle h = requestBodyFunc $ \i -> do
171171 bs <- B.hGet h i
172172 return $ if B.null bs then Nothing else Just bs
173173
174−requestBodyFunc :: (Int -> IO (Maybe B.ByteString)) -> Int -> C.Source IO B.ByteString
174+requestBodyFunc :: (Int -> IO (Maybe B.ByteString)) -> Int -> C.Source (C.ResourceT IO) B.ByteString
175175requestBodyFunc get count0 =
176176 C.sourceState count0 pull
177177 where
wai-extra/Network/Wai/Parse.hs+7−7
@@ -182,12 +182,12 @@ parseRequestBody s r =
182182
183183sinkRequestBody :: BackEnd y
184184 -> RequestBodyType
185− -> C.Sink S.ByteString IO ([Param], [File y])
185+ -> C.Sink S.ByteString (C.ResourceT IO) ([Param], [File y])
186186sinkRequestBody s r = fmap partitionEithers $ conduitRequestBody s r C.=$ CL.consume
187187
188188conduitRequestBody :: BackEnd y
189189 -> RequestBodyType
190− -> C.Conduit S.ByteString IO (Either Param (File y))
190+ -> C.Conduit S.ByteString (C.ResourceT IO) (Either Param (File y))
191191conduitRequestBody _ UrlEncoded = C.sequenceSink () $ \() -> do -- url-encoded
192192 -- NOTE: in general, url-encoded data will be in a single chunk.
193193 -- Therefore, I'm optimizing for the usual case by sticking with
@@ -197,7 +197,7 @@ conduitRequestBody _ UrlEncoded = C.sequenceSink () $ \() -> do -- url-encoded
197197conduitRequestBody backend (Multipart bound) =
198198 parsePieces backend $ S8.pack "--" `S.append` bound
199199
200−takeLine :: C.Sink S.ByteString IO (Maybe S.ByteString)
200+takeLine :: C.Sink S.ByteString (C.ResourceT IO) (Maybe S.ByteString)
201201takeLine =
202202 C.sinkState id push close'
203203 where
@@ -210,7 +210,7 @@ takeLine =
210210 let lo = if S.length y > 1 then Just (S.drop 1 y) else Nothing
211211 return $ C.StateDone lo $ Just $ killCR x
212212
213−takeLines :: C.Sink S.ByteString IO [S.ByteString]
213+takeLines :: C.Sink S.ByteString (C.ResourceT IO) [S.ByteString]
214214takeLines = do
215215 res <- takeLine
216216 case res of
@@ -222,12 +222,12 @@ takeLines = do
222222 return $ l : ls
223223
224224parsePieces :: BackEnd y -> S.ByteString
225− -> C.Conduit S.ByteString IO (Either Param (File y))
225+ -> C.Conduit S.ByteString (C.ResourceT IO) (Either Param (File y))
226226parsePieces sink bound = C.sequenceSink True (parsePiecesSink sink bound)
227227
228228parsePiecesSink :: BackEnd y
229229 -> S.ByteString
230− -> C.SequencedSink Bool S.ByteString IO (Either Param (File y))
230+ -> C.SequencedSink Bool S.ByteString (C.ResourceT IO) (Either Param (File y))
231231parsePiecesSink _ _ False = return C.Stop
232232parsePiecesSink BackEnd{initialize=initialize',append=append',close=close'}
233233 bound True = do
@@ -299,7 +299,7 @@ findBound b bs = go [0..S.length bs - 1]
299299sinkTillBound :: S.ByteString
300300 -> (x -> S.ByteString -> IO x)
301301 -> x
302− -> C.Sink S.ByteString IO (x, Bool)
302+ -> C.Sink S.ByteString (C.ResourceT IO) (x, Bool)
303303sinkTillBound bound iter seed0 = C.sinkState
304304 (id, seed0)
305305 push
wai-extra/wai-extra.cabal+5−5
@@ -1,5 +1,5 @@
11Name: wai-extra
2−Version: 1.1.0.1
2+Version: 1.2.0
33Synopsis: Provides some basic WAI handlers and middleware.
44Description: The goal here is to provide common features without many dependencies.
55License: BSD3
@@ -22,7 +22,7 @@ extra-source-files:
2222Library
2323 Build-Depends: base >= 4 && < 5
2424 , bytestring >= 0.9.1.4 && < 0.10
25− , wai >= 1.1 && < 1.2
25+ , wai >= 1.2 && < 1.3
2626 , old-locale >= 1.0.0.2 && < 1.1
2727 , time >= 1.1.4
2828 , network >= 2.2.1.5 && < 2.4
@@ -34,9 +34,9 @@ Library
3434 , case-insensitive >= 0.2
3535 , data-default >= 0.3 && < 0.4
3636 , fast-logger >= 0.0.2
37− , conduit >= 0.2 && < 0.3
38− , zlib-conduit >= 0.2 && < 0.3
39− , blaze-builder-conduit >= 0.2 && < 0.3
37+ , conduit >= 0.3 && < 0.4
38+ , zlib-conduit >= 0.3 && < 0.4
39+ , blaze-builder-conduit >= 0.3 && < 0.4
4040 , ansi-terminal
4141
4242 Exposed-modules: Network.Wai.Handler.CGI
wai-frontend-monadcgi/wai-frontend-monadcgi.cabal+2−2
@@ -1,5 +1,5 @@
11name: wai-frontend-monadcgi
2−version: 1.1.0
2+version: 1.2.0
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -20,7 +20,7 @@ library
2020 , http-types
2121 , transformers
2222 , case-insensitive
23− , wai >= 1.1 && < 1.2
23+ , wai >= 1.2 && < 1.3
2424 exposed-modules: Network.Wai.Frontend.MonadCGI
2525 ghc-options: -Wall
2626
wai-handler-devel/wai-handler-devel.cabal+4−4
@@ -1,5 +1,5 @@
11Name: wai-handler-devel
2−Version: 1.1.0
2+Version: 1.2.0
33Synopsis: WAI server that automatically reloads code after modification.
44Description: This handler automatically reloads your source code upon any changes. It works by using the hint package, essentially embedding GHC inside the handler. The handler (both the executable and library) takes three arguments: the port to listen on, the module name containing the application function, and the name of the function.
55 .
@@ -22,10 +22,10 @@ Source-repository head
2222
2323Library
2424 Build-Depends: base >= 4 && < 5
25− , wai >= 1.1 && < 1.2
26− , wai-extra >= 1.1 && < 1.2
25+ , wai >= 1.2 && < 1.3
26+ , wai-extra >= 1.2 && < 1.3
2727 , http-types >= 0.6 && < 0.7
28− , warp >= 1.1 && < 1.2
28+ , warp >= 1.2 && < 1.3
2929 , directory >= 1.0.1 && < 1.2
3030 , network >= 2.2.1.5 && < 2.4
3131 , bytestring >= 0.9.1.4 && < 0.10
wai-handler-fastcgi/wai-handler-fastcgi.cabal+3−3
@@ -1,5 +1,5 @@
11name: wai-handler-fastcgi
2−version: 1.1.0
2+version: 1.2.0
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -15,8 +15,8 @@ description: Calls out to the libfcgi C library.
1515
1616library
1717 build-depends: base >= 4 && < 5
18− , wai >= 1.1 && < 1.2
19− , wai-extra >= 1.1 && < 1.2
18+ , wai >= 1.2 && < 1.3
19+ , wai-extra >= 1.2 && < 1.3
2020 , bytestring >= 0.9.1.4 && < 0.10
2121 exposed-modules: Network.Wai.Handler.FastCGI
2222 ghc-options: -Wall
wai-handler-launch/Network/Wai/Handler/Launch.hs+1−1
@@ -60,7 +60,7 @@ ping var app req
6060toInsert :: S.ByteString
6161toInsert = "<script>setInterval(function(){var x;if(window.XMLHttpRequest){x=new XMLHttpRequest();}else{x=new ActiveXObject(\"Microsoft.XMLHTTP\");}x.open(\"GET\",\"/_ping\",false);x.send();},60000)</script>"
6262
63−insideHead :: C.Conduit (C.Flush S.ByteString) IO (C.Flush S.ByteString)
63+insideHead :: C.Conduit (C.Flush S.ByteString) (C.ResourceT IO) (C.Flush S.ByteString)
6464insideHead =
6565 C.conduitState (Just (S.empty, whole)) push' close
6666 where
wai-handler-launch/wai-handler-launch.cabal+6−6
@@ -1,5 +1,5 @@
11Name: wai-handler-launch
2−Version: 1.1.0.1
2+Version: 1.2.0
33Synopsis: Launch a web app in the default browser.
44Description: This handles cross-platform launching and inserts Javascript code to ping the server. When the server no longer receives pings, it shuts down.
55License: BSD3
@@ -13,15 +13,15 @@ Cabal-version: >=1.2
1313Library
1414 Exposed-modules: Network.Wai.Handler.Launch
1515 build-depends: base >= 4 && < 5
16− , wai >= 1.1 && < 1.2
17− , warp >= 1.1 && < 1.2
16+ , wai >= 1.2 && < 1.3
17+ , warp >= 1.2 && < 1.3
1818 , http-types >= 0.6 && < 0.7
1919 , transformers >= 0.2.2 && < 0.3
2020 , bytestring >= 0.9.1.4 && < 0.10
2121 , blaze-builder >= 0.2.1.4 && < 0.4
22− , conduit >= 0.2 && < 0.3
23− , blaze-builder-conduit >= 0.2 && < 0.3
24− , zlib-conduit >= 0.2 && < 0.3
22+ , conduit >= 0.3 && < 0.4
23+ , blaze-builder-conduit >= 0.3 && < 0.4
24+ , zlib-conduit >= 0.3 && < 0.4
2525
2626 if os(windows)
2727 c-sources: windows.c
wai-handler-scgi/wai-handler-scgi.cabal+3−3
@@ -1,5 +1,5 @@
11name: wai-handler-scgi
2−version: 1.1.0
2+version: 1.2.0
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -14,8 +14,8 @@ description: Wai handler to SCGI
1414
1515library
1616 build-depends: base >= 4 && < 5
17− , wai >= 1.1 && < 1.2
18− , wai-extra >= 1.1 && < 1.2
17+ , wai >= 1.2 && < 1.3
18+ , wai-extra >= 1.2 && < 1.3
1919 , bytestring >= 0.9.1.4 && < 0.10
2020 exposed-modules: Network.Wai.Handler.SCGI
2121 ghc-options: -Wall
wai-handler-webkit/wai-handler-webkit.cabal+3−3
@@ -1,5 +1,5 @@
11name: wai-handler-webkit
2−version: 1.1.0
2+version: 1.2.0
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -16,8 +16,8 @@ homepage: http://www.yesodweb.com/book/wai
1616
1717library
1818 build-depends: base >= 4 && < 5
19− , wai >= 1.1 && < 1.2
20− , warp >= 1.1 && < 1.2
19+ , wai >= 1.2 && < 1.3
20+ , warp >= 1.2 && < 1.3
2121 ghc-options: -Wall
2222 exposed-modules: Network.Wai.Handler.Webkit
2323 c-sources: webkit.cpp
wai-test/wai-test.cabal+4−4
@@ -1,5 +1,5 @@
11name: wai-test
2−version: 1.1.1
2+version: 1.2.0
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -14,14 +14,14 @@ description: Unit test framework (built on HUnit) for WAI applications.
1414
1515library
1616 build-depends: base >= 4 && < 5
17− , wai >= 1.1 && < 1.2
17+ , wai >= 1.2 && < 1.3
1818 , bytestring >= 0.9.1.4 && < 0.10
1919 , text >= 0.7 && < 0.12
2020 , blaze-builder >= 0.2.1.4 && < 0.4
2121 , transformers >= 0.2.2 && < 0.3
2222 , containers >= 0.2 && < 0.5
23− , conduit >= 0.2
24− , blaze-builder-conduit >= 0.2 && < 0.3
23+ , conduit >= 0.3 && < 0.4
24+ , blaze-builder-conduit >= 0.3 && < 0.4
2525 , cookie >= 0.2 && < 0.5
2626 , HUnit >= 1.2 && < 1.3
2727 , http-types >= 0.6 && < 0.7
wai-websockets/Network/Wai/Handler/WebSockets.hs+3−3
@@ -19,7 +19,7 @@ import Network.Wai.Handler.Warp (Connection (..))
1919intercept :: WS.Protocol p
2020 => (WS.Request -> WS.WebSockets p ())
2121 -> Request
22− -> Maybe (C.BufferedSource IO ByteString -> Connection -> C.ResourceT IO ())
22+ -> Maybe (C.BufferedSource (C.ResourceT IO) ByteString -> Connection -> C.ResourceT IO ())
2323intercept = interceptWith WS.defaultWebSocketsOptions
2424
2525-- | Variation of 'intercept' which allows custom options.
@@ -27,7 +27,7 @@ interceptWith :: WS.Protocol p
2727 => WS.WebSocketsOptions
2828 -> (WS.Request -> WS.WebSockets p ())
2929 -> Request
30− -> Maybe (C.BufferedSource IO ByteString -> Connection -> C.ResourceT IO ())
30+ -> Maybe (C.BufferedSource (C.ResourceT IO) ByteString -> Connection -> C.ResourceT IO ())
3131interceptWith opts app req = case lookup "upgrade" $ requestHeaders req of
3232 Just s
3333 | S.map toLower s == "websocket" -> Just $ runWebSockets opts req' app
@@ -41,7 +41,7 @@ runWebSockets :: WS.Protocol p
4141 => WS.WebSocketsOptions
4242 -> WS.RequestHttpPart
4343 -> (WS.Request -> WS.WebSockets p ())
44− -> C.BufferedSource IO ByteString
44+ -> C.BufferedSource (C.ResourceT IO) ByteString
4545 -> Connection
4646 -> C.ResourceT IO ()
4747runWebSockets opts req app source conn = do
wai-websockets/wai-websockets.cabal+3−3
@@ -1,5 +1,5 @@
11Name: wai-websockets
2−Version: 1.1.0
2+Version: 1.2.0
33Synopsis: Provide a bridge betweeen WAI and the websockets package.
44License: BSD3
55License-file: LICENSE
@@ -20,8 +20,8 @@ Library
2020 Build-Depends: base >= 3 && < 5
2121 , bytestring >= 0.9.1.4 && < 0.10
2222 , conduit >= 0.2
23− , wai >= 1.1 && < 1.2
24− , warp >= 1.1 && < 1.2
23+ , wai >= 1.2 && < 1.3
24+ , warp >= 1.2 && < 1.3
2525 , enumerator >= 0.4.8 && < 0.5
2626 , network-enumerator >= 0.1.2 && < 0.2
2727 , blaze-builder >= 0.2.1.4 && < 0.4
wai/Network/Wai.hs+5−6
@@ -51,7 +51,6 @@ module Network.Wai
5151import qualified Data.ByteString as B
5252import qualified Data.ByteString.Lazy as L
5353import Data.Typeable (Typeable)
54−import Control.Monad.Trans.Resource (ResourceT)
5554import qualified Data.Conduit as C
5655import qualified Data.Conduit.List as CL
5756import qualified Data.Conduit.Binary as CB
@@ -96,7 +95,7 @@ data Request = Request
9695 , pathInfo :: [Text]
9796 -- | Parsed query string information
9897 , queryString :: H.Query
99− , requestBody :: C.Source IO B.ByteString
98+ , requestBody :: C.Source (C.ResourceT IO) B.ByteString
10099 -- | A location for arbitrary data to be shared by applications and middleware.
101100 , vault :: Vault
102101 }
@@ -128,7 +127,7 @@ data Request = Request
128127data Response
129128 = ResponseFile H.Status H.ResponseHeaders FilePath (Maybe FilePart)
130129 | ResponseBuilder H.Status H.ResponseHeaders Builder
131− | ResponseSource H.Status H.ResponseHeaders (C.Source IO (C.Flush Builder))
130+ | ResponseSource H.Status H.ResponseHeaders (C.Source (C.ResourceT IO) (C.Flush Builder))
132131 deriving Typeable
133132
134133responseStatus :: Response -> H.Status
@@ -143,7 +142,7 @@ data FilePart = FilePart
143142 , filePartByteCount :: Integer
144143 } deriving Show
145144
146−responseSource :: Response -> (H.Status, H.ResponseHeaders, C.Source IO (C.Flush Builder))
145+responseSource :: Response -> (H.Status, H.ResponseHeaders, C.Source (C.ResourceT IO) (C.Flush Builder))
147146responseSource (ResponseSource s h b) = (s, h, b)
148147responseSource (ResponseFile s h fp (Just part)) =
149148 (s, h, sourceFilePart part fp C.$= CL.map (C.Chunk . fromByteString))
@@ -152,14 +151,14 @@ responseSource (ResponseFile s h fp Nothing) =
152151responseSource (ResponseBuilder s h b) =
153152 (s, h, CL.sourceList [C.Chunk b])
154153
155−sourceFilePart :: FilePart -> FilePath -> C.Source IO B.ByteString
154+sourceFilePart :: C.MonadResource m => FilePart -> FilePath -> C.Source m B.ByteString
156155sourceFilePart (FilePart offset count) fp =
157156 CB.sourceFileRange fp (Just offset) (Just count)
158157
159158responseLBS :: H.Status -> H.ResponseHeaders -> L.ByteString -> Response
160159responseLBS s h = ResponseBuilder s h . fromLazyByteString
161160
162−type Application = Request -> ResourceT IO Response
161+type Application = Request -> C.ResourceT IO Response
163162
164163-- | Middleware is a component that sits between the server and application. It
165164-- can do such tasks as GZIP encoding or response caching. What follows is the
wai/wai.cabal+2−2
@@ -1,5 +1,5 @@
11Name: wai
2−Version: 1.1.0.1
2+Version: 1.2.0
33Synopsis: Web Application Interface.
44Description: Provides a common protocol for communication between web applications and web servers.
55License: BSD3
@@ -20,7 +20,7 @@ Library
2020 Build-Depends: base >= 4 && < 5
2121 , bytestring >= 0.9.1.4 && < 0.10
2222 , blaze-builder >= 0.2.1.4 && < 0.4
23− , conduit >= 0.2 && < 0.3
23+ , conduit >= 0.3 && < 0.4
2424 , network >= 2.2.1.5 && < 2.4
2525 , http-types >= 0.6 && < 0.7
2626 , text >= 0.7 && < 0.12
warp-static/warp-static.cabal+4−4
@@ -1,5 +1,5 @@
11Name: warp-static
2−Version: 1.1.0.1
2+Version: 1.2.0
33Synopsis: Static file server based on Warp and wai-app-static
44Homepage: http://github.com/yesodweb/wai
55License: BSD3
@@ -15,9 +15,9 @@ Description: Serve up static files by running the warp executable. Based
1515Executable warp
1616 Main-is: warp.hs
1717 Build-depends: base >= 4 && < 5
18− , warp >= 1.1 && < 1.2
19− , wai-app-static >= 1.1.2 && < 1.2
20− , wai-extra >= 1.1 && < 1.2
18+ , warp >= 1.2 && < 1.3
19+ , wai-app-static >= 1.2 && < 1.3
20+ , wai-extra >= 1.2 && < 1.3
2121 , cmdargs >= 0.6.7
2222 , directory >= 1.0
2323 , containers >= 0.2 && < 0.5
warp-tls/warp-tls.cabal+4−4
@@ -1,5 +1,5 @@
11Name: warp-tls
2−Version: 1.1.1
2+Version: 1.2.0
33Synopsis: SSL support for Warp via the TLS package
44License: BSD3
55License-file: LICENSE
@@ -15,10 +15,10 @@ Description: SSL support for Warp via the TLS package
1515Library
1616 Build-Depends: base >= 4 && < 5
1717 , bytestring >= 0.9 && < 0.10
18− , wai >= 1.1 && < 1.2
19− , warp >= 1.1 && < 1.2
18+ , wai >= 1.2 && < 1.3
19+ , warp >= 1.2 && < 1.3
2020 , transformers >= 0.2 && < 0.3
21− , conduit >= 0.2
21+ , conduit >= 0.3 && < 0.4
2222 , certificate >= 1.1 && < 1.2
2323 , cryptocipher >= 0.3 && < 0.4
2424 , tls-extra >= 0.4.3 && < 0.5
warp/Network/Wai/Handler/Warp.hs+8−8
@@ -88,7 +88,7 @@ import Data.Maybe (fromMaybe, isJust)
8888
8989import Data.Typeable (Typeable)
9090
91−import Control.Monad.Trans.Resource (ResourceT, runResourceT)
91+import Data.Conduit (ResourceT, runResourceT)
9292import qualified Data.Conduit as C
9393import qualified Data.Conduit.List as CL
9494import Data.Conduit.Blaze (builderToByteString)
@@ -294,7 +294,7 @@ serveConnection settings th onException port app conn remoteHost' =
294294 intercept fromClient conn
295295
296296parseRequest :: Connection -> Port -> SockAddr
297− -> C.BufferedSource IO S.ByteString
297+ -> C.BufferedSource (ResourceT IO) S.ByteString
298298 -> ResourceT IO Request
299299parseRequest conn port remoteHost' src = do
300300 headers' <- src C.$$ takeHeaders
@@ -333,7 +333,7 @@ parseRequest' :: Connection
333333 -> Port
334334 -> [ByteString]
335335 -> SockAddr
336− -> C.BufferedSource IO S.ByteString
336+ -> C.BufferedSource (ResourceT IO) S.ByteString
337337 -> ResourceT IO Request
338338parseRequest' _ _ [] _ _ = throwIO $ NotEnoughLines []
339339parseRequest' conn port (firstLine:otherLines) remoteHost' src = do
@@ -577,7 +577,7 @@ sendResponse th req conn r = sendResponse' r
577577 -- FIXME perhaps alloca a buffer per thread and reuse that in all
578578 -- functions below. Should lessen greatly the GC burden (I hope)
579579 needsChunked' = needsChunked hs
580− chunk :: C.Conduit Builder IO Builder
580+ chunk :: C.Conduit Builder (ResourceT IO) Builder
581581 chunk = C.Conduit
582582 { C.conduitPush = push
583583 , C.conduitClose = close
@@ -596,7 +596,7 @@ parseHeaderNoAttr s =
596596 else rest
597597 in (CI.mk k, rest')
598598
599−connSource :: Connection -> T.Handle -> C.Source IO ByteString
599+connSource :: Connection -> T.Handle -> C.Source (ResourceT IO) ByteString
600600connSource Connection { connRecv = recv } th =
601601 src
602602 where
@@ -612,7 +612,7 @@ connSource Connection { connRecv = recv } th =
612612 }
613613
614614-- | Use 'connSendAll' to send this data while respecting timeout rules.
615−connSink :: Connection -> T.Handle -> C.Sink B.ByteString IO ()
615+connSink :: Connection -> T.Handle -> C.Sink B.ByteString (ResourceT IO) ()
616616connSink Connection { connSendAll = send } th =
617617 C.SinkData push close
618618 where
@@ -642,7 +642,7 @@ data Settings = Settings
642642 , settingsHost :: HostPreference -- ^ Default value: HostIPv4
643643 , settingsOnException :: SomeException -> IO () -- ^ What to do with exceptions thrown by either the application or server. Default: ignore server-generated exceptions (see 'InvalidRequest') and print application-generated applications to stderr.
644644 , settingsTimeout :: Int -- ^ Timeout value in seconds. Default value: 30
645− , settingsIntercept :: Request -> Maybe (C.BufferedSource IO S.ByteString -> Connection -> ResourceT IO ())
645+ , settingsIntercept :: Request -> Maybe (C.BufferedSource (ResourceT IO) S.ByteString -> Connection -> ResourceT IO ())
646646 , settingsManager :: Maybe Manager -- ^ Use an existing timeout manager instead of spawning a new one. If used, 'settingsTimeout' is ignored. Default is 'Nothing'
647647 }
648648
@@ -708,7 +708,7 @@ data THStatus = THStatus
708708 BSEndoList -- previously parsed lines
709709 BSEndo -- bytestrings to be prepended
710710
711−takeHeaders :: C.Sink ByteString IO [ByteString]
711+takeHeaders :: C.Sink ByteString (ResourceT IO) [ByteString]
712712takeHeaders =
713713 C.sinkState (THStatus 0 id id) takeHeadersPush close
714714 where
warp/warp.cabal+4−4
@@ -1,5 +1,5 @@
11Name: warp
2−Version: 1.1.0.1
2+Version: 1.2.0
33Synopsis: A fast, light-weight web server for WAI applications.
44License: BSD3
55License-file: LICENSE
@@ -19,10 +19,10 @@ flag network-bytestring
1919Library
2020 Build-Depends: base >= 3 && < 5
2121 , bytestring >= 0.9.1.4 && < 0.10
22− , wai >= 1.1 && < 1.2
22+ , wai >= 1.2 && < 1.3
2323 , transformers >= 0.2.2 && < 0.3
24− , conduit >= 0.2
25− , blaze-builder-conduit >= 0.2 && < 0.3
24+ , conduit >= 0.3 && < 0.4
25+ , blaze-builder-conduit >= 0.3 && < 0.4
2626 , lifted-base >= 0.1 && < 0.2
2727 , blaze-builder >= 0.2.1.4 && < 0.4
2828 , simple-sendfile >= 0.1 && < 0.3