summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-07-01 18:46:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-07-01 18:59:40 -0400
commitace9de37e8db9c99db4b121392ca63091e48bfac (patch)
treeb3f790ea9bd184094aaf1561cbc7309391f5d1ba /Remote
parent5d154b84365770ff27c09137ad039f930505ebfd (diff)
download urls via tmp file, and support resuming
Diffstat (limited to 'Remote')
-rw-r--r--Remote/Web.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/Remote/Web.hs b/Remote/Web.hs
index 7425dec87..304f191d3 100644
--- a/Remote/Web.hs
+++ b/Remote/Web.hs
@@ -82,7 +82,9 @@ setUrl key url status = do
logChange g key webUUID (if null us then InfoMissing else InfoPresent)
downloadKey :: Key -> FilePath -> Annex Bool
-downloadKey key file = download file =<< getUrls key
+downloadKey key file = do
+ us <- getUrls key
+ download us file
uploadKey :: Key -> Annex Bool
uploadKey _ = do
@@ -116,9 +118,9 @@ urlexists url = do
res <- perform curl
return $ res == CurlOK
-download :: FilePath -> [URLString] -> Annex Bool
-download _ [] = return False
-download file (url:us) = do
+download :: [URLString] -> FilePath -> Annex Bool
+download [] _ = return False
+download (url:us) file = do
showProgress -- make way for curl progress bar
- ok <- liftIO $ boolSystem "curl" [Params "-# -o", File file, File url]
- if ok then return ok else download file us
+ ok <- liftIO $ boolSystem "curl" [Params "-C - -# -o", File file, File url]
+ if ok then return ok else download us file