ClickHouse/tests/integration/helpers/ssl_context.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
388 B
Python
Raw Normal View History

import ssl
class WrapSSLContextWithSNI(ssl.SSLContext):
def __new__(cls, ssl_host, *args, **kwargs):
self = super().__new__(cls, *args, **kwargs)
self._server_hostname = ssl_host
return self
def wrap_socket(self, sock, *args, **kwargs):
kwargs["server_hostname"] = self._server_hostname
return super().wrap_socket(sock, *args, **kwargs)