When annex.http-headers is used to set the User-Agent header, avoid sending User-Agent: git-annex

This commit is contained in:
Joey Hess 2016-01-11 12:10:38 -04:00
parent 7cf6299888
commit 1f6f9a8d34
Failed to extract signature
2 changed files with 7 additions and 2 deletions

View file

@ -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)

2
debian/changelog vendored
View file

@ -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