Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

conduit 0.5 support #7

Merged
merged 1 commit into from almost 2 years ago

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
Kazu Yamamoto kazu-yamamoto closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jul 14, 2012
Michael Snoyman conduit 0.5 support be01320
This page is out of date. Refresh to see the latest.
5  Network/Sendfile/Fallback.hs
... ...
@@ -1,3 +1,4 @@
  1
+{-# LANGUAGE CPP #-}
1 2
 module Network.Sendfile.Fallback (
2 3
     sendfile
3 4
   , sendfileWithHeader
@@ -26,6 +27,9 @@ sendfile sock path (PartOfFile off len) hook =
26 27
 
27 28
 -- See sinkHandle.
28 29
 sinkSocket :: MonadIO m => Socket -> IO () -> Sink ByteString m ()
  30
+#if MIN_VERSION_conduit(0,5,0)
  31
+sinkSocket s hook = awaitForever $ \bs -> liftIO $ SB.sendAll s bs >> hook
  32
+#else
29 33
 sinkSocket s hook = NeedInput push close
30 34
   where
31 35
     push bs = flip PipeM (return ()) $ do
@@ -33,6 +37,7 @@ sinkSocket s hook = NeedInput push close
33 37
         liftIO hook
34 38
         return (NeedInput push close)
35 39
     close = return ()
  40
+#endif
36 41
 
37 42
 -- |
38 43
 -- Sendfile emulation using conduit.
2  simple-sendfile.cabal
@@ -41,7 +41,7 @@ Library
41 41
       else
42 42
         Other-Modules:  Network.Sendfile.Fallback
43 43
         Build-Depends:  bytestring      >= 0.9   && < 0.10
44  
-                      , conduit         >= 0.4.1 && < 0.5
  44
+                      , conduit         >= 0.4.1 && < 0.6
45 45
                       , transformers    >= 0.2.2 && < 0.4
46 46
 
47 47
 Test-Suite spec
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.