diff --git a/Utility/Url.hs b/Utility/Url.hs index c53ed5c6a0..1e1f14cb8c 100644 --- a/Utility/Url.hs +++ b/Utility/Url.hs @@ -78,15 +78,18 @@ instance Default UrlOptions def = UrlOptions Nothing [] [] id mkUrlOptions :: Maybe UserAgent -> Headers -> [CommandParam] -> UrlOptions -mkUrlOptions useragent reqheaders reqparams = +mkUrlOptions defuseragent reqheaders reqparams = UrlOptions useragent reqheaders reqparams applyrequest where applyrequest = \r -> r { requestHeaders = requestHeaders r ++ addedheaders } addedheaders = uaheader ++ otherheaders + useragent = maybe defuseragent (Just . B8.toString . snd) + (headMaybe uafromheaders) uaheader = case useragent of Nothing -> [] Just ua -> [(hUserAgent, B8.fromString ua)] - otherheaders = map toheader reqheaders + (uafromheaders, otherheaders) = partition (\(h, _) -> h == hUserAgent) + (map toheader reqheaders) toheader s = let (h, v) = separate (== ':') s h' = CI.mk (B8.fromString h) diff --git a/debian/changelog b/debian/changelog index ffe04377c0..1002ce89f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -53,6 +53,8 @@ git-annex (6.20151219) UNRELEASED; urgency=medium (and little used) plumbing command to. * view: Fix crash in non-unicode capable locale when entering a view of metadata containing a slash or backslash. + * When annex.http-headers is used to set the User-Agent header, avoid + sending User-Agent: git-annex -- Joey Hess Sat, 19 Dec 2015 13:31:17 -0400