diff mercurial/sslutil.py @ 49117:27ef2aa953dd

sslutil: support TLSV1_ALERT_PROTOCOL_VERSION reason code It looks like python 3.10 returns a different reason code on protocol version mismatch. Differential Revision: https://phab.mercurial-scm.org/D12491
author Julien Cristau <jcristau@debian.org>
date Sat, 09 Apr 2022 14:41:55 +0200
parents 50bd2910d162
children be3828081624
line wrap: on
line diff
--- a/mercurial/sslutil.py	Sat Apr 09 14:28:17 2022 +0200
+++ b/mercurial/sslutil.py	Sat Apr 09 14:41:55 2022 +0200
@@ -425,7 +425,10 @@
             # outright. Hopefully the reason for this error is that we require
             # TLS 1.1+ and the server only supports TLS 1.0. Whatever the
             # reason, try to emit an actionable warning.
-            if e.reason == 'UNSUPPORTED_PROTOCOL':
+            if e.reason in (
+                'UNSUPPORTED_PROTOCOL',
+                'TLSV1_ALERT_PROTOCOL_VERSION',
+            ):
                 # We attempted TLS 1.0+.
                 if settings[b'minimumprotocol'] == b'tls1.0':
                     # We support more than just TLS 1.0+. If this happens,