psf / requests

A simple, yet elegant, HTTP library.
https://requests.readthedocs.io/en/latest/
Apache License 2.0
52.2k stars 9.34k forks source link

Support for "DEFAULT_CIPHERS" requests > 2.31.0 is broken #6831

Open snooppr opened 5 days ago

snooppr commented 5 days ago

GNU/Linux, deb, Python 3.8 Android/Termux, Python 3.11.5

Urllib3 = 1.26.18, 1.26.20 Requests = 2.32.3

import requests
requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':!DH'
print(requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS)

ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20:ECDH+AESGCM:DH+AESGCM:ECDH+AES:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!eNULL:!MD5:!DSS:!DH

r = requests.get("https://nhl.ru")

SSLError(SSLError(1, '[SSL: DH_KEY_TOO_SMALL]

Solution: roll back to Requests 2.31.0 Reported: https://github.com/psf/requests/issues/6827