[New-bugs-announce] [issue35422] misleading error message from ssl.get_server_certificate() when bad port

Cédric Van Rompay report at bugs.python.org
Wed Dec 5 16:24:32 EST 2018


New submission from Cédric Van Rompay <cedric.vanrompay at gmail.com>:

When calling ssl.get_server_certificate() with a bad port number (I used 80 when I should have been using 443), the error raised is a bit misleading:

    >>> import ssl
    >>> ssl.get_server_certificate(('gitlab.com',80))
    [...]
    SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:847)

"SSL: wrong version number" seems to indicate that there is a mismatch between SSL versions supported by the client and the ones supported by the server. When here I guess the problem would better be described as "there is no SSL available at this address+port".

----------
assignee: christian.heimes
components: SSL
messages: 331171
nosy: cedricvanrompay, christian.heimes
priority: normal
severity: normal
status: open
title: misleading error message from ssl.get_server_certificate() when bad port
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35422>
_______________________________________


More information about the New-bugs-announce mailing list