def maybe_download_ca_cert(self, ignored, replace=False):
"""
:rtype: deferred
"""
# TODO: doesn't update the cert :((((
enc_domain = self._domain.encode(sys.getfilesystemencoding())
path = os.path.join(self._basedir, 'providers', enc_domain, 'keys',
'ca', 'cacert.pem')
if not replace and is_file(path):
return defer.succeed('ca_cert_path_already_exists')
def errback(failure):
raise NetworkError(failure.getErrorMessage())
uri = self._get_ca_cert_uri()
mkdir_p(os.path.split(path)[0])
# We don't validate the TLS cert for this connection,
# just check the fingerprint of the ca.cert
d = downloadPage(uri, path)
d.addCallback(self._reload_http_client)
d.addErrback(errback)
return d
评论列表
文章目录