diff --git a/httpcore/_backends/__init__.py b/httpcore/_backends/__init__.py index e69de29b..e96118bb 100644 --- a/httpcore/_backends/__init__.py +++ b/httpcore/_backends/__init__.py @@ -0,0 +1,17 @@ +import os +import sys +import warnings + +# [Windows Only] SSLKEYLOGFILE can trigger the "no OPENSSL_Applink" error. +# OpenSSL on Windows requires an 'Applink' interface to safely perform I/O +# (like logging keys) across different C-Runtimes (CRT). Since CPython doesn't +# provide this bridge and manages I/O independently, OpenSSL fails to access +# Windows stdio, leading to a crash or the "no OPENSSL_Applink" error. +if os.environ.get("SSLKEYLOGFILE") and sys.platform == "win32": + warnings.warn( + "Detected SSLKEYLOGFILE environment variable, which may cause " + "'no OPENSSL_Applink' errors. If you encounter this issue, try " + "unsetting or removing the variable temporarily.", + UserWarning, + 2, + )