diff options
author | 2016-01-11 12:10:38 -0400 | |
---|---|---|
committer | 2016-01-11 12:10:38 -0400 | |
commit | 705054e5b89fe230909bff9d4dca5fee40eff7e8 (patch) | |
tree | cb13a06fe242481245a8e75d595e38f236c7fe23 /Utility/Url.hs | |
parent | 5297b375483b2e90bec2bf1558abaddaa602732d (diff) |
When annex.http-headers is used to set the User-Agent header, avoid sending User-Agent: git-annex
Diffstat (limited to 'Utility/Url.hs')
-rw-r--r-- | Utility/Url.hs | 7 |
1 files changed, 5 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) |