From 3c6e60dc694b7bb1b18d4f6f7d845a35f19c824e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 24 Apr 2018 21:23:40 -0400 Subject: [PATCH] fix build with old http-conduit --- Utility/Url.hs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Utility/Url.hs b/Utility/Url.hs index 4546d08d95..663ee4bc84 100644 --- a/Utility/Url.hs +++ b/Utility/Url.hs @@ -326,10 +326,25 @@ download meterupdate url file uo = go `catchNonAsync` (const $ return False) - - Note that the responseStatus is not checked by this function. -} -sinkResponseFile :: MonadResource m => MeterUpdate -> BytesProcessed -> FilePath -> IOMode -> Response (ConduitM () B8.ByteString m ()) -> m () +sinkResponseFile + :: MonadResource m + => MeterUpdate + -> BytesProcessed + -> FilePath + -> IOMode +#if MIN_VERSION_http_conduit(2,3,0) + -> Response (ConduitM () B8.ByteString m ()) +#else + -> Response (ResumableSource m B8.ByteString) +#endif + -> m () sinkResponseFile meterupdate initialp file mode resp = do (fr, fh) <- allocate (openBinaryFile file mode) hClose +#if MIN_VERSION_http_conduit(2,3,0) runConduit $ responseBody resp .| go initialp fh +#else + responseBody resp $$+- go initialp fh +#endif release fr where go sofar fh = await >>= \case