test.test_httplib.HTTPSTest.test_networked_good_cert fails with OpenSSL 4.1.0

Ouverte
#160,823 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
56/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
python
Domaine
networking, testing

Piste de recherche

Start with test/test_httplib.py, especially HTTPSTest.test_networked_good_cert around the reported failing request, and read the linked OpenSSL issue for the certificate verification change. Determine how the test certificate and hostname interact with OpenSSL 4.1.0; done means the test correctly checks a valid certificate and passes with the changed OpenSSL behavior.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

extension-modules topic-SSL type-bug
Bug report
======================================================================
ERROR: test_networked_good_cert (test.test_httplib.HTTPSTest.test_networked_good_cert)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.15/test/test_httplib.py", line 2247, in test_networked_good_cert
    h.request('GET', '/')
    ~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib/python3.15/http/client.py", line 1398, in request
    self._send_request(method, url, body, headers, encode_chunked)
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/http/client.py", line 1444, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/http/client.py", line 1393, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/http/client.py", line 1153, in _send_output
    self.send(msg)
    ~~~~~~~~~^^^^^
  File "/usr/lib/python3.15/http/client.py", line 1097, in send
    self.connect()
    ~~~~~~~~~~~~^^
  File "/usr/lib/python3.15/http/client.py", line 1543, in connect
    self.sock = self._context.wrap_socket(self.sock,
                ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
                                          server_hostname=server_hostname)
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.15/ssl.py", line 469, in wrap_socket
    return self.sslsocket_class._create(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        sock=sock,
        ^^^^^^^^^^
    ...<5 lines>...
        session=session
        ^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3.15/ssl.py", line 1103, in _create
    self.do_handshake()
    ~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.15/ssl.py", line 1434, in do_handshake
    self._sslobj.do_handshake()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'self-signed.pythontest.net'. (_ssl.c:1147)

----------------------------------------------------------------------

Apparently this is caused by an intentional change in OpenSSL, see https://github.com/openssl/openssl/issues/33420.

CPython versions tested on:

3.15

Operating systems tested on:

Linux

Langage dominant
Python
Étoiles
77.8k
Forks
37.7k
Merge moyen
17 h 2 min
PR mergées (30 j)
699

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de python/cpython

Toutes les issues de python/cpython

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.