Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

conduit 0.5 support #7

Merged
merged 1 commit into from

2 participants

Michael Snoyman Kazu Yamamoto
Michael Snoyman

Conditionally adds 0.5 support. Only affects the fallback option (so likely only Windows).

Kazu Yamamoto kazu-yamamoto merged commit d2c2839 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 14, 2012
  1. Michael Snoyman

    conduit 0.5 support

    snoyberg authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 1 deletion.
  1. +5 −0 Network/Sendfile/Fallback.hs
  2. +1 −1  simple-sendfile.cabal
5 Network/Sendfile/Fallback.hs
View
@@ -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.
2  simple-sendfile.cabal
View
@@ -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
Something went wrong with that request. Please try again.