diff options
author | Joey Hess <joey@kitenet.net> | 2012-04-22 01:13:09 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-04-22 01:13:09 -0400 |
commit | 84ac8c58db30637db4fb88566530b6293f12dab0 (patch) | |
tree | 72b7d1bae98ee22b34d722554069b68eea47513f /Command | |
parent | 5fbe83f595bf5957376544ee83b3cc46cc2323ed (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 'Command')
-rw-r--r-- | Command/AddUrl.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index c87399f5d..089606e85 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -20,6 +20,7 @@ import Annex.Content import Logs.Web import qualified Option import Types.Key +import Config def :: [Command] def = [withOptions [fileOption, pathdepthOption] $ @@ -53,8 +54,9 @@ perform url file = ifAnnexed file addurl geturl liftIO $ createDirectoryIfMissing True (parentDir file) ifM (Annex.getState Annex.fast) ( nodownload url file , download url file ) - addurl (key, _backend) = - ifM (liftIO $ Url.check url $ keySize key) + addurl (key, _backend) = do + headers <- getHttpHeaders + ifM (liftIO $ Url.check url headers $ keySize key) ( do setUrlPresent key url next $ return True @@ -81,7 +83,8 @@ download url file = do nodownload :: String -> FilePath -> CommandPerform nodownload url file = do - (exists, size) <- liftIO $ Url.exists url + headers <- getHttpHeaders + (exists, size) <- liftIO $ Url.exists url headers if exists then do let key = Backend.URL.fromUrl url size |