From: Antoine Pitrou Date: Sun, 11 Nov 2012 00:27:33 +0000 (+0100) Subject: Issue #16357: fix calling accept() on a SSLSocket created through SSLContext.wrap_soc... X-Git-Tag: v3.3.1rc1~656 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73e9bd4d259c3c213347e45d4bb5bf20fb51c7f4;p=python Issue #16357: fix calling accept() on a SSLSocket created through SSLContext.wrap_socket(). Original patch by Jeff McNeil. --- 73e9bd4d259c3c213347e45d4bb5bf20fb51c7f4 diff --cc Lib/ssl.py index 3162f56a37,e901b640a6..5e5a5ce091 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@@ -553,32 -491,12 +553,27 @@@ class SSLSocket(socket) SSL channel, and the address of the remote client.""" newsock, addr = socket.accept(self) - return (SSLSocket(sock=newsock, - keyfile=self.keyfile, certfile=self.certfile, - server_side=True, - cert_reqs=self.cert_reqs, - ssl_version=self.ssl_version, - ca_certs=self.ca_certs, - ciphers=self.ciphers, - do_handshake_on_connect= - self.do_handshake_on_connect), - addr) + newsock = self.context.wrap_socket(newsock, + do_handshake_on_connect=self.do_handshake_on_connect, + suppress_ragged_eofs=self.suppress_ragged_eofs, + server_side=True) + return newsock, addr + def get_channel_binding(self, cb_type="tls-unique"): + """Get channel binding data for current connection. Raise ValueError + if the requested `cb_type` is not supported. Return bytes of the data + or None if the data is not available (e.g. before the handshake). + """ + if cb_type not in CHANNEL_BINDING_TYPES: + raise ValueError("Unsupported channel binding type") + if cb_type != "tls-unique": + raise NotImplementedError( + "{0} channel binding type not implemented" + .format(cb_type)) + if self._sslobj is None: + return None + return self._sslobj.tls_unique_cb() + def __del__(self): # sys.stderr.write("__del__ on %s\n" % repr(self)) self._real_close() diff --cc Misc/NEWS index 0646a74c6b,b035e24a2f..9c0ea03fc4 --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -80,14 -159,9 +80,17 @@@ Core and Builtin Library ------- + - Issue #16357: fix calling accept() on a SSLSocket created through + SSLContext.wrap_socket(). Original patch by Jeff McNeil. + +- Issue #16409: The reporthook callback made by the legacy + urllib.request.urlretrieve API now properly supplies a constant non-zero + block_size as it did in Python 3.2 and 2.7. This matches the behavior of + urllib.request.URLopener.retrieve. + +- Issue #16431: Use the type information when constructing a Decimal subtype + from a Decimal argument. + - Issue #16350: zlib.Decompress.decompress() now accumulates data from successive calls after EOF in unused_data, instead of only saving the argument to the last call. Patch by Serhiy Storchaka.