python
network_error
ai_generated
true
httpx.ConnectError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123) while connecting to 'http://api.example.com'
ID: python/httpx-connecterror-ssl-wrong-version
80%Fix Rate
88%Confidence
0Evidence
2024-10-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
Attempting to use HTTPS on a plain HTTP port, or vice versa, causing SSL handshake failure.
generic中文
尝试在普通HTTP端口上使用HTTPS,反之亦然,导致SSL握手失败。
Workarounds
-
95% success Use the correct protocol (http vs https) matching the server configuration
httpx.get('http://api.example.com') # if server uses HTTP, not HTTPS -
90% success Use the correct port explicitly
httpx.get('https://api.example.com:443') # ensure port 443 for HTTPS
Dead Ends
Common approaches that don't work:
-
Disabling SSL verification
80% fail
The issue is not certificate validation but protocol mismatch; disabling SSL does not help.
-
Using a different SSL/TLS version in the client
90% fail
The server likely does not support SSL on that port at all.