diff -Nru haskell-wai-0.4.2/debian/changelog haskell-wai-1.1.0.1/debian/changelog --- haskell-wai-0.4.2/debian/changelog 2011-09-15 04:11:04.000000000 +0000 +++ haskell-wai-1.1.0.1/debian/changelog 2012-02-27 00:35:19.000000000 +0000 @@ -1,3 +1,21 @@ +haskell-wai (1.1.0.1-1) unstable; urgency=low + + * New upstream version. + + -- Clint Adams Sun, 26 Feb 2012 19:35:10 -0500 + +haskell-wai (1.1.0-1) unstable; urgency=low + + * New upstream version. + + -- Clint Adams Fri, 10 Feb 2012 12:24:20 -0500 + +haskell-wai (1.0.0-1) unstable; urgency=low + + * New upstream version. + + -- Clint Adams Sat, 28 Jan 2012 10:52:40 -0500 + haskell-wai (0.4.2-1) unstable; urgency=low * New upstream version. diff -Nru haskell-wai-0.4.2/debian/control haskell-wai-1.1.0.1/debian/control --- haskell-wai-0.4.2/debian/control 2011-09-15 04:10:49.000000000 +0000 +++ haskell-wai-1.1.0.1/debian/control 2012-02-27 00:37:11.000000000 +0000 @@ -8,26 +8,36 @@ , haskell-devscripts (>= 0.8) , ghc , ghc-prof + , libghc-blaze-builder-dev (>> 0.2.1.4) , libghc-blaze-builder-dev (<< 0.4) , libghc-blaze-builder-prof - , libghc-enumerator-dev (<< 0.5) - , libghc-enumerator-prof + , libghc-conduit-dev (>> 0.2) + , libghc-conduit-dev (<< 0.3) + , libghc-conduit-prof + , libghc-http-types-dev (>> 0.6) , libghc-http-types-dev (<< 0.7) , libghc-http-types-prof + , libghc-network-dev (>> 2.2.1.5) , libghc-network-dev (<< 2.4) , libghc-network-prof - , libghc-text-dev (<< 1.0) + , libghc-text-dev (>> 0.7) + , libghc-text-dev (<< 0.12) , libghc-text-prof + , libghc-transformers-dev (>> 0.2.2) , libghc-transformers-dev (<< 0.3) , libghc-transformers-prof + , libghc-vault-dev (>> 0.1) + , libghc-vault-dev (<< 0.2) + , libghc-vault-prof Build-Depends-Indep: ghc-doc , libghc-blaze-builder-doc - , libghc-enumerator-doc + , libghc-conduit-doc , libghc-http-types-doc , libghc-network-doc , libghc-text-doc , libghc-transformers-doc -Standards-Version: 3.9.2 + , libghc-vault-doc +Standards-Version: 3.9.3 Homepage: http://hackage.haskell.org/package/wai Vcs-Darcs: http://darcs.debian.org/pkg-haskell/haskell-wai Vcs-Browser: http://darcs.debian.org/cgi-bin/darcsweb.cgi?r=pkg-haskell/haskell-wai diff -Nru haskell-wai-0.4.2/Network/Wai.hs haskell-wai-1.1.0.1/Network/Wai.hs --- haskell-wai-0.4.2/Network/Wai.hs 2011-09-10 21:21:30.000000000 +0000 +++ haskell-wai-1.1.0.1/Network/Wai.hs 2012-02-24 11:18:36.000000000 +0000 @@ -39,27 +39,29 @@ ( -- * WAI interface Request (..) , Response (..) - , ResponseEnumerator - , responseEnumerator + , responseSource , Application , Middleware , FilePart (..) -- * Response body smart constructors , responseLBS + , responseStatus ) where import qualified Data.ByteString as B import qualified Data.ByteString.Lazy as L import Data.Typeable (Typeable) -import Data.Enumerator (Enumerator, Iteratee (..), ($$), joinI, run_) -import qualified Data.Enumerator as E -import qualified Data.Enumerator.List as EL -import Data.Enumerator.Binary (enumFile, enumFileRange) -import Blaze.ByteString.Builder (Builder, fromByteString, fromLazyByteString) +import Control.Monad.Trans.Resource (ResourceT) +import qualified Data.Conduit as C +import qualified Data.Conduit.List as CL +import qualified Data.Conduit.Binary as CB +import Blaze.ByteString.Builder (Builder, fromLazyByteString) import Network.Socket (SockAddr) import qualified Network.HTTP.Types as H import Data.Text (Text) import Data.ByteString.Lazy.Char8 () -- makes it easier to use responseLBS +import Blaze.ByteString.Builder (fromByteString) +import Data.Vault (Vault) -- | Information on the request sent by the client. This abstracts away the -- details of the underlying implementation. @@ -94,40 +96,70 @@ , pathInfo :: [Text] -- | Parsed query string information , queryString :: H.Query + , requestBody :: C.Source IO B.ByteString + -- | A location for arbitrary data to be shared by applications and middleware. + , vault :: Vault } - deriving (Show, Typeable) + deriving (Typeable) +-- | +-- +-- Some questions and answers about the usage of 'Builder' here: +-- +-- Q1. Shouldn't it be at the user's discretion to use Builders internally and +-- then create a stream of ByteStrings? +-- +-- A1. That would be less efficient, as we wouldn't get cheap concatenation +-- with the response headers. +-- +-- Q2. Isn't it really inefficient to convert from ByteString to Builder, and +-- then right back to ByteString? +-- +-- A2. No. If the ByteStrings are small, then they will be copied into a larger +-- buffer, which should be a performance gain overall (less system calls). If +-- they are already large, then blaze-builder uses an InsertByteString +-- instruction to avoid copying. +-- +-- Q3. Doesn't this prevent us from creating comet-style servers, since data +-- will be cached? +-- +-- A3. You can force blaze-builder to output a ByteString before it is an +-- optimal size by sending a flush command. data Response = ResponseFile H.Status H.ResponseHeaders FilePath (Maybe FilePart) | ResponseBuilder H.Status H.ResponseHeaders Builder - | ResponseEnumerator (forall a. ResponseEnumerator a) + | ResponseSource H.Status H.ResponseHeaders (C.Source IO (C.Flush Builder)) deriving Typeable +responseStatus :: Response -> H.Status +responseStatus rsp = + case rsp of + ResponseFile s _ _ _ -> s + ResponseBuilder s _ _ -> s + ResponseSource s _ _ -> s + data FilePart = FilePart { filePartOffset :: Integer , filePartByteCount :: Integer } deriving Show -type ResponseEnumerator a = - (H.Status -> H.ResponseHeaders -> Iteratee Builder IO a) -> IO a - -responseEnumerator :: Response -> ResponseEnumerator a -responseEnumerator (ResponseEnumerator e) f = e f -responseEnumerator (ResponseFile s h fp mpart) f = - run_ $ (maybe enumFile enumFilePart) mpart fp $$ joinI - $ EL.map fromByteString $$ f s h -responseEnumerator (ResponseBuilder s h b) f = run_ $ do - E.yield () $ E.Chunks [b] - f s h - -enumFilePart :: FilePart -> FilePath -> Enumerator B.ByteString IO a -enumFilePart (FilePart offset count) fp = - enumFileRange fp (Just offset) (Just count) +responseSource :: Response -> (H.Status, H.ResponseHeaders, C.Source IO (C.Flush Builder)) +responseSource (ResponseSource s h b) = (s, h, b) +responseSource (ResponseFile s h fp (Just part)) = + (s, h, sourceFilePart part fp C.$= CL.map (C.Chunk . fromByteString)) +responseSource (ResponseFile s h fp Nothing) = + (s, h, CB.sourceFile fp C.$= CL.map (C.Chunk . fromByteString)) +responseSource (ResponseBuilder s h b) = + (s, h, CL.sourceList [C.Chunk b]) + +sourceFilePart :: FilePart -> FilePath -> C.Source IO B.ByteString +sourceFilePart (FilePart offset count) fp = + CB.sourceFileRange fp (Just offset) (Just count) responseLBS :: H.Status -> H.ResponseHeaders -> L.ByteString -> Response responseLBS s h = ResponseBuilder s h . fromLazyByteString -type Application = Request -> Iteratee B.ByteString IO Response +type Application = Request -> ResourceT IO Response -- | Middleware is a component that sits between the server and application. It -- can do such tasks as GZIP encoding or response caching. What follows is the diff -Nru haskell-wai-0.4.2/wai.cabal haskell-wai-1.1.0.1/wai.cabal --- haskell-wai-0.4.2/wai.cabal 2011-09-10 21:21:30.000000000 +0000 +++ haskell-wai-1.1.0.1/wai.cabal 2012-02-24 11:18:36.000000000 +0000 @@ -1,5 +1,5 @@ Name: wai -Version: 0.4.2 +Version: 1.1.0.1 Synopsis: Web Application Interface. Description: Provides a common protocol for communication between web applications and web servers. License: BSD3 @@ -17,13 +17,14 @@ location: git://github.com/yesodweb/wai.git Library - Build-Depends: base >= 3 && < 5 - , bytestring >= 0.9 && < 0.10 - , blaze-builder >= 0.2 && < 0.4 - , enumerator >= 0.4.8 && < 0.5 - , network >= 2.2 && < 2.4 - , http-types >= 0.6 && < 0.7 - , text >= 0.5 && < 1.0 - , transformers >= 0.2 && < 0.3 + Build-Depends: base >= 4 && < 5 + , bytestring >= 0.9.1.4 && < 0.10 + , blaze-builder >= 0.2.1.4 && < 0.4 + , conduit >= 0.2 && < 0.3 + , network >= 2.2.1.5 && < 2.4 + , http-types >= 0.6 && < 0.7 + , text >= 0.7 && < 0.12 + , transformers >= 0.2.2 && < 0.3 + , vault >= 0.1 && < 0.2 Exposed-modules: Network.Wai ghc-options: -Wall