]> granicus.if.org Git - python/commitdiff
Issue #16357: fix calling accept() on a SSLSocket created through SSLContext.wrap_soc...
authorAntoine Pitrou <solipsis@pitrou.net>
Sun, 11 Nov 2012 00:27:33 +0000 (01:27 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Sun, 11 Nov 2012 00:27:33 +0000 (01:27 +0100)
Original patch by Jeff McNeil.

1  2 
Lib/ssl.py
Lib/test/test_ssl.py
Misc/NEWS

diff --cc Lib/ssl.py
index 3162f56a37249b4a2dff18020d72fefe6b4f030e,e901b640a620a5c7315f47165ba399c96fe83ec2..5e5a5ce091d5eab836bb9a9a1fc00c5967f037bb
@@@ -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()
Simple merge
diff --cc Misc/NEWS
index 0646a74c6bf8f075c4c037fab85d0ffc1afd0efd,b035e24a2f83a15d58a40678c80871b15aafba32..9c0ea03fc43e44cbebc50f473b1be27049e7fee0
+++ 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.