ssl: Add missing constants & classes (#1569)

* 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

* ssl: Add missing SSLSession class

Reference:
5fe59f8e3a/Modules/_ssl.c (L4428)
This commit is contained in:
Jaen
2017-08-28 21:14:41 -07:00
committed by Jelle Zijlstra
parent f1a13cea9c
commit 87009939a5

View File

@@ -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
@@ -168,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: ...
@@ -237,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: ...
@@ -257,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