-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
Self sign certificate validation is getting failed when using requests 2.23.5 with urllib3 2.5.0. It works with urllib3 1.26.20 version. Any version above 1.26.20 fails to validate certificates.
Expected Result
Certificate should be validated.
Actual Result
Traceback (most recent call last):
File "/home/user/.local/lib/python3.9/site-packages/requests/adapters.py", line 644, in send
resp = conn.urlopen(
File "/home/user/.local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 843, in urlopen
retries = retries.increment(
File "/home/user/.local/lib/python3.9/site-packages/urllib3/util/retry.py", line 519, in increment
raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='', port=): Max retries exceeded with url: /api/v3/health (Caused by SSLError(SSLCertVerificationError(1, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for ''. (_ssl.c:1129)")))
Reproduction Steps
import requests
requests.get(url, verify=<certificate_path>)
System Information
$ python -m requests.help
{
"chardet": {
"version": null
},
"charset_normalizer": {
"version": "3.4.4"
},
"cryptography": {
"version": ""
},
"idna": {
"version": "3.11"
},
"implementation": {
"name": "CPython",
"version": "3.9.16"
},
"platform": {
"release": "5.15.0-1092-azure",
"system": "Linux"
},
"pyOpenSSL": {
"openssl_version": "",
"version": null
},
"requests": {
"version": "2.32.5"
},
"system_ssl": {
"version": "101010ef"
},
"urllib3": {
"version": "2.5.0"
},
"using_charset_normalizer": true,
"using_pyopenssl": false
}