mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
ssl: refactor sslkwargs - move things around a bit, preparing for next change
This commit is contained in:
parent
153b05ace7
commit
9342c560fd
@ -89,16 +89,18 @@ def _verifycert(cert, hostname):
|
||||
# busted on those versions.
|
||||
|
||||
def sslkwargs(ui, host):
|
||||
cacerts = ui.config('web', 'cacerts')
|
||||
forcetls = ui.configbool('ui', 'tls', default=True)
|
||||
if forcetls:
|
||||
ssl_version = PROTOCOL_TLSv1
|
||||
else:
|
||||
ssl_version = PROTOCOL_SSLv23
|
||||
hostfingerprint = ui.config('hostfingerprints', host)
|
||||
kws = {'ssl_version': ssl_version,
|
||||
}
|
||||
if cacerts and not hostfingerprint:
|
||||
hostfingerprint = ui.config('hostfingerprints', host)
|
||||
if hostfingerprint:
|
||||
return kws
|
||||
cacerts = ui.config('web', 'cacerts')
|
||||
if cacerts:
|
||||
cacerts = util.expandpath(cacerts)
|
||||
if not os.path.exists(cacerts):
|
||||
raise util.Abort(_('could not find web.cacerts: %s') % cacerts)
|
||||
|
Loading…
Reference in New Issue
Block a user