changeset 25429:9d1c61715939

ssl: rename ssl_wrap_socket() to conform to our naming convention I've removed ssl_ prefix because the module name contains ssl.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 05 Jun 2015 21:25:28 +0900
parents 51e7acc34b0a
children 19fa0cb71cd3
files mercurial/httpconnection.py mercurial/mail.py mercurial/sslutil.py mercurial/url.py
diffstat 4 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/httpconnection.py	Fri Jun 05 07:49:06 2015 +0900
+++ b/mercurial/httpconnection.py	Fri Jun 05 21:25:28 2015 +0900
@@ -277,7 +277,7 @@
         kwargs.update(sslutil.sslkwargs(self.ui, host))
 
         con = HTTPConnection(host, port, use_ssl=True,
-                             ssl_wrap_socket=sslutil.ssl_wrap_socket,
+                             ssl_wrap_socket=sslutil.wrapsocket,
                              ssl_validator=sslutil.validator(self.ui, host),
                              **kwargs)
         return con
--- a/mercurial/mail.py	Fri Jun 05 07:49:06 2015 +0900
+++ b/mercurial/mail.py	Fri Jun 05 21:25:28 2015 +0900
@@ -45,8 +45,8 @@
             raise smtplib.SMTPException(msg)
         (resp, reply) = self.docmd("STARTTLS")
         if resp == 220:
-            self.sock = sslutil.ssl_wrap_socket(self.sock, keyfile, certfile,
-                                                **self._sslkwargs)
+            self.sock = sslutil.wrapsocket(self.sock, keyfile, certfile,
+                                           **self._sslkwargs)
             if not util.safehasattr(self.sock, "read"):
                 # using httplib.FakeSocket with Python 2.5.x or earlier
                 self.sock.read = self.sock.recv
@@ -74,9 +74,9 @@
             if self.debuglevel > 0:
                 print >> sys.stderr, 'connect:', (host, port)
             new_socket = socket.create_connection((host, port), timeout)
-            new_socket = sslutil.ssl_wrap_socket(new_socket,
-                                                 self.keyfile, self.certfile,
-                                                 **self._sslkwargs)
+            new_socket = sslutil.wrapsocket(new_socket,
+                                            self.keyfile, self.certfile,
+                                            **self._sslkwargs)
             self.file = smtplib.SSLFakeFile(new_socket)
             return new_socket
 else:
--- a/mercurial/sslutil.py	Fri Jun 05 07:49:06 2015 +0900
+++ b/mercurial/sslutil.py	Fri Jun 05 21:25:28 2015 +0900
@@ -21,9 +21,9 @@
         _canloaddefaultcerts = util.safehasattr(ssl_context,
                                                 'load_default_certs')
 
-        def ssl_wrap_socket(sock, keyfile, certfile, ui,
-                            cert_reqs=ssl.CERT_NONE,
-                            ca_certs=None, serverhostname=None):
+        def wrapsocket(sock, keyfile, certfile, ui,
+                       cert_reqs=ssl.CERT_NONE,
+                       ca_certs=None, serverhostname=None):
             # Allow any version of SSL starting with TLSv1 and
             # up. Note that specifying TLSv1 here prohibits use of
             # newer standards (like TLSv1_2), so this is the right way
@@ -55,9 +55,9 @@
                 raise util.Abort(_('ssl connection failed'))
             return sslsocket
     except AttributeError:
-        def ssl_wrap_socket(sock, keyfile, certfile, ui,
-                            cert_reqs=ssl.CERT_NONE,
-                            ca_certs=None, serverhostname=None):
+        def wrapsocket(sock, keyfile, certfile, ui,
+                       cert_reqs=ssl.CERT_NONE,
+                       ca_certs=None, serverhostname=None):
             sslsocket = ssl.wrap_socket(sock, keyfile, certfile,
                                         cert_reqs=cert_reqs, ca_certs=ca_certs,
                                         ssl_version=ssl.PROTOCOL_TLSv1)
@@ -72,9 +72,9 @@
 
     import socket, httplib
 
-    def ssl_wrap_socket(sock, keyfile, certfile, ui,
-                        cert_reqs=CERT_REQUIRED,
-                        ca_certs=None, serverhostname=None):
+    def wrapsocket(sock, keyfile, certfile, ui,
+                   cert_reqs=CERT_REQUIRED,
+                   ca_certs=None, serverhostname=None):
         if not util.safehasattr(socket, 'ssl'):
             raise util.Abort(_('Python SSL support not found'))
         if ca_certs:
--- a/mercurial/url.py	Fri Jun 05 07:49:06 2015 +0900
+++ b/mercurial/url.py	Fri Jun 05 21:25:28 2015 +0900
@@ -175,8 +175,8 @@
             self.sock.connect((self.host, self.port))
             if _generic_proxytunnel(self):
                 # we do not support client X.509 certificates
-                self.sock = sslutil.ssl_wrap_socket(self.sock, None, None, None,
-                                                    serverhostname=self.host)
+                self.sock = sslutil.wrapsocket(self.sock, None, None, None,
+                                               serverhostname=self.host)
         else:
             keepalive.HTTPConnection.connect(self)
 
@@ -338,7 +338,7 @@
             if self.realhostport: # use CONNECT proxy
                 _generic_proxytunnel(self)
                 host = self.realhostport.rsplit(':', 1)[0]
-            self.sock = sslutil.ssl_wrap_socket(
+            self.sock = sslutil.wrapsocket(
                 self.sock, self.key_file, self.cert_file, serverhostname=host,
                 **sslutil.sslkwargs(self.ui, host))
             sslutil.validator(self.ui, host)(self.sock)