(
sock: socket.socket,
ssl_context: ssl.SSLContext,
tls_in_tls: bool,
server_hostname: str | None = None,
)
| 459 | |
| 460 | |
| 461 | def _ssl_wrap_socket_impl( |
| 462 | sock: socket.socket, |
| 463 | ssl_context: ssl.SSLContext, |
| 464 | tls_in_tls: bool, |
| 465 | server_hostname: str | None = None, |
| 466 | ) -> ssl.SSLSocket | SSLTransportType: |
| 467 | if tls_in_tls: |
| 468 | if not SSLTransport: |
| 469 | # Import error, ssl is not available. |
| 470 | raise ProxySchemeUnsupported( |
| 471 | "TLS in TLS requires support for the 'ssl' module" |
| 472 | ) |
| 473 | |
| 474 | SSLTransport._validate_ssl_context_for_tls_in_tls(ssl_context) |
| 475 | return SSLTransport(sock, ssl_context, server_hostname) |
| 476 | |
| 477 | return ssl_context.wrap_socket(sock, server_hostname=server_hostname) |
no test coverage detected