wai-conduit-3.0.0.4/Network/0000755000000000000000000000000012620000372013706 5ustar0000000000000000wai-conduit-3.0.0.4/Network/Wai/0000755000000000000000000000000013253726531014445 5ustar0000000000000000wai-conduit-3.0.0.4/Network/Wai/Conduit.hs0000644000000000000000000000341713253726531016413 0ustar0000000000000000-- | A light-weight wrapper around @Network.Wai@ to provide easy conduit support. module Network.Wai.Conduit ( -- * Request body sourceRequestBody -- * Response body , responseSource , responseRawSource -- * Re-export , module Network.Wai ) where import Network.Wai import Data.Conduit import Control.Monad.IO.Class (MonadIO, liftIO) import Data.ByteString (ByteString) import qualified Data.ByteString as S import Control.Monad (unless) import Network.HTTP.Types import Data.ByteString.Builder (Builder) import Data.IORef import qualified Data.Conduit.List as CL -- | Stream the request body. -- -- Since 3.0.0 sourceRequestBody :: MonadIO m => Request -> Source m ByteString sourceRequestBody req = loop where go = liftIO (requestBody req) loop = do bs <- go unless (S.null bs) $ do yield bs loop -- | Create an HTTP response out of a @Source@. -- -- Since 3.0.0 responseSource :: Status -> ResponseHeaders -> Source IO (Flush Builder) -> Response responseSource s hs src = responseStream s hs $ \send flush -> src $$ CL.mapM_ (\mbuilder -> case mbuilder of Chunk b -> send b Flush -> flush) -- | Create a raw response using a @Source@ and @Sink@ to represent the input -- and output, respectively. -- -- Since 3.0.0 responseRawSource :: (MonadIO m, MonadIO n) => (Source m ByteString -> Sink ByteString n () -> IO ()) -> Response -> Response responseRawSource app = responseRaw app' where app' recv send = app src sink where src = do bs <- liftIO recv unless (S.null bs) $ do yield bs src sink = CL.mapM_ $ liftIO . send wai-conduit-3.0.0.4/LICENSE0000644000000000000000000000204312620000372013261 0ustar0000000000000000Copyright (c) 2014 Michael Snoyman Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. wai-conduit-3.0.0.4/Setup.hs0000644000000000000000000000005612620000372013712 0ustar0000000000000000import Distribution.Simple main = defaultMain wai-conduit-3.0.0.4/wai-conduit.cabal0000644000000000000000000000156713253726531015514 0ustar0000000000000000name: wai-conduit version: 3.0.0.4 synopsis: conduit wrappers for WAI description: API docs and the README are available at . homepage: https://github.com/yesodweb/wai license: MIT license-file: LICENSE author: Michael Snoyman maintainer: michael@snoyman.com category: Web, Conduit build-type: Simple cabal-version: >=1.10 extra-source-files: README.md ChangeLog.md library exposed-modules: Network.Wai.Conduit build-depends: base >= 4 && < 5 , wai >= 3.0 && < 3.3 , conduit , transformers , bytestring >= 0.10.4 , http-types default-language: Haskell2010 wai-conduit-3.0.0.4/README.md0000644000000000000000000000023612620000372013535 0ustar0000000000000000## wai-conduit Since version 3.0.0, WAI has no built-in streaming data abstraction. This library provides similar functionality to what existed in WAI 2.x. wai-conduit-3.0.0.4/ChangeLog.md0000644000000000000000000000011613253726531014443 0ustar0000000000000000## 3.0.0.4 * Drop dependency on blaze-builder ## 3.0.0.3 * Support wai 3.2