diff options
author | 2016-01-11 12:10:38 -0400 | |
---|---|---|
committer | 2016-01-11 12:10:38 -0400 | |
commit | 705054e5b89fe230909bff9d4dca5fee40eff7e8 (patch) | |
tree | cb13a06fe242481245a8e75d595e38f236c7fe23 | |
parent | 5297b375483b2e90bec2bf1558abaddaa602732d (diff) |
When annex.http-headers is used to set the User-Agent header, avoid sending User-Agent: git-annex
-rw-r--r-- | Utility/Url.hs | 7 | ||||
-rw-r--r-- | debian/changelog | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/Utility/Url.hs b/Utility/Url.hs index c53ed5c6a..1e1f14cb8 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 ffe04377c..1002ce89f 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 <id@joeyh.name> Sat, 19 Dec 2015 13:31:17 -0400 |