Everything compiles with conduit 0.4

This commit is contained in:
Michael Snoyman 2012-03-27 14:07:48 +02:00
parent e16466acae
commit 416cb5d466
10 changed files with 26 additions and 20 deletions

View File

@ -17,7 +17,7 @@ Library
base >= 4.3 && < 5
, bytestring >= 0.9.1.4 && < 0.10
, blaze-builder >= 0.3 && < 0.4
, conduit >= 0.3 && < 0.4
, conduit >= 0.4 && < 0.5
, http-types >= 0.6 && < 0.7
, wai >= 1.2 && < 1.3
, warp >= 1.2 && < 1.3

View File

@ -141,10 +141,10 @@ runGeneric vars inputH outputH xsendfile app = do
, fromByteString sf
, fromByteString " not supported"
]
bsSink = C.Processing push (return ())
push (C.Chunk bs) = C.SinkM $ do
bsSink = C.NeedInput push (return ())
push (C.Chunk bs) = C.PipeM (do
liftIO $ outputH bs
return bsSink
return bsSink) (return ())
-- FIXME actually flush?
push C.Flush = bsSink
builderSink = builderToByteStringFlush C.=$ bsSink

View File

@ -34,9 +34,9 @@ Library
, case-insensitive >= 0.2
, data-default >= 0.3 && < 0.4
, fast-logger >= 0.0.2
, conduit >= 0.3 && < 0.4
, zlib-conduit >= 0.3 && < 0.4
, blaze-builder-conduit >= 0.3 && < 0.4
, conduit >= 0.4 && < 0.5
, zlib-conduit >= 0.4 && < 0.5
, blaze-builder-conduit >= 0.4 && < 0.5
, ansi-terminal
Exposed-modules: Network.Wai.Handler.CGI

View File

@ -16,7 +16,7 @@ library
, bytestring
, containers >= 0.2
, cgi
, conduit >= 0.2
, conduit >= 0.4
, http-types
, transformers
, case-insensitive

View File

@ -19,9 +19,9 @@ Library
, transformers >= 0.2.2 && < 0.3
, bytestring >= 0.9.1.4 && < 0.10
, blaze-builder >= 0.2.1.4 && < 0.4
, conduit >= 0.3 && < 0.4
, blaze-builder-conduit >= 0.3 && < 0.4
, zlib-conduit >= 0.3 && < 0.4
, conduit >= 0.4 && < 0.5
, blaze-builder-conduit >= 0.4 && < 0.5
, zlib-conduit >= 0.4 && < 0.5
if os(windows)
c-sources: windows.c

View File

@ -99,13 +99,19 @@ srequest (SRequest req bod) = do
runResponse :: Response -> C.ResourceT IO SResponse
runResponse res = do
bss <- fmap toBuilder body C.$= builderToByteString C.$$ CL.consume
bss <- fmap2 toBuilder body C.$= builderToByteString C.$$ CL.consume
return $ SResponse s h $ L.fromChunks bss
where
(s, h, body) = responseSource res
toBuilder (C.Chunk builder) = builder
toBuilder C.Flush = flush
fmap2 :: Functor m => (a -> b) -> C.Source m a -> C.Source m b
fmap2 f (C.HaveOutput p c o) = C.HaveOutput (fmap2 f p) c (f o)
fmap2 f (C.NeedInput p c) = C.NeedInput (fmap2 f . p) (fmap2 f c)
fmap2 _ (C.Done i r) = C.Done i r
fmap2 f (C.PipeM mp c) = C.PipeM (fmap (fmap2 f) mp) c
assertBool :: String -> Bool -> Session ()
assertBool s b = liftIO $ H.assertBool s b

View File

@ -20,8 +20,8 @@ library
, blaze-builder >= 0.2.1.4 && < 0.4
, transformers >= 0.2.2 && < 0.3
, containers >= 0.2 && < 0.5
, conduit >= 0.3 && < 0.4
, blaze-builder-conduit >= 0.3 && < 0.4
, conduit >= 0.4 && < 0.5
, blaze-builder-conduit >= 0.4 && < 0.5
, cookie >= 0.2 && < 0.5
, HUnit >= 1.2 && < 1.3
, http-types >= 0.6 && < 0.7

View File

@ -18,7 +18,7 @@ import qualified Network.WebSockets as WS
intercept :: WS.Protocol p
=> (WS.Request -> WS.WebSockets p ())
-> Wai.Request
-> Maybe (C.BufferedSource (C.ResourceT IO) ByteString -> Warp.Connection -> C.ResourceT IO ())
-> Maybe (C.Source (C.ResourceT IO) ByteString -> Warp.Connection -> C.ResourceT IO ())
intercept = interceptWith WS.defaultWebSocketsOptions
-- | Variation of 'intercept' which allows custom options.
@ -26,7 +26,7 @@ interceptWith :: WS.Protocol p
=> WS.WebSocketsOptions
-> (WS.Request -> WS.WebSockets p ())
-> Wai.Request
-> Maybe (C.BufferedSource (C.ResourceT IO) ByteString -> Warp.Connection -> C.ResourceT IO ())
-> Maybe (C.Source (C.ResourceT IO) ByteString -> Warp.Connection -> C.ResourceT IO ())
interceptWith opts app req = case lookup "upgrade" $ Wai.requestHeaders req of
Just s
| S.map toLower s == "websocket" -> Just $ runWebSockets opts req' app
@ -41,7 +41,7 @@ runWebSockets :: WS.Protocol p
=> WS.WebSocketsOptions
-> WS.RequestHttpPart
-> (WS.Request -> WS.WebSockets p ())
-> C.BufferedSource (C.ResourceT IO) ByteString
-> C.Source (C.ResourceT IO) ByteString
-> Warp.Connection
-> C.ResourceT IO ()
runWebSockets opts req app source conn = do

View File

@ -19,7 +19,7 @@ flag example
Library
Build-Depends: base >= 3 && < 5
, bytestring >= 0.9.1.4 && < 0.10
, conduit >= 0.3 && < 0.4
, conduit >= 0.4 && < 0.5
, wai >= 1.2 && < 1.3
, enumerator >= 0.4.8 && < 0.5
, network-enumerator >= 0.1.2 && < 0.2

View File

@ -18,8 +18,8 @@ Library
, wai >= 1.2 && < 1.3
, warp >= 1.2 && < 1.3
, transformers >= 0.2 && < 0.3
, conduit >= 0.3 && < 0.4
, network-conduit >= 0.3 && < 0.4
, conduit >= 0.4 && < 0.5
, network-conduit >= 0.4 && < 0.5
, certificate >= 1.1 && < 1.2
, cryptocipher >= 0.3 && < 0.4
, tls-extra >= 0.4.3 && < 0.5