make it easier to use curl for unusual url schemes
Use curl when annex.security.allowed-url-schemes includes an url scheme not supported by git-annex internally, as long as annex.security.allowed-ip-addresses is configured to allow using curl. Sponsored-by: Luke Shumaker on Patreon
This commit is contained in:
parent
2fc9a0096f
commit
840bd50390
5 changed files with 37 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
|||
{- Url downloading.
|
||||
-
|
||||
- Copyright 2011-2021 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2011-2022 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- License: BSD-2-clause
|
||||
-}
|
||||
|
@ -40,6 +40,7 @@ module Utility.Url (
|
|||
noBasicAuth,
|
||||
applyBasicAuth',
|
||||
extractFromResourceT,
|
||||
conduitUrlSchemes,
|
||||
) where
|
||||
|
||||
import Common
|
||||
|
@ -111,10 +112,13 @@ defUrlOptions = UrlOptions
|
|||
<*> pure (DownloadWithConduit (DownloadWithCurlRestricted mempty))
|
||||
<*> pure id
|
||||
<*> newManager tlsManagerSettings
|
||||
<*> pure (S.fromList $ map mkScheme ["http", "https", "ftp"])
|
||||
<*> pure conduitUrlSchemes
|
||||
<*> pure Nothing
|
||||
<*> pure noBasicAuth
|
||||
|
||||
conduitUrlSchemes :: S.Set Scheme
|
||||
conduitUrlSchemes = S.fromList $ map mkScheme ["http", "https", "ftp"]
|
||||
|
||||
mkUrlOptions :: Maybe UserAgent -> Headers -> UrlDownloader -> Manager -> S.Set Scheme -> Maybe (URI -> String) -> GetBasicAuth -> UrlOptions
|
||||
mkUrlOptions defuseragent reqheaders urldownloader =
|
||||
UrlOptions useragent reqheaders urldownloader applyrequest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue