aboutsummaryrefslogtreecommitdiff
path: root/Config.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-04-22 01:13:09 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-04-22 01:13:09 -0400
commit84ac8c58db30637db4fb88566530b6293f12dab0 (patch)
tree72b7d1bae98ee22b34d722554069b68eea47513f /Config.hs
parent5fbe83f595bf5957376544ee83b3cc46cc2323ed (diff)
Add annex.httpheaders and annex.httpheader-command config settings
Allow custom headers to be sent with all HTTP requests. (Requested by the Internet Archive)
Diffstat (limited to 'Config.hs')
-rw-r--r--Config.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Config.hs b/Config.hs
index 087cb4043..065ee48f3 100644
--- a/Config.hs
+++ b/Config.hs
@@ -96,3 +96,12 @@ getDiskReserve = fromMaybe megabyte . readSize dataUnits
<$> getConfig "annex.diskreserve" ""
where
megabyte = 1000000
+
+{- Gets annex.httpheaders or annex.httpheaders-command setting,
+ - splitting it into lines. -}
+getHttpHeaders :: Annex [String]
+getHttpHeaders = do
+ cmd <- getConfig "annex.httpheaders-command" ""
+ if (null cmd)
+ then fromRepo $ Git.Config.getList "annex.httpheaders"
+ else lines . snd <$> liftIO (pipeFrom "sh" ["-c", cmd])