summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-24 21:29:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-24 21:29:37 -0400
commitb6fb2e3a3384d2b9a92002aaf26c0c0d535ee4d3 (patch)
tree9dca4e7d6168983ebc0497672c4bdf6de7a82f31 /Utility
parentd2ff4e12d0ae0d32263e258ea7c2a283d1d92149 (diff)
Make annex.web-options be used in several places that call curl.
Diffstat (limited to 'Utility')
-rw-r--r--Utility/Url.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/Utility/Url.hs b/Utility/Url.hs
index 2cbab77c8..49f25c371 100644
--- a/Utility/Url.hs
+++ b/Utility/Url.hs
@@ -34,12 +34,12 @@ type UserAgent = String
{- Checks that an url exists and could be successfully downloaded,
- also checking that its size, if available, matches a specified size. -}
-checkBoth :: URLString -> Headers -> Maybe Integer -> Maybe UserAgent -> IO Bool
-checkBoth url headers expected_size ua = do
- v <- check url headers expected_size ua
+checkBoth :: URLString -> Headers -> [CommandParam] -> Maybe Integer -> Maybe UserAgent -> IO Bool
+checkBoth url headers options expected_size ua = do
+ v <- check url headers options expected_size ua
return (fst v && snd v)
-check :: URLString -> Headers -> Maybe Integer -> Maybe UserAgent -> IO (Bool, Bool)
-check url headers expected_size = handle <$$> exists url headers
+check :: URLString -> Headers -> [CommandParam] -> Maybe Integer -> Maybe UserAgent -> IO (Bool, Bool)
+check url headers options expected_size = handle <$$> exists url headers options
where
handle (False, _) = (False, False)
handle (True, Nothing) = (True, True)
@@ -55,8 +55,8 @@ check url headers expected_size = handle <$$> exists url headers
- Uses curl otherwise, when available, since curl handles https better
- than does Haskell's Network.Browser.
-}
-exists :: URLString -> Headers -> Maybe UserAgent -> IO (Bool, Maybe Integer)
-exists url headers ua = case parseURIRelaxed url of
+exists :: URLString -> Headers -> [CommandParam] -> Maybe UserAgent -> IO (Bool, Maybe Integer)
+exists url headers options ua = case parseURIRelaxed url of
Just u
| uriScheme u == "file:" -> do
s <- catchMaybeIO $ getFileStatus (unEscapeString $ uriPath u)
@@ -83,7 +83,7 @@ exists url headers ua = case parseURIRelaxed url of
, Param "--head"
, Param "-L", Param url
, Param "-w", Param "%{http_code}"
- ] ++ concatMap (\h -> [Param "-H", Param h]) headers
+ ] ++ concatMap (\h -> [Param "-H", Param h]) headers ++ options
extractsize s = case lastMaybe $ filter ("Content-Length:" `isPrefixOf`) (lines s) of
Just l -> case lastMaybe $ words l of