Author: Amaury Forgeot d'Arc <[email protected]>
Branch: stdlib-2.7.9
Changeset: r75520:360740259e7f
Date: 2015-01-25 21:27 +0100
http://bitbucket.org/pypy/pypy/changeset/360740259e7f/

Log:    Add SSLSocket.version()

diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
--- a/pypy/module/_ssl/interp_ssl.py
+++ b/pypy/module/_ssl/interp_ssl.py
@@ -548,6 +548,14 @@
             return space.w_None
         return space.wrap(rffi.charp2str(short_name))
 
+    def version_w(self, space):
+        if not self.ssl:
+            return space.w_None
+        version = libssl_SSL_get_version(self.ssl)
+        if not version:
+            return space.w_None
+        return space.wrap(rffi.charp2str(version))
+
 _SSLSocket.typedef = TypeDef(
     "_ssl._SSLSocket",
 
@@ -560,6 +568,7 @@
     shutdown=interp2app(_SSLSocket.shutdown),
     selected_npn_protocol = interp2app(_SSLSocket.selected_npn_protocol),
     compression = interp2app(_SSLSocket.compression_w),
+    version = interp2app(_SSLSocket.version_w),
 )
 
 
diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py
--- a/rpython/rlib/ropenssl.py
+++ b/rpython/rlib/ropenssl.py
@@ -283,6 +283,7 @@
 ssl_external('SSL_set_read_ahead', [SSL, rffi.INT], lltype.Void)
 ssl_external('SSL_set_tlsext_host_name', [SSL, rffi.CCHARP], rffi.INT, 
macro=True)
 ssl_external('SSL_get_current_compression', [SSL], COMP_METHOD)
+ssl_external('SSL_get_version', [SSL], rffi.CCHARP)
 
 ssl_external('SSL_get_peer_certificate', [SSL], X509)
 ssl_external('X509_get_subject_name', [X509], X509_NAME)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to