diff --git a/elastic_transport/_node/_http_httpx.py b/elastic_transport/_node/_http_httpx.py index ecbb0b0..04ceb60 100644 --- a/elastic_transport/_node/_http_httpx.py +++ b/elastic_transport/_node/_http_httpx.py @@ -158,6 +158,14 @@ async def perform_request( # type: ignore[override] ) elif isinstance(e, ssl.SSLError): err = TlsError(str(e), errors=(e,)) + # Detect SSL errors for httpx v0.28.0+ + # Needed until https://github.com/encode/httpx/issues/3350 is fixed + elif isinstance(e, httpx.ConnectError) and e.__cause__: + context = e.__cause__.__context__ + if isinstance(context, ssl.SSLError): + err = TlsError(str(context), errors=(e,)) + else: + err = ConnectionError(str(e), errors=(e,)) else: err = ConnectionError(str(e), errors=(e,)) self._log_request( diff --git a/setup.py b/setup.py index da2e556..b317cd4 100644 --- a/setup.py +++ b/setup.py @@ -65,8 +65,6 @@ "requests", "aiohttp", "httpx", - # https://github.com/encode/httpx/discussions/3214#discussioncomment-10830925 - "httpcore<1.0.6", "respx", "opentelemetry-api", "opentelemetry-sdk",