From 1a9de9b3dea1bd8a4382371443497556ac4352e8 Mon Sep 17 00:00:00 2001 From: Jaen Date: Mon, 21 Aug 2017 16:41:15 -0700 Subject: [PATCH 1/2] ssl: Add missing PROTOCOL_TLS & OP_NO_TICKET constants These were added in 3.5 and 3.6: https://docs.python.org/3.5/library/ssl.html#ssl.PROTOCOL_TLS https://docs.python.org/3.6/library/ssl.html#ssl.PROTOCOL_TLS_CLIENT --- stdlib/3/ssl.pyi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stdlib/3/ssl.pyi b/stdlib/3/ssl.pyi index 988050404840..ceaa9258aaff 100644 --- a/stdlib/3/ssl.pyi +++ b/stdlib/3/ssl.pyi @@ -102,6 +102,11 @@ PROTOCOL_TLSv1 = ... # type: int if sys.version_info >= (3, 4): PROTOCOL_TLSv1_1 = ... # type: int PROTOCOL_TLSv1_2 = ... # type: int +if sys.version_info >= (3, 5): + PROTOCOL_TLS = ... # type: int +if sys.version_info >= (3, 6): + PROTOCOL_TLS_CLIENT = ... # type: int + PROTOCOL_TLS_SERVER = ... # type: int OP_ALL = ... # type: int OP_NO_SSLv2 = ... # type: int @@ -114,6 +119,8 @@ OP_CIPHER_SERVER_PREFERENCE = ... # type: int OP_SINGLE_DH_USE = ... # type: int OP_SINGLE_ECDH_USE = ... # type: int OP_NO_COMPRESSION = ... # type: int +if sys.version_info >= (3, 6): + OP_NO_TICKET = ... # type: int if sys.version_info >= (3, 5): HAS_ALPN = ... # type: int From e587b57defce47596bcdec2c21d507763480c3e7 Mon Sep 17 00:00:00 2001 From: Jaen Saul Date: Mon, 21 Aug 2017 17:40:09 -0700 Subject: [PATCH 2/2] ssl: Add missing SSLSession class Reference: https://github.com/python/cpython/blob/5fe59f8e3a0a56a155c18f9d581205ec533764b6/Modules/_ssl.c#L4428 --- stdlib/3/ssl.pyi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/stdlib/3/ssl.pyi b/stdlib/3/ssl.pyi index ceaa9258aaff..060bccdcd471 100644 --- a/stdlib/3/ssl.pyi +++ b/stdlib/3/ssl.pyi @@ -175,6 +175,10 @@ class SSLSocket(socket.socket): context = ... # type: SSLContext server_side = ... # type: bool server_hostname = ... # type: Optional[str] + if sys.version_info >= (3, 6): + session = ... # type: Optional[SSLSession] + session_reused = ... # type: Optional[bool] + def read(self, len: int = ..., buffer: Optional[bytearray] = ...) -> bytes: ... def write(self, buf: bytes) -> int: ... @@ -244,6 +248,9 @@ if sys.version_info >= (3, 5): context = ... # type: SSLContext server_side = ... # type: bool server_hostname = ... # type: Optional[str] + if sys.version_info >= (3, 6): + session = ... # type: Optional[SSLSession] + session_reused = ... # type: bool def read(self, len: int = ..., buffer: Optional[bytearray] = ...) -> bytes: ... def write(self, buf: bytes) -> int: ... @@ -264,6 +271,14 @@ if sys.version_info >= (3, 5): def write(self, buf: bytes) -> int: ... def write_eof(self) -> None: ... +if sys.version_info >= (3, 6): + class SSLSession: + id = ... # type: bytes + time = ... # type: int + timeout = ... # type: int + ticket_lifetime_hint = ... # type: int + has_ticket = ... # type: bool + # TODO below documented in cpython but not in docs.python.org # taken from python 3.4