on master help sign in
Flushing
commit675aeb8105851cf70dd4864b92011ba13f74ef0b authorMichael Snoyman <michael@snoyman.com> dateThu 26 Jan 2012, 07:09 (15 years ago) parente0eb6f2
26 files changed+100−83
package-list.sh+2−1 wai-app-static/wai-app-static.cabal+2−2 wai-eventsource/src/Main.hs+2−1 wai-eventsource/src/Network/Wai/EventSource.hs+8−5 wai-eventsource/wai-eventsource.cabal+3−3 wai-extra/Network/Wai/Handler/CGI.hs+5−4 wai-extra/Network/Wai/Middleware/Gzip.hs+5−6 wai-extra/Network/Wai/Middleware/Jsonp.hs+3−2 wai-extra/wai-extra.cabal+2−3 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+13−8 wai-handler-launch/wai-handler-launch.cabal+3−3 wai-handler-scgi/wai-handler-scgi.cabal+3−3 wai-handler-webkit/wai-handler-webkit.cabal+3−3 wai-test/Network/Wai/Test.hs+4−1 wai-test/wai-test.cabal+2−2 wai-websockets/Network/Wai/Handler/WebSockets.hs+7−7 wai-websockets/wai-websockets.cabal+3−2 wai/Network/Wai.hs+5−5 wai/wai.cabal+2−2 warp-static/warp-static.cabal+4−4 warp-tls/warp-tls.cabal+3−3 warp/Network/Wai/Handler/Warp.hs+5−2 warp/warp.cabal+2−2
package-list.sh+2−1
@@ -11,5 +11,6 @@ pkgs=( ./wai
1111 ./wai-handler-scgi
1212 ./wai-frontend-monadcgi
1313 ./warp-static
14+ ./wai-websockets
15+ ./wai-eventsource
1416 )
15− # ./wai-websockets
wai-app-static/wai-app-static.cabal+2−2
@@ -1,5 +1,5 @@
11name: wai-app-static
2−version: 1.0.0
2+version: 1.1.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.0 && < 1.1
27+ , wai >= 1.1 && < 1.2
2828 , bytestring >= 0.9.1.4 && < 0.10
2929 , http-types >= 0.6 && < 0.7
3030 , transformers >= 0.2.2 && < 0.3
wai-eventsource/src/Main.hs+2−1
@@ -5,6 +5,7 @@ import Control.Monad
55import Control.Concurrent (forkIO, threadDelay)
66import Control.Concurrent.Chan
77import Network.Wai.Handler.Warp (run)
8+import Network.Wai.Middleware.Gzip (gzip, def)
89import Network.Wai
910import Network.HTTP.Types (statusOK)
1011import Data.Time.Clock.POSIX
@@ -31,4 +32,4 @@ main :: IO ()
3132main = do
3233 chan <- newChan
3334 _ <- forkIO . source $ chan
34− run 8000 (app chan)
35+ run 8000 (gzip def $ app chan)
wai-eventsource/src/Network/Wai/EventSource.hs+8−5
@@ -23,10 +23,13 @@ eventSourceApp chan _ = do
2323res :: Chan ServerEvent -> Response
2424res chan = ResponseSource statusOK [("Content-Type", "text/event-stream")] $ resE chan
2525
26−resE :: Chan ServerEvent -> C.Source IO Builder
26+resE :: Chan ServerEvent -> C.Source IO (C.Flush Builder)
2727resE chan =
28− C.sourceIO ign (const ign) (const $ fmap (f . eventToBuilder) $ readChan chan)
28+ C.sourceState Nothing pull
2929 where
30− ign = return ()
31− f Nothing = C.Closed
32− f (Just b) = C.Open b
30+ pull Nothing = do
31+ x <- liftIO $ readChan chan
32+ return $ case eventToBuilder x of
33+ Nothing -> (Nothing, C.Closed)
34+ Just y -> (Just C.Flush, C.Open $ C.Chunk y)
35+ pull (Just x) = return (Nothing, C.Open x)
wai-eventsource/wai-eventsource.cabal+3−3
@@ -1,5 +1,5 @@
11Name: wai-eventsource
2−Version: 1.0.0
2+Version: 1.1.0
33Synopsis: WAI support for server-sent events
44Description: WAI support for server-sent events
55License: BSD3
@@ -19,8 +19,8 @@ Library
1919 , blaze-builder >= 0.3 && < 0.4
2020 , conduit
2121 , http-types >= 0.6 && < 0.7
22− , wai >= 1.0
23− , warp >= 1.0
22+ , wai >= 1.1
23+ , warp >= 1.1
2424 , transformers
2525
2626 ghc-options: -Wall
wai-extra/Network/Wai/Handler/CGI.hs+5−4
@@ -22,7 +22,7 @@ import qualified Data.String as String
2222import Data.Monoid (mconcat, mempty)
2323import Blaze.ByteString.Builder (fromByteString, toLazyByteString)
2424import Blaze.ByteString.Builder.Char8 (fromChar, fromString)
25−import Data.Conduit.Blaze (builderToByteString)
25+import Data.Conduit.Blaze (builderToByteStringFlush)
2626import Control.Monad.IO.Class (liftIO)
2727import Data.ByteString.Lazy.Internal (defaultChunkSize)
2828import System.IO (Handle)
@@ -117,7 +117,7 @@ runGeneric vars inputH outputH xsendfile app = do
117117 liftIO $ mapM_ outputH $ L.toChunks $ toLazyByteString $ sfBuilder s hs sf fp
118118 _ -> do
119119 let (s, hs, b) = responseSource res
120− src = CL.sourceList [headers s hs `mappend` fromChar '\n']
120+ src = CL.sourceList [C.Chunk $ headers s hs `mappend` fromChar '\n']
121121 `mappend` b
122122 src C.$$ builderSink
123123 where
@@ -142,10 +142,11 @@ runGeneric vars inputH outputH xsendfile app = do
142142 , fromByteString " not supported"
143143 ]
144144 bsSink = C.Sink $ return $ C.SinkData push (return ())
145− push bs = do
145+ push (C.Chunk bs) = do
146146 liftIO $ outputH bs
147147 return C.Processing
148− builderSink = builderToByteString C.=$ bsSink
148+ push C.Flush = return C.Processing
149+ builderSink = builderToByteStringFlush C.=$ bsSink
149150 fixHeaders h =
150151 case lookup "content-type" h of
151152 Nothing -> ("Content-Type", "text/html; charset=utf-8") : h
wai-extra/Network/Wai/Middleware/Gzip.hs+5−6
@@ -35,7 +35,7 @@ import qualified Data.Conduit as C
3535import qualified Data.Conduit.Zlib as CZ
3636import qualified Data.Conduit.Binary as CB
3737import qualified Data.Conduit.List as CL
38−import Data.Conduit.Blaze (builderToByteString)
38+import Data.Conduit.Blaze (builderToByteStringFlush)
3939import Blaze.ByteString.Builder (fromByteString)
4040import Control.Exception (try, SomeException)
4141
@@ -51,8 +51,7 @@ instance Default GzipSettings where
5151 def = GzipSettings GzipIgnore defaultCheckMime
5252
5353defaultCheckMime :: S.ByteString -> Bool
54−defaultCheckMime "text/event-stream" = False
55−defaultCheckMime bs = S8.isPrefixOf "text/" bs
54+defaultCheckMime = S8.isPrefixOf "text/"
5655
5756-- | Use gzip to compress the body of the response.
5857--
@@ -116,9 +115,9 @@ compressE set res =
116115 case lookup "content-type" hs of
117116 Just m | gzipCheckMime set m ->
118117 let hs' = fixHeaders hs
119− in ResponseSource s hs' $ b C.$= builderToByteString
120− C.$= CZ.gzip
121− C.$= CL.map fromByteString
118+ in ResponseSource s hs' $ b C.$= builderToByteStringFlush
119+ C.$= CZ.compressFlush 1 (CZ.WindowBits 31)
120+ C.$= CL.map (fmap fromByteString)
122121 _ -> res
123122 where
124123 (s, hs, b) = responseSource res
wai-extra/Network/Wai/Middleware/Jsonp.hs+3−2
@@ -24,6 +24,7 @@ import Data.Monoid (mappend)
2424import Control.Monad (join)
2525import Data.Maybe (fromMaybe)
2626import qualified Data.ByteString as S
27+import qualified Data.Conduit as C
2728import qualified Data.Conduit.List as CL
2829
2930-- | Wrap json responses in a jsonp callback.
@@ -79,9 +80,9 @@ jsonp app env = do
7980
8081 addCallback cb s hs b =
8182 return $ ResponseSource s hs $
82− CL.sourceList [copyByteString cb `mappend` fromChar '(']
83+ CL.sourceList [C.Chunk $ copyByteString cb `mappend` fromChar '(']
8384 `mappend` b
84− `mappend` CL.sourceList [fromChar ')']
85+ `mappend` CL.sourceList [C.Chunk $ fromChar ')']
8586
8687changeVal :: Eq a
8788 => a
wai-extra/wai-extra.cabal+2−3
@@ -22,12 +22,11 @@ extra-source-files:
2222Library
2323 Build-Depends: base >= 4 && < 5
2424 , bytestring >= 0.9.1.4 && < 0.10
25− , wai >= 1.0 && < 1.1
25+ , wai >= 1.1 && < 1.2
2626 , old-locale >= 1.0.0.2 && < 1.1
2727 , time >= 1.1.4
2828 , network >= 2.2.1.5 && < 2.4
2929 , directory >= 1.0.1 && < 1.2
30− , zlib-bindings >= 0.0 && < 0.1
3130 , transformers >= 0.2.2 && < 0.3
3231 , blaze-builder >= 0.2.1.4 && < 0.4
3332 , http-types >= 0.6 && < 0.7
@@ -36,7 +35,7 @@ Library
3635 , data-default >= 0.3 && < 0.4
3736 , fast-logger >= 0.0.1
3837 , conduit
39− , zlib-conduit >= 0.0.1
38+ , zlib-conduit >= 0.0.2
4039 , blaze-builder-conduit >= 0.0.1
4140
4241 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.0.0
2+version: 1.1.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.0 && < 1.1
23+ , wai >= 1.1 && < 1.2
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.0.0
2+Version: 1.1.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.0 && < 1.1
26− , wai-extra >= 1.0 && < 1.2
25+ , wai >= 1.1 && < 1.2
26+ , wai-extra >= 1.1 && < 1.2
2727 , http-types >= 0.6 && < 0.7
28− , warp >= 1.0 && < 1.1
28+ , warp >= 1.1 && < 1.2
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.0.0
2+version: 1.1.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.0 && < 1.1
19− , wai-extra >= 1.0 && < 1.2
18+ , wai >= 1.1 && < 1.2
19+ , wai-extra >= 1.1 && < 1.2
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+13−8
@@ -21,8 +21,8 @@ import Foreign.C.String
2121#else
2222import System.Cmd (rawSystem)
2323#endif
24−import Data.Conduit.Zlib (ungzip)
25−import Data.Conduit.Blaze (builderToByteString)
24+import Data.Conduit.Zlib (decompressFlush, WindowBits (WindowBits))
25+import Data.Conduit.Blaze (builderToByteStringFlush)
2626import qualified Data.Conduit as C
2727import qualified Data.Conduit.List as CL
2828
@@ -48,20 +48,25 @@ ping var app req
4848 let (s, hs, body) = responseSource res
4949 let (isEnc, headers') = fixHeaders id hs
5050 let headers'' = filter (\(x, _) -> x /= "content-length") headers'
51− let fixEnc src = if isEnc then src C.$= ungzip else src
51+ let fixEnc src =
52+ if isEnc then
53+ src C.$= decompressFlush (WindowBits 31)
54+ else src
5255 return $ ResponseSource s headers''
53− $ fixEnc (body C.$= builderToByteString)
56+ $ fixEnc (body C.$= builderToByteStringFlush)
5457 C.$= insideHead
55− C.$= CL.map fromByteString
58+ C.$= CL.map (fmap fromByteString)
5659
5760toInsert :: S.ByteString
5861toInsert = "<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>"
5962
60−insideHead :: C.Conduit S.ByteString IO S.ByteString
63+insideHead :: C.Conduit (C.Flush S.ByteString) IO (C.Flush S.ByteString)
6164insideHead =
62− C.conduitState (Just (S.empty, whole)) push close
65+ C.conduitState (Just (S.empty, whole)) push' close
6366 where
6467 whole = "<head>"
68+ push' state (C.Chunk x) = (fmap . fmap . fmap) C.Chunk (push state x)
69+ push' state C.Flush = return (state, C.Producing [C.Flush])
6570 push (Just (held, atFront)) x
6671 | atFront `S.isPrefixOf` x = do
6772 let y = S.drop (S.length atFront) x
@@ -79,7 +84,7 @@ insideHead =
7984 return (Just (held', atFront'), C.Producing [held, x'])
8085 push Nothing x = return (Nothing, C.Producing [x])
8186
82− close (Just (held, _)) = return [held, toInsert]
87+ close (Just (held, _)) = return [C.Chunk held, C.Chunk toInsert]
8388 close Nothing = return []
8489
8590getOverlap :: S.ByteString -> S.ByteString -> (S.ByteString, S.ByteString, S.ByteString)
wai-handler-launch/wai-handler-launch.cabal+3−3
@@ -1,5 +1,5 @@
11Name: wai-handler-launch
2−Version: 1.0.0
2+Version: 1.1.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,8 +13,8 @@ Cabal-version: >=1.2
1313Library
1414 Exposed-modules: Network.Wai.Handler.Launch
1515 build-depends: base >= 4 && < 5
16− , wai >= 1.0 && < 1.1
17− , warp >= 1.0 && < 1.1
16+ , wai >= 1.1 && < 1.2
17+ , warp >= 1.1 && < 1.2
1818 , http-types >= 0.6 && < 0.7
1919 , transformers >= 0.2.2 && < 0.3
2020 , bytestring >= 0.9.1.4 && < 0.10
wai-handler-scgi/wai-handler-scgi.cabal+3−3
@@ -1,5 +1,5 @@
11name: wai-handler-scgi
2−version: 1.0.0
2+version: 1.1.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.0 && < 1.1
18− , wai-extra >= 1.0 && < 1.2
17+ , wai >= 1.1 && < 1.2
18+ , wai-extra >= 1.1 && < 1.2
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.0.0
2+version: 1.1.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.0 && < 1.1
20− , warp >= 1.0 && < 1.1
19+ , wai >= 1.1 && < 1.2
20+ , warp >= 1.1 && < 1.2
2121 ghc-options: -Wall
2222 exposed-modules: Network.Wai.Handler.Webkit
2323 c-sources: webkit.cpp
wai-test/Network/Wai/Test.hs+4−1
@@ -27,6 +27,7 @@ import qualified Data.Map as Map
2727import Data.ByteString (ByteString)
2828import qualified Data.ByteString.Char8 as S8
2929import Data.Conduit.Blaze (builderToByteString)
30+import Blaze.ByteString.Builder (flush)
3031import qualified Data.ByteString.Lazy as L
3132import qualified Data.ByteString.Lazy.Char8 as L8
3233import qualified Network.HTTP.Types as H
@@ -90,10 +91,12 @@ srequest (SRequest req bod) = do
9091
9192runResponse :: Response -> C.ResourceT IO SResponse
9293runResponse res = do
93− bss <- body C.$= builderToByteString C.$$ CL.consume
94+ bss <- fmap toBuilder body C.$= builderToByteString C.$$ CL.consume
9495 return $ SResponse s h $ L.fromChunks bss
9596 where
9697 (s, h, body) = responseSource res
98+ toBuilder (C.Chunk builder) = builder
99+ toBuilder C.Flush = flush
97100
98101assertBool :: String -> Bool -> Session ()
99102assertBool s b = liftIO $ H.assertBool s b
wai-test/wai-test.cabal+2−2
@@ -1,5 +1,5 @@
11name: wai-test
2−version: 1.0.0
2+version: 1.1.0
33license: BSD3
44license-file: LICENSE
55author: Michael Snoyman <michael@snoyman.com>
@@ -14,7 +14,7 @@ description: Unit test framework (built on HUnit) for WAI applications.
1414
1515library
1616 build-depends: base >= 4 && < 5
17− , wai >= 1.0 && < 1.1
17+ , wai >= 1.1 && < 1.2
1818 , bytestring >= 0.9.1.4 && < 0.10
1919 , blaze-builder >= 0.2.1.4 && < 0.4
2020 , transformers >= 0.2.2 && < 0.3
wai-websockets/Network/Wai/Handler/WebSockets.hs+7−7
@@ -7,19 +7,19 @@ module Network.Wai.Handler.WebSockets
77import Control.Monad.IO.Class (liftIO)
88import Data.ByteString (ByteString)
99import Data.Char (toLower)
10−import Network.Socket (Socket)
1110import Network.Wai (Request, requestHeaders, rawPathInfo, requestHeaders)
1211import qualified Data.ByteString.Char8 as S
1312import qualified Data.Conduit as C
1413import qualified Data.Enumerator as E
14+import qualified Data.Enumerator.List as EL
1515import qualified Network.WebSockets as WS
16−import qualified Network.WebSockets.Internal as WS
16+import Network.Wai.Handler.Warp (Connection (..))
1717
1818-- | For use with 'settingsIntercept' from the Warp web server.
1919intercept :: WS.Protocol p
2020 => (WS.Request -> WS.WebSockets p ())
2121 -> Request
22− -> Maybe (C.BufferedSource IO ByteString -> Socket -> C.ResourceT IO ())
22+ -> Maybe (C.BufferedSource 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 -> Socket -> C.ResourceT IO ())
30+ -> Maybe (C.BufferedSource 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
@@ -42,13 +42,13 @@ runWebSockets :: WS.Protocol p
4242 -> WS.RequestHttpPart
4343 -> (WS.Request -> WS.WebSockets p ())
4444 -> C.BufferedSource IO ByteString
45− -> Socket
45+ -> Connection
4646 -> C.ResourceT IO ()
47−runWebSockets opts req app source sock = do
47+runWebSockets opts req app source conn = do
4848 step <- liftIO $ E.runIteratee $ WS.runWebSocketsWith opts req app send
4949 source C.$$ C.sinkState (E.returnI step) push close
5050 where
51− send = WS.iterSocket sock
51+ send = EL.mapM_ (connSendAll conn)
5252 close = const $ return ()
5353
5454 push iter bs = do
wai-websockets/wai-websockets.cabal+3−2
@@ -1,5 +1,5 @@
11Name: wai-websockets
2−Version: 1.0.0
2+Version: 1.1.0
33Synopsis: Provide a bridge betweeen WAI and the websockets package.
44License: BSD3
55License-file: LICENSE
@@ -20,7 +20,8 @@ Library
2020 Build-Depends: base >= 3 && < 5
2121 , bytestring >= 0.9.1.4 && < 0.10
2222 , conduit
23− , wai >= 1.0 && < 1.1
23+ , wai >= 1.1 && < 1.2
24+ , warp >= 1.1 && < 1.2
2425 , enumerator >= 0.4.8 && < 0.5
2526 , network-enumerator >= 0.1.2 && < 0.2
2627 , blaze-builder >= 0.2.1.4 && < 0.4
wai/Network/Wai.hs+5−5
@@ -127,7 +127,7 @@ data Request = Request
127127data Response
128128 = ResponseFile H.Status H.ResponseHeaders FilePath (Maybe FilePart)
129129 | ResponseBuilder H.Status H.ResponseHeaders Builder
130− | ResponseSource H.Status H.ResponseHeaders (C.Source IO Builder)
130+ | ResponseSource H.Status H.ResponseHeaders (C.Source IO (C.Flush Builder))
131131 deriving Typeable
132132
133133data FilePart = FilePart
@@ -135,14 +135,14 @@ data FilePart = FilePart
135135 , filePartByteCount :: Integer
136136 } deriving Show
137137
138−responseSource :: Response -> (H.Status, H.ResponseHeaders, C.Source IO Builder) -- FIXME re-analyze usage of Builder
138+responseSource :: Response -> (H.Status, H.ResponseHeaders, C.Source IO (C.Flush Builder))
139139responseSource (ResponseSource s h b) = (s, h, b)
140140responseSource (ResponseFile s h fp (Just part)) =
141− (s, h, sourceFilePart part fp C.$= CL.map fromByteString)
141+ (s, h, sourceFilePart part fp C.$= CL.map (C.Chunk . fromByteString))
142142responseSource (ResponseFile s h fp Nothing) =
143− (s, h, CB.sourceFile fp C.$= CL.map fromByteString)
143+ (s, h, CB.sourceFile fp C.$= CL.map (C.Chunk . fromByteString))
144144responseSource (ResponseBuilder s h b) =
145− (s, h, CL.sourceList [b])
145+ (s, h, CL.sourceList [C.Chunk b])
146146
147147sourceFilePart :: FilePart -> FilePath -> C.Source IO B.ByteString
148148sourceFilePart (FilePart offset count) fp =
wai/wai.cabal+2−2
@@ -1,5 +1,5 @@
11Name: wai
2−Version: 1.0.0
2+Version: 1.1.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.1
23+ , conduit >= 0.1.2
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.0.0
2+Version: 1.1.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.0 && < 1.1
19− , wai-app-static >= 1.0 && < 1.1
20− , wai-extra >= 1.0 && < 1.2
18+ , warp >= 1.1 && < 1.2
19+ , wai-app-static >= 1.1 && < 1.2
20+ , wai-extra >= 1.1 && < 1.2
2121 , cmdargs >= 0.6.7
2222 , directory >= 1.0
2323 , containers >= 0.2 && < 0.5
warp-tls/warp-tls.cabal+3−3
@@ -1,5 +1,5 @@
11Name: warp-tls
2−Version: 1.0.0
2+Version: 1.1.0
33Synopsis: SSL support for Warp via the TLS package
44License: BSD3
55License-file: LICENSE
@@ -15,8 +15,8 @@ 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.0 && < 1.1
19− , warp >= 1.0 && < 1.1
18+ , wai >= 1.1 && < 1.2
19+ , warp >= 1.1 && < 1.2
2020 , transformers >= 0.2 && < 0.3
2121 , conduit
2222 , certificate >= 1.0.1 && < 1.1
warp/Network/Wai/Handler/Warp.hs+5−2
@@ -97,7 +97,7 @@ import Control.Exception.Lifted (throwIO)
9797import Blaze.ByteString.Builder.HTTP
9898 (chunkedTransferEncoding, chunkedTransferTerminator)
9999import Blaze.ByteString.Builder
100− (copyByteString, Builder, toLazyByteString, toByteStringIO)
100+ (copyByteString, Builder, toLazyByteString, toByteStringIO, flush)
101101import Blaze.ByteString.Builder.Char8 (fromChar, fromShow)
102102import Data.Monoid (mappend, mempty)
103103import Network.Sendfile
@@ -476,9 +476,12 @@ sendResponse th req conn r = sendResponse' r
476476 `mappend` chunkedTransferTerminator
477477 else headers' False `mappend` b
478478
479− sendResponse' (ResponseSource s hs body) =
479+ sendResponse' (ResponseSource s hs bodyFlush) =
480480 response
481481 where
482+ body = fmap (\x -> case x of
483+ C.Flush -> flush
484+ C.Chunk builder -> builder) bodyFlush
482485 headers' = headers version s hs
483486 -- FIXME perhaps alloca a buffer per thread and reuse that in all
484487 -- functions below. Should lessen greatly the GC burden (I hope)
warp/warp.cabal+2−2
@@ -1,5 +1,5 @@
11Name: warp
2−Version: 1.0.0
2+Version: 1.1.0
33Synopsis: A fast, light-weight web server for WAI applications.
44License: BSD3
55License-file: LICENSE
@@ -19,7 +19,7 @@ flag network-bytestring
1919Library
2020 Build-Depends: base >= 3 && < 5
2121 , bytestring >= 0.9.1.4 && < 0.10
22− , wai >= 1.0 && < 1.1
22+ , wai >= 1.1 && < 1.2
2323 , transformers >= 0.2.2 && < 0.3
2424 , conduit
2525 , blaze-builder-conduit >= 0.0.1 && < 0.1