diff options
author | Joey Hess <joey@kitenet.net> | 2013-09-28 14:35:21 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-09-28 14:35:21 -0400 |
commit | a05cefbd7cdfc75109d8f55c4cb699352745841c (patch) | |
tree | a3d10d759b00a2c00340d352827fe9d287bed07c /Command/AddUrl.hs | |
parent | 309750f7588d7c9a6eadbdd30b630250f766311f (diff) |
Send a git-annex user-agent when downloading urls.
Overridable with --user-agent option.
Not yet done for S3 or WebDAV due to limitations of libraries used --
nether allows a user-agent header to be specified.
This commit sponsored by Michael Zehrer.
Diffstat (limited to 'Command/AddUrl.hs')
-rw-r--r-- | Command/AddUrl.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index e767a45e0..951bbdbe8 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -17,8 +17,8 @@ import Backend import qualified Command.Add import qualified Annex import qualified Annex.Queue +import qualified Annex.Url as Url import qualified Backend.URL -import qualified Utility.Url as Url import Annex.Content import Logs.Web import qualified Option @@ -123,7 +123,7 @@ perform relaxed url file = ifAnnexed file addurl geturl next $ return True | otherwise = do headers <- getHttpHeaders - ifM (liftIO $ Url.check url headers $ keySize key) + ifM (Url.withUserAgent $ Url.check url headers $ keySize key) ( do setUrlPresent key url next $ return True @@ -174,7 +174,7 @@ download url file = do size <- ifM (liftIO $ isJust <$> checkDaemon pidfile) ( do headers <- getHttpHeaders - liftIO $ snd <$> Url.exists url headers + snd <$> Url.withUserAgent (Url.exists url headers) , return Nothing ) Backend.URL.fromUrl url size @@ -203,7 +203,7 @@ nodownload relaxed url file = do headers <- getHttpHeaders (exists, size) <- if relaxed then pure (True, Nothing) - else liftIO $ Url.exists url headers + else Url.withUserAgent $ Url.exists url headers if exists then do key <- Backend.URL.fromUrl url size |