This is an archive of the discontinued Mercurial Phabricator instance.

sslutil: avoid deprecation warnings from python 3.10's ssl module
ClosedPublic

Authored by jcristau on Apr 9 2022, 8:44 AM.

Details

Summary

Use ssl.PROTOCOL_TLS_{CLIENT,SERVER} and
SSLContext.{min,max}imum_version when supported (3.7+).

And, catch deprecation warnings when the user asks for deprecated TLS
versions (1.0 and 1.1).

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jcristau created this revision.Apr 9 2022, 8:44 AM
Alphare requested changes to this revision.Apr 12 2022, 9:36 AM
Alphare added a subscriber: Alphare.
Alphare added inline comments.
mercurial/sslutil.py
328

I still prefer giving a real error message in supposed unreachable conditions in case they become reachable some ways down the road

This revision now requires changes to proceed.Apr 12 2022, 9:36 AM
jcristau added inline comments.Apr 12 2022, 9:47 AM
mercurial/sslutil.py
328

This is the exact same error message that's already there for the python < 3.7 case (in commonssloptions), so any improvement on that feels like it belongs in a different patch.

Alphare accepted this revision.Apr 12 2022, 10:26 AM

Right, that's fine, thanks!

This revision is now accepted and ready to land.Apr 12 2022, 10:26 AM