summaryrefslogtreecommitdiff
path: root/Command/ImportFeed.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 /Command/ImportFeed.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 'Command/ImportFeed.hs')
-rw-r--r--Command/ImportFeed.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Command/ImportFeed.hs b/Command/ImportFeed.hs
index d2f806402..7f54643c9 100644
--- a/Command/ImportFeed.hs
+++ b/Command/ImportFeed.hs
@@ -17,7 +17,7 @@ import Data.Time.Clock
import Common.Annex
import qualified Annex
import Command
-import qualified Utility.Url as Url
+import qualified Annex.Url as Url
import Logs.Web
import qualified Option
import qualified Utility.Format
@@ -102,9 +102,10 @@ findEnclosures url = extract <$> downloadFeed url
downloadFeed :: URLString -> Annex (Maybe Feed)
downloadFeed url = do
showOutput
+ ua <- Url.getUserAgent
liftIO $ withTmpFile "feed" $ \f h -> do
fileEncoding h
- ifM (Url.download url [] [] f)
+ ifM (Url.download url [] [] f ua)
( liftIO $ parseFeedString <$> hGetContentsStrict h
, return Nothing
)