mirror of
https://github.com/python/cpython.git
synced 2025-11-26 13:22:51 +00:00
Fix NameErrors.
This commit is contained in:
parent
5684a9ac30
commit
30baf2b0ed
1 changed files with 4 additions and 3 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import ssl
|
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
|
|
@ -38,7 +37,8 @@ def fetch_server_certificate (host, port):
|
||||||
status, output = subproc(r'openssl x509 -in "%s" -out "%s"' %
|
status, output = subproc(r'openssl x509 -in "%s" -out "%s"' %
|
||||||
(tn, tn2))
|
(tn, tn2))
|
||||||
if status != 0:
|
if status != 0:
|
||||||
raise OperationError(status, tsig, output)
|
raise RuntimeError('OpenSSL x509 failed with status %s and '
|
||||||
|
'output: %r' % (status, output))
|
||||||
fp = open(tn2, 'rb')
|
fp = open(tn2, 'rb')
|
||||||
data = fp.read()
|
data = fp.read()
|
||||||
fp.close()
|
fp.close()
|
||||||
|
|
@ -63,7 +63,8 @@ def fetch_server_certificate (host, port):
|
||||||
'openssl s_client -connect "%s:%s" -showcerts < /dev/null' %
|
'openssl s_client -connect "%s:%s" -showcerts < /dev/null' %
|
||||||
(host, port))
|
(host, port))
|
||||||
if status != 0:
|
if status != 0:
|
||||||
raise OSError(status)
|
raise RuntimeError('OpenSSL connect failed with status %s and '
|
||||||
|
'output: %r' % (status, output))
|
||||||
certtext = strip_to_x509_cert(output)
|
certtext = strip_to_x509_cert(output)
|
||||||
if not certtext:
|
if not certtext:
|
||||||
raise ValueError("Invalid response received from server at %s:%s" %
|
raise ValueError("Invalid response received from server at %s:%s" %
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue