Commits

Yuya Nishihara committed 7ac3e1d

sync: postpone port number handling until getfingerprint request (refs #1910)

I'll insert warning about invalid port number, which should be visible only
if user try to query certificate.

Comments (0)

Files changed (1)

tortoisehg/hgqt/sync.py

         super(SecureDialog, self).__init__(parent)
 
         def genfingerprint():
+            if port is None:
+                portnum = 443
+            else:
+                portnum = int(port)
             try:
-                pem = ssl.get_server_certificate( (host, port) )
+                pem = ssl.get_server_certificate( (host, portnum) )
                 der = ssl.PEM_cert_to_DER_cert(pem)
             except Exception, e:
                 qtlib.WarningMsgBox(_('Certificate Query Error'),
             le.setText(pretty)
 
         user, host, port, folder, passwd, scheme = parseurl(origurl)
-        if port is None:
-            port = 443
-        else:
-            port = int(port)
         uhost = hglib.tounicode(host)
         self.setWindowTitle(_('Security: ') + uhost)
         self.setWindowFlags(self.windowFlags() & \