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.
This commit is contained in:
Joey Hess 2013-09-28 14:35:21 -04:00
parent 55362462ae
commit 12f6b9693a
14 changed files with 90 additions and 36 deletions

View file

@ -19,7 +19,7 @@ import Config.Cost
import Logs.Web
import Types.Key
import Utility.Metered
import qualified Utility.Url as Url
import qualified Annex.Url as Url
#ifdef WITH_QUVI
import Annex.Quvi
import qualified Utility.Quvi as Quvi
@ -118,7 +118,7 @@ checkKey' key us = firsthit us (Right False) $ \u -> do
#endif
DefaultDownloader -> do
headers <- getHttpHeaders
liftIO $ Right <$> Url.check u' headers (keySize key)
Right <$> Url.withUserAgent (Url.check u' headers $ keySize key)
where
firsthit [] miss _ = return miss
firsthit (u:rest) _ a = do