From 66aa1c1ffee3c1f387aa5ac283b153251d7a6ff9 Mon Sep 17 00:00:00 2001 From: Kar Petrosyan <92274156+karpetrosyan@users.noreply.github.com> Date: Thu, 2 Nov 2023 14:50:23 +0400 Subject: [PATCH] Fix synchronous TLS-in-TLS streams (#840) * Fix synchronous TLS-in-TLS * changelog --- CHANGELOG.md | 1 + httpcore/_backends/sync.py | 6 ------ 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc8ca42b..5f11dc97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased - Fix pool timeout to account for the total time spent retrying. (#823) +- Fix synchronous TLS-in-TLS streams. (#840) ## 1.0.0 (October 6th, 2023) diff --git a/httpcore/_backends/sync.py b/httpcore/_backends/sync.py index f2dbd32a..7b7b417d 100644 --- a/httpcore/_backends/sync.py +++ b/httpcore/_backends/sync.py @@ -145,12 +145,6 @@ def start_tls( server_hostname: typing.Optional[str] = None, timeout: typing.Optional[float] = None, ) -> NetworkStream: - if isinstance(self._sock, ssl.SSLSocket): # pragma: no cover - raise RuntimeError( - "Attempted to add a TLS layer on top of the existing " - "TLS stream, which is not supported by httpcore package" - ) - exc_map: ExceptionMapping = { socket.timeout: ConnectTimeout, OSError: ConnectError,