summaryrefslogtreecommitdiff
path: root/Utility/Url.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-02 14:20:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-02 14:20:20 -0400
commitaa0882691bb2aa64fb13f0df85be0469fd33d98d (patch)
tree365eff7f04e32c88d0c5fbe09fe206be3532aad9 /Utility/Url.hs
parent50ebfd265fca5271772ea35ed0aad834a8299298 (diff)
Added remote.name.annex-web-options configuration setting, which can be used to provide parameters to whichever of wget or curl git-annex uses (depends on which is available, but most of their important options suitable for use here are the same).
Diffstat (limited to 'Utility/Url.hs')
-rw-r--r--Utility/Url.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Utility/Url.hs b/Utility/Url.hs
index f215a1ebd..e10b8a92a 100644
--- a/Utility/Url.hs
+++ b/Utility/Url.hs
@@ -6,6 +6,7 @@
-}
module Utility.Url (
+ URLString,
exists,
canDownload,
download,
@@ -43,21 +44,21 @@ canDownload = (||) <$> inPath "wget" <*> inPath "curl"
- would not be appropriate to test at configure time and build support
- for only one in.
-}
-download :: URLString -> FilePath -> IO Bool
-download url file = do
+download :: URLString -> [CommandParam] -> FilePath -> IO Bool
+download url options file = do
e <- inPath "wget"
if e
then
- boolSystem "wget"
- [Params "-c -O", File file, File url]
+ go "wget" [Params "-c -O", File file, File url]
else
-- Uses the -# progress display, because the normal
-- one is very confusing when resuming, showing
-- the remainder to download as the whole file,
-- and not indicating how much percent was
-- downloaded before the resume.
- boolSystem "curl"
- [Params "-L -C - -# -o", File file, File url]
+ go "curl" [Params "-L -C - -# -o", File file, File url]
+ where
+ go cmd opts = boolSystem cmd (options++opts)
{- Downloads a small file. -}
get :: URLString -> IO String