mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-22 12:44:30 +03:00
Cleaner code logic
This commit is contained in:
parent
ffc9c10b6e
commit
da23aa26c5
1 changed files with 4 additions and 6 deletions
|
@ -138,12 +138,10 @@ class ClientTLSOptionsFactory(object):
|
||||||
# Use _makeContext so that we get a fresh OpenSSL CTX each time.
|
# Use _makeContext so that we get a fresh OpenSSL CTX each time.
|
||||||
|
|
||||||
# Check if certificate validation has been enabled
|
# Check if certificate validation has been enabled
|
||||||
if config.federation_verify_certificates:
|
if (config.federation_verify_certificates and
|
||||||
# Check if this host is whitelisted
|
host not in config.federation_certificate_validation_whitelist):
|
||||||
if host in config.federation_certificate_validation_whitelist:
|
# Require validation
|
||||||
return ClientTLSOptions(host, self._options_novalidate._makeContext())
|
|
||||||
|
|
||||||
# Otherwise require validation
|
|
||||||
return ClientTLSOptions(host, self._options_validate._makeContext())
|
return ClientTLSOptions(host, self._options_validate._makeContext())
|
||||||
|
|
||||||
|
# Otherwise don't require validation
|
||||||
return ClientTLSOptions(host, self._options_novalidate._makeContext())
|
return ClientTLSOptions(host, self._options_novalidate._makeContext())
|
||||||
|
|
Loading…
Reference in a new issue