Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #7 from snoyberg/master

conduit 0.5 support
  • Loading branch information...
commit d2c2839852c7c495e9c6d8248baac64310e0e1e1 2 parents c6b44cc + be01320
@kazu-yamamoto authored
Showing with 6 additions and 1 deletion.
  1. +5 −0 Network/Sendfile/Fallback.hs
  2. +1 −1  simple-sendfile.cabal
View
5 Network/Sendfile/Fallback.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
module Network.Sendfile.Fallback (
sendfile
, sendfileWithHeader
@@ -26,6 +27,9 @@ sendfile sock path (PartOfFile off len) hook =
-- See sinkHandle.
sinkSocket :: MonadIO m => Socket -> IO () -> Sink ByteString m ()
+#if MIN_VERSION_conduit(0,5,0)
+sinkSocket s hook = awaitForever $ \bs -> liftIO $ SB.sendAll s bs >> hook
+#else
sinkSocket s hook = NeedInput push close
where
push bs = flip PipeM (return ()) $ do
@@ -33,6 +37,7 @@ sinkSocket s hook = NeedInput push close
liftIO hook
return (NeedInput push close)
close = return ()
+#endif
-- |
-- Sendfile emulation using conduit.
View
2  simple-sendfile.cabal
@@ -41,7 +41,7 @@ Library
else
Other-Modules: Network.Sendfile.Fallback
Build-Depends: bytestring >= 0.9 && < 0.10
- , conduit >= 0.4.1 && < 0.5
+ , conduit >= 0.4.1 && < 0.6
, transformers >= 0.2.2 && < 0.4
Test-Suite spec
Please sign in to comment.
Something went wrong with that request. Please try again.