mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-29781: Fix SSLObject.version before handshake (#3364)
SSLObject.version() now correctly returns None when handshake over BIO has not been performed yet. Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
3463ee3972
commit
6877111648
3 changed files with 8 additions and 0 deletions
|
@ -1706,6 +1706,10 @@ _ssl__SSLSocket_version_impl(PySSLSocket *self)
|
|||
|
||||
if (self->ssl == NULL)
|
||||
Py_RETURN_NONE;
|
||||
if (!SSL_is_init_finished(self->ssl)) {
|
||||
/* handshake not finished */
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
version = SSL_get_version(self->ssl);
|
||||
if (!strcmp(version, "unknown"))
|
||||
Py_RETURN_NONE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue