test.test_httplib.HTTPSTest.test_networked_good_cert fails with OpenSSL 4.1.0

未关闭
#160,823 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
56/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
python

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Python
星标
77.8k
派生
37.7k
平均合并
17 小时 2 分钟
30 天内合并 PR
699

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

python/cpython 的其他 Issue

查看 python/cpython 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。