From 9f9f1decca4a06d81ce97b64ef1a06fda3b8efad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 24 Feb 2014 22:00:25 -0400 Subject: add UrlOptions sum type --- Command/AddUrl.hs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Command/AddUrl.hs') diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index da4da414f..f45303416 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -134,8 +134,7 @@ perform relaxed url file = ifAnnexed file addurl geturl setUrlPresent key url next $ return True | otherwise = do - (headers, options) <- getHttpHeadersOptions - (exists, samesize) <- Url.withUserAgent $ Url.check url headers options (keySize key) + (exists, samesize) <- Url.withUrlOptions $ Url.check url (keySize key) if exists && samesize then do setUrlPresent key url @@ -192,8 +191,7 @@ download url file = do -} addSizeUrlKey :: URLString -> Key -> Annex Key addSizeUrlKey url key = do - (headers, options) <- getHttpHeadersOptions - size <- snd <$> Url.withUserAgent (Url.exists url headers options) + size <- snd <$> Url.withUrlOptions (Url.exists url) return $ key { keySize = size } cleanup :: URLString -> FilePath -> Key -> Maybe FilePath -> Annex Bool @@ -212,10 +210,9 @@ cleanup url file key mtmp = do nodownload :: Bool -> URLString -> FilePath -> Annex Bool nodownload relaxed url file = do - (headers, options) <- getHttpHeadersOptions (exists, size) <- if relaxed then pure (True, Nothing) - else Url.withUserAgent $ Url.exists url headers options + else Url.withUrlOptions (Url.exists url) if exists then do key <- Backend.URL.fromUrl url size -- cgit v1.2.3