-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add timeout parameter for get_server_certificate in ssl.py #76051
Labels
Comments
The original get_server_certificate in ssl.py does not support socket timeout, def get_server_certificate(addr, ssl_version=PROTOCOL_TLS, ca_certs=None):
"""Retrieve the certificate from the server at the specified address,
and return it as a PEM-encoded string.
If 'ca_certs' is specified, validate the server cert against it.
If 'ssl_version' is specified, use it in the connection attempt."""
If a timeout parameter, a sample demo can be here: >>> import ssl
>>> ssl.get_server_certificate(("www.qq.com", 443), timeout=6)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/ssl.py", line 1017, in get_server_certificate
with closing(create_connection(addr, timeout)) as sock:
File "/usr/lib/python2.7/socket.py", line 575, in create_connection
raise err
socket.error: [Errno 101] Network is unreachable |
nixawk
mannequin
added
stdlib
Python modules in the Lib dir
type-feature
A feature request or enhancement
labels
Oct 26, 2017
tiran
added
topic-SSL
3.7 (EOL)
end of life
and removed
stdlib
Python modules in the Lib dir
labels
Nov 3, 2017
It's too late to land a new feature in 3.7. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: