summaryrefslogtreecommitdiff
path: root/Remote/Git.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-09-28 14:35:21 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-09-28 14:35:21 -0400
commita05cefbd7cdfc75109d8f55c4cb699352745841c (patch)
treea3d10d759b00a2c00340d352827fe9d287bed07c /Remote/Git.hs
parent309750f7588d7c9a6eadbdd30b630250f766311f (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 'Remote/Git.hs')
-rw-r--r--Remote/Git.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 7083de667..0f3f35811 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -30,7 +30,7 @@ import Annex.Exception
import qualified Annex.Content
import qualified Annex.BranchState
import qualified Annex.Branch
-import qualified Utility.Url as Url
+import qualified Annex.Url as Url
import Utility.Tmp
import Config
import Config.Cost
@@ -177,9 +177,10 @@ tryGitConfigRead r
Left l -> return $ Left l
geturlconfig headers = do
+ ua <- Url.getUserAgent
v <- liftIO $ withTmpFile "git-annex.tmp" $ \tmpfile h -> do
hClose h
- ifM (Url.downloadQuiet (Git.repoLocation r ++ "/config") headers [] tmpfile)
+ ifM (Url.downloadQuiet (Git.repoLocation r ++ "/config") headers [] tmpfile ua)
( pipedconfig "git" [Param "config", Param "--null", Param "--list", Param "--file", File tmpfile]
, return $ Left undefined
)
@@ -240,7 +241,7 @@ inAnnex r key
where
checkhttp headers = do
showChecking r
- liftIO $ ifM (anyM (\u -> Url.check u headers (keySize key)) (keyUrls r key))
+ ifM (anyM (\u -> Url.withUserAgent $ Url.check u headers (keySize key)) (keyUrls r key))
( return $ Right True
, return $ Left "not found"
)