diff --git a/.gitignore b/.gitignore index edcd9a737b358396cb6e5d1b8a53e81a02bd135b..09f8269f82c2cdbbdd628f46dea715769407fe75 100755 --- a/.gitignore +++ b/.gitignore @@ -40,4 +40,4 @@ venv/ *.DS_Store /python/socketd/socketD.egg-info/ -/python/socketd/test/cases/ssl/ +#/python/socketd/test/cases/ssl/ diff --git a/python/socketd/socketd/transport/client/ClientBase.py b/python/socketd/socketd/transport/client/ClientBase.py index f73a68bcf471df4d553858f755e7fa2ff6d46b20..d50c5848fcb4ba244f8af3630ae507e0979434d1 100644 --- a/python/socketd/socketd/transport/client/ClientBase.py +++ b/python/socketd/socketd/transport/client/ClientBase.py @@ -11,10 +11,10 @@ from socketd.transport.core.ChannelAssistant import ChannelAssistant from socketd.transport.core.Costants import Constants from socketd.transport.core.Session import Session from socketd.transport.client.ClientHeartbeatHandler import ClientHeartbeatHandler +from socketd.transport.core.impl.LogConfig import log from socketd.transport.core.impl.ProcessorDefault import ProcessorDefault from socketd.transport.client.ClientConfig import ClientConfig -from loguru import logger class ClientBase(ClientInternal, ABC): @@ -76,13 +76,13 @@ class ClientBase(ClientInternal, ABC): try: await clientChannel.connect() - logger.info(f"Socket.D client successfully connected: link={self.get_config().get_link_url()}") + log.info(f"Socket.D client successfully connected: link={self.get_config().get_link_url()}") except Exception as e: if isThrow: await clientChannel.close(code=Constants.CLOSE2008_OPEN_FAIL) raise SocketDException(f"Socket.D client Connection failed {e}") else: - logger.info(f"Socket.D client Connection failed: link={self.get_config().get_link_url()}") + log.info(f"Socket.D client Connection failed: link={self.get_config().get_link_url()}") return clientChannel.get_session() diff --git a/python/socketd/socketd/transport/client/ClientChannel.py b/python/socketd/socketd/transport/client/ClientChannel.py index 9c5d68571743cbb8af5bc1def8fff3267b5dcced..1ebdbb3ba92c009870fb7ac70dc9dc557cd9b4dc 100644 --- a/python/socketd/socketd/transport/client/ClientChannel.py +++ b/python/socketd/socketd/transport/client/ClientChannel.py @@ -6,11 +6,11 @@ from socketd.transport.client.Client import ClientInternal from socketd.transport.core.Asserts import Asserts from socketd.transport.core.ChannelInternal import ChannelInternal from socketd.transport.core.Costants import Constants +from socketd.transport.core.impl.LogConfig import log from socketd.transport.core.impl.SessionDefault import SessionDefault from socketd.transport.stream.StreamManger import StreamInternal from socketd.transport.core.impl.ChannelBase import ChannelBase from socketd.transport.client.ClientConnector import ClientConnector -from loguru import logger from socketd.transport.client.ClientHeartbeatHandler import ClientHeartbeatHandlerDefault from socketd.transport.utils.sync_api.AtomicRefer import AtomicRefer @@ -40,7 +40,7 @@ class ClientChannel(ChannelBase): if not self.__heartbeatScheduledFuture.done(): self.__heartbeatScheduledFuture.cancel() except Exception as e: - logger.warning(e) + log.warning(e) async def __heartbeatScheduled(self) -> None: while True: @@ -60,7 +60,7 @@ class ClientChannel(ChannelBase): return if Asserts.is_closed_and_end(self.__real): - logger.debug("Client channel is closed (pause heartbeat), sessionId=" + self.get_session().session_id()) + log.debug("Client channel is closed (pause heartbeat), sessionId=" + self.get_session().session_id()) await self.close(self.__real.is_closed()) return @@ -136,7 +136,7 @@ class ClientChannel(ChannelBase): if self.__real: await self.__real.close(code) except Exception as e: - logger.error(e) + log.error(e) finally: await super().close(code) @@ -150,7 +150,7 @@ class ClientChannel(ChannelBase): self.init_heartbeat() await self.internalCheck() - @logger.catch + @log.catch async def connect(self): with self.__isConnecting as isConnected: if isConnected: @@ -166,9 +166,9 @@ class ClientChannel(ChannelBase): self.__real.set_session(self.__sessionShell) self.set_handshake(self.__real.get_handshake()) except TimeoutError as t: - logger.error(f"socketD connect timed out: {t}") + log.error(f"socketD connect timed out: {t}") except Exception as e: - logger.error(e) + log.error(e) raise SocketDChannelException(f"socketD connect") finally: self.__isConnecting.set(False) diff --git a/python/socketd/socketd/transport/core/Channel.py b/python/socketd/socketd/transport/core/Channel.py index 5e00602980eea0cf0f30c2755944d7f6a80c4198..9c9906195183543ff3b6bf0c289a804ab5c16b20 100644 --- a/python/socketd/socketd/transport/core/Channel.py +++ b/python/socketd/socketd/transport/core/Channel.py @@ -87,7 +87,7 @@ class Channel(ABC): ... @abstractmethod - def retrieve(self, frame: Frame, stream: StreamInternal) -> None: + async def retrieve(self, frame: Frame, stream: StreamInternal) -> None: ... @abstractmethod diff --git a/python/socketd/socketd/transport/core/impl/ChannelDefault.py b/python/socketd/socketd/transport/core/impl/ChannelDefault.py index b58b5cf447957a2a2c897fcffcdbf876e0df3961..12c2110e119dd9216600ec196621728daf49cb08 100644 --- a/python/socketd/socketd/transport/core/impl/ChannelDefault.py +++ b/python/socketd/socketd/transport/core/impl/ChannelDefault.py @@ -106,7 +106,7 @@ class ChannelDefault(ChannelBase, ChannelInternal): if stream is not None: stream.on_progress(True, 1, 1) - def retrieve(self, frame: Frame, stream: StreamInternal) -> None: + async def retrieve(self, frame: Frame, stream: StreamInternal) -> None: """接收(接收答复帧)""" if stream is not None: if stream.demands() < Constants.DEMANDS_MULTIPLE or frame.flag() == Flags.ReplyEnd: @@ -115,11 +115,11 @@ class ChannelDefault(ChannelBase, ChannelInternal): if stream.demands() < Constants.DEMANDS_MULTIPLE: # 单收时,内部已经是异步机制 - stream.on_reply(frame.message()) + await stream.on_reply(frame.message()) else: - #stream.on_reply(frame.message()) # 改为异步处理,避免卡死Io线程 - asyncio.get_running_loop().run_in_executor(self.get_config().get_exchange_executor(), lambda _m: asyncio.run(stream.on_reply(_m)), frame.message()) + asyncio.get_running_loop().run_in_executor(self.get_config().get_exchange_executor(), + lambda _m: asyncio.run(stream.on_reply(_m)), frame.message()) else: log.debug( f"{self.get_config().get_role_name()} stream not found, sid={frame.message().sid()}, sessionId={self.get_session().session_id()}") diff --git a/python/socketd/socketd/transport/core/impl/LogConfig.py b/python/socketd/socketd/transport/core/impl/LogConfig.py index 30084bf3cf5ed4325a1306c515e14f888281d441..135e33b7a358c030a516fa356dca8796201a4278 100644 --- a/python/socketd/socketd/transport/core/impl/LogConfig.py +++ b/python/socketd/socketd/transport/core/impl/LogConfig.py @@ -2,10 +2,12 @@ from loguru import logger as _logger import logging + # socket.d 默认 logger = logging.getLogger("socketD") # 异步默认日志 logging.getLogger("asyncio").setLevel(logging.WARNING) # 少用默认logging ,因为他会阻塞你的线程 - -log = _logger.opt() \ No newline at end of file +# 删除原本的处理器 +_logger.remove() +log = _logger.opt(colors=True) diff --git a/python/socketd/socketd/transport/core/impl/ProcessorDefault.py b/python/socketd/socketd/transport/core/impl/ProcessorDefault.py index f8451a4287c85369d34b7c28f24f77feca5ee20d..e2575cefb78996947759603882c277f7ba511d61 100644 --- a/python/socketd/socketd/transport/core/impl/ProcessorDefault.py +++ b/python/socketd/socketd/transport/core/impl/ProcessorDefault.py @@ -1,8 +1,6 @@ import asyncio from abc import ABC -from typing import Optional, Union - -from loguru import logger +from typing import Optional from socketd.exception.SocketDExecption import SocketDAlarmException, SocketDConnectionException from socketd.transport.core.ChannelInternal import ChannelInternal @@ -13,17 +11,15 @@ from socketd.transport.core.Costants import Constants from socketd.transport.core.Flags import Flags from socketd.transport.core.EntityMetas import EntityMetas from socketd.transport.core.Frame import Frame +from socketd.transport.core.impl.LogConfig import log from socketd.transport.core.listener.SimpleListener import SimpleListener -from socketd.transport.stream.Stream import Stream from socketd.transport.stream.StreamManger import StreamInternal -from socketd.transport.utils.AsyncUtil import AsyncUtil class ProcessorDefault(Processor, ABC): def __init__(self): self.listener = SimpleListener() - self.log = logger.opt() def set_listener(self, listener): if listener is not None: @@ -31,9 +27,9 @@ class ProcessorDefault(Processor, ABC): async def on_receive(self, channel: ChannelInternal, frame): if channel.get_config().client_mode(): - logger.debug(f"C-REV:{frame}") + log.debug(f"C-REV:{frame}") else: - logger.debug(f"S-REV:{frame}") + log.debug(f"S-REV:{frame}") if frame.flag() == Flags.Connect: # if server @@ -42,7 +38,7 @@ class ProcessorDefault(Processor, ABC): async def _future(r: bool, e: Exception): if r: - #如果无异常 + # 如果无异常 if channel.is_valid(): try: await channel.send_connack(connectMessage) @@ -67,7 +63,8 @@ class ProcessorDefault(Processor, ABC): if frame.flag() == Flags.Close: raise SocketDConnectionException("Connection request was rejected") - self.log.warning("{} channel handshake is None, sessionId={}", channel.get_config().get_role_name(), channel.get_session().session_id()) + log.warning("{} channel handshake is None, sessionId={}", channel.get_config().get_role_name(), + channel.get_session().session_id()) return # 更新最后活动时间 @@ -79,9 +76,9 @@ class ProcessorDefault(Processor, ABC): elif frame.flag() == Flags.Pong: pass elif frame.flag() == Flags.Close: - code:int = 0 + code: int = 0 - if frame.message() is not None: + if frame.message() is not None: code = frame.message().meta_as_int("code") if code == 0: @@ -141,7 +138,7 @@ class ProcessorDefault(Processor, ABC): if isReply: if stream: stream.on_progress(False, streamIndex, streamTotal) - channel.retrieve(frame, stream) + await channel.retrieve(frame, stream) else: self.on_message(channel, frame.message()) @@ -153,7 +150,7 @@ class ProcessorDefault(Processor, ABC): await self.listener.on_open(channel.get_session()) channel.do_open_future(True, None) except Exception as e: - logger.warning("{} channel listener onOpen error", channel.get_config().get_role_name(), e) + log.warning("{} channel listener onOpen error", channel.get_config().get_role_name(), e) channel.do_open_future(False, e) def on_message(self, channel: ChannelInternal, message: Message): @@ -163,12 +160,12 @@ class ProcessorDefault(Processor, ABC): try: await self.listener.on_message(channel.get_session(), message) except Exception as e: - logger.warning("{} channel listener onMessage error", channel.get_config().get_role_name(), e) + log.warning("{} channel listener onMessage error", channel.get_config().get_role_name(), e) self.on_error(channel, e) def on_close(self, channel: ChannelInternal): if channel.is_closed() <= Constants.CLOSE1000_PROTOCOL_CLOSE_STARTING: - self.on_close_internal(channel, Constants.CLOSE2003_DISCONNECTION) + asyncio.create_task(self.on_close_internal(channel, Constants.CLOSE2003_DISCONNECTION)) async def on_close_internal(self, channel: ChannelInternal, code: int): await channel.close(code) @@ -178,4 +175,3 @@ class ProcessorDefault(Processor, ABC): def on_error(self, channel: ChannelInternal, error): self.listener.on_error(channel.get_session(), error) - diff --git a/python/socketd/socketd_aio_tcp/TcpAioClientConnector.py b/python/socketd/socketd_aio_tcp/TcpAioClientConnector.py index 99df520434cead7ea4a66a3b72ef128dfa9a3403..45d6b273b1faf25edf3c49a653435627948ff26c 100644 --- a/python/socketd/socketd_aio_tcp/TcpAioClientConnector.py +++ b/python/socketd/socketd_aio_tcp/TcpAioClientConnector.py @@ -36,7 +36,7 @@ class TcpAioClientConnector(ClientConnectorBase): async def connect(self): # 处理自定义架构的影响 loop = asyncio.get_running_loop() - tcp_url = self.client.get_config().get_url().replace("std:", "").replace("-python", "") + tcp_url = self.client.get_config().get_url().replace("-python", "") _sch, _host, _port = tcp_url.replace("//", "").split(":") _port = int(_port.split("/")[0]) if self.__top is None: diff --git a/python/socketd/socketd_websocket/WsAioClientConnector.py b/python/socketd/socketd_websocket/WsAioClientConnector.py index 60632f6fd5488594e6cf0123294c3d693100f32d..f02005984d41a8b63afde16d515840a924d9e508 100644 --- a/python/socketd/socketd_websocket/WsAioClientConnector.py +++ b/python/socketd/socketd_websocket/WsAioClientConnector.py @@ -25,7 +25,7 @@ class WsAioClientConnector(ClientConnectorBase): async def connect(self) -> Channel: # 关闭之前的资源 - self.close() + await self.close() # 处理自定义架构的影响 ws_url = self.client.get_config().get_url().replace("-python://", "://") diff --git a/python/socketd/socketd_websocket/impl/AIOWebSocketClientImpl.py b/python/socketd/socketd_websocket/impl/AIOWebSocketClientImpl.py index c497877a7a47b330676d0656783c7e4eb4dd7bd9..6fb477b9da6d532cc302cf45e168a46c1e1dc7d5 100644 --- a/python/socketd/socketd_websocket/impl/AIOWebSocketClientImpl.py +++ b/python/socketd/socketd_websocket/impl/AIOWebSocketClientImpl.py @@ -128,7 +128,8 @@ class AIOWebSocketClientImpl(WebSocketClientProtocol): async def on_close(self): await self.client.get_processor().on_close(self.channel) if self.handshake_future is not None: - await asyncio.wait(self.__on_receive_tasks, timeout=10) + if self.__on_receive_tasks: + await asyncio.wait(self.__on_receive_tasks, timeout=10) await asyncio.wait([self._handler_future], timeout=10) def on_error(self, e): diff --git a/python/socketd/test/base_test/01_applictionTest.py b/python/socketd/test/base_test/01_applictionTest.py index a576d8b74b9402fcf5bc0b36552afe7f73d617d4..f175cfb0a2fd34b7e97cb8434cd3303874b949c0 100644 --- a/python/socketd/test/base_test/01_applictionTest.py +++ b/python/socketd/test/base_test/01_applictionTest.py @@ -15,10 +15,10 @@ from test.uitls import calc_async_time # 超过一定数量会导致异步并发发生异常 -COUNT = 10000 +COUNT = 100 log.remove() -log.add(sys.stderr, level="INFO") +log.add(sys.stderr, level="INFO", enqueue=True) @calc_async_time @@ -28,7 +28,7 @@ async def application_test(): server_session: WebSocketServer = await server.listen( SimpleListenerTest()).start() await asyncio.sleep(1) - client_session: Session = await SocketD.create_client("std:ws://127.0.0.1:9999").open() + client_session: Session = await SocketD.create_client("sd:ws://127.0.0.1:9999").open() log.info(f"client send count: {COUNT} ...") # 单向发送 diff --git a/python/socketd/test/cases/TestCase13_ssl.py b/python/socketd/test/cases/TestCase13_ssl.py index 3b67084b35f88ac3111d45a56f74982189fd55dc..be294729608f2b5cea95d6ba268eaafd3972fe79 100644 --- a/python/socketd/test/cases/TestCase13_ssl.py +++ b/python/socketd/test/cases/TestCase13_ssl.py @@ -16,16 +16,21 @@ from loguru import logger def get_s_ssl(): - ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) - ssl_context.load_cert_chain(certfile=r"D:\java_items\socketd\python\socketd\test\cases\ssl\test.pem", - keyfile=r"D:\java_items\socketd\python\socketd\test\cases\ssl\test.key") + ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + ssl_context.check_hostname = False + ssl_context.load_cert_chain(certfile=r"D:\java_items\socketd\python\socketd\test\cases\ssl\server.crt", + keyfile=r"D:\java_items\socketd\python\socketd\test\cases\ssl\server.key") return ssl_context def get_c_ssl(): - ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER) + ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) + ssl_context.verify_mode = ssl.CERT_REQUIRED # 强制要求进行证书验证 ssl_context.check_hostname = False - ssl_context.load_verify_locations(r"D:\java_items\socketd\python\socketd\test\cases\ssl\test.pem") + # 添加 CA 证书路径 + ssl_context.load_cert_chain(certfile=r"D:\java_items\socketd\python\socketd\test\cases\ssl\client.crt", + keyfile=r"D:\java_items\socketd\python\socketd\test\cases\ssl\client.key") + ssl_context.load_verify_locations(r"D:\java_items\socketd\python\socketd\test\cases\ssl\server.crt") return ssl_context @@ -40,7 +45,7 @@ class TestCase13_ssl(BaseTestCase): async def _start(self): s = SimpleListenerTest() - self.server: Server = SocketD.create_server(ServerConfig(self.schema).port(self.port)) + self.server: Server = SocketD.create_server(ServerConfig("ws").port(self.port)) def s_config_handler(config: ServerConfig | ClientConfig): config.idle_timeout(10000) @@ -50,7 +55,7 @@ class TestCase13_ssl(BaseTestCase): self.server_session: WebSocketServer = await self.server.config(s_config_handler).listen( s).start() await asyncio.sleep(1) - serverUrl = self.schema + "://127.0.0.1:" + str(self.port) + "/path?u=a&p=2" + serverUrl = "ws" + "://127.0.0.1:" + str(self.port) + "/path?u=a&p=2" def c_config_handler(config: ServerConfig | ClientConfig): config.idle_timeout(10000) diff --git a/python/socketd/test/cases/ssl/client.crt b/python/socketd/test/cases/ssl/client.crt new file mode 100644 index 0000000000000000000000000000000000000000..5a220fbdbdf52edde71ff89d5c40b61a5fd69d1c --- /dev/null +++ b/python/socketd/test/cases/ssl/client.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDOTCCAiGgAwIBAgIUNrn2wB4slBRBwkMVQIWl4tV5yyowDQYJKoZIhvcNAQEL +BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM +GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA0MDEwMzU3NTdaFw0yNTA0 +MDEwMzU3NTdaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw +HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQCcnxN8ICBp73IaBgOBHE+hLLqvd1spODwUU2AL++Ow +ojjLZMRk3Klxr5bfhUnX1Cmrw5NzFp5oAvoBKNJONSe4C1kcRqYIkWAiO49J9S2M +PcBJ6caoJpw8GLYKCr6qxFaWeh8DGdyxOP6vchP+yHxR3O403dUOPqdhpxko3yNi +q6k6yYSv/kwz/ilR0bk4SfxWD1yABay7s1PZgjicSZ6+eqxsopOgSeWQcRPjXMJ+ +Z3B6rxUZMxlitlKBcf0ZKlt+Iyn3diby8YrxJ2M5xTPDbxXzJbyVRTxclPlYv8lT +scHNFXTiKMneEVN732Wu7+LifiVg/LvYTL7am+8jSyCDAgMBAAGjITAfMB0GA1Ud +DgQWBBTNTjS1SoTK8J404JzER/+fkZ9fpjANBgkqhkiG9w0BAQsFAAOCAQEAlCF3 +4mlYJbAaw+8j+EIU+yEFAHWfNF/IgfqMb8p8KawEXpWYzqZTyVz8FMdBY9CWLG0l +0sP5gM0wRECE/ijMTnKmBwo+X/p19vFqszVvEvY7GcOoDk2mz1sExWICIOHpvmna +/8WjQBxgqS2riSjx+YjMky334jPFGJvNzA/a8ZHpQY0HRu8y588nAXBLQSM/tden +cMoj0Jpb4mJ9MOBl4Amho1ryAOfKtVnhm4w+uv2ekWj6aGycMAY0ZfnblYFvQhrk +j8BpYDJCy2H7Fze4ocz1pmjMV7e5uzUoplNLDVd0gLY01QUrmv5oI54aZPfZGrQL +WV6pAGfZkoClK7+Sag== +-----END CERTIFICATE----- diff --git a/python/socketd/test/cases/ssl/client.csr b/python/socketd/test/cases/ssl/client.csr new file mode 100644 index 0000000000000000000000000000000000000000..5af5dc7ea2484cad79f4df3fe9a430544b19229b --- /dev/null +++ b/python/socketd/test/cases/ssl/client.csr @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICijCCAXICAQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx +ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAJyfE3wgIGnvchoGA4EcT6Esuq93Wyk4PBRTYAv7 +47CiOMtkxGTcqXGvlt+FSdfUKavDk3MWnmgC+gEo0k41J7gLWRxGpgiRYCI7j0n1 +LYw9wEnpxqgmnDwYtgoKvqrEVpZ6HwMZ3LE4/q9yE/7IfFHc7jTd1Q4+p2GnGSjf +I2KrqTrJhK/+TDP+KVHRuThJ/FYPXIAFrLuzU9mCOJxJnr56rGyik6BJ5ZBxE+Nc +wn5ncHqvFRkzGWK2UoFx/RkqW34jKfd2JvLxivEnYznFM8NvFfMlvJVFPFyU+Vi/ +yVOxwc0VdOIoyd4RU3vfZa7v4uJ+JWD8u9hMvtqb7yNLIIMCAwEAAaAAMA0GCSqG +SIb3DQEBCwUAA4IBAQAFFU8asiOG1QaCNrS8L1UG0YFtQzlQNrxx02X8BJiZhh0a +dFf8RaR7SAO20CdaUvkfUsnTveNlVPB8tJPc8/7JQlJTQtfEAr6F1lZQ/dF8yAxv +znA9MZn587y/uq+eBIBNhBHqvoJ7javMDveUt2Ct/hNVHWRAZOleeSwzE8+PJVAg +A2nMTnQId07MsZZzNdJyODSgozEko2g4WL7U6JovTMlQvWMUJu2vLLnqyUp6QMDU +NHnLx6BNL6/G2m/uOYYaI21YyDcttd3bsl2cogitEbsmCEiNQfp61N7XpQLGA2Rq +xnULCqjxEXldK6rGSdHBqTyfqVOVMQF2d+PjpDGZ +-----END CERTIFICATE REQUEST----- diff --git a/python/socketd/test/cases/ssl/client.key b/python/socketd/test/cases/ssl/client.key new file mode 100644 index 0000000000000000000000000000000000000000..4ba971619cb6e33745b36f498295e5b3b7c2966d --- /dev/null +++ b/python/socketd/test/cases/ssl/client.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCcnxN8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4YvKD2GfBT6tnvAXq6/4IWeIcP9qRXbVojH +dHTVeWjqizCw8i9ZqAad59/gMk2J1rm2VolIoYju1AXtFlu657y7igfYLaJ4CgVi +FyRngBNen4yH6uGr6ewgu1Qa3are+H/CpdpCzHY5iRO7f6vzvZ4L14gLwQKBgGDn +pwOAK/ss5C8SarXgO4GxV8mYMbhw0vGd4Wj4cI6nzyM5ViTd2r5jI75FKn/+HvSN +NRuExSyNNIiX6+YH/pyQlvIn5I8orL5hPfPuORv59fjQB7amWFc4sXXxjuBtUucp +PmHOO9Guw4ehxEDEZESNIsY+OzsFYm4F2YK9SOPjAoGBAK92/3uQsGY7Wwc7v4sr +eOITfQFv3L6iG+Y2Wg8JVIliQUNqs64zEefFeGdDDx7RUXzjRS8nHxJ1l4HHH6Tr +2GjzF34iD7PspxiTZ9MBhXto1LrYU7IjAYcDnZNcEWsDWsvPIQBtqxZ7uIRGNUnA +gpV5TOAcIksDxXUixt6a5+b2 +-----END PRIVATE KEY----- diff --git a/python/socketd/test/cases/ssl/server.crt b/python/socketd/test/cases/ssl/server.crt new file mode 100644 index 0000000000000000000000000000000000000000..6bc48b21a2995fb98e42d62277402ce3af0cb11f --- /dev/null +++ b/python/socketd/test/cases/ssl/server.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDOTCCAiGgAwIBAgIUR/ujToKwUYpkIU1ZAkikIjMREKUwDQYJKoZIhvcNAQEL +BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM +GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yNDA0MDEwMzU3MzlaFw0yNTA0 +MDEwMzU3MzlaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw +HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB +AQUAA4IBDwAwggEKAoIBAQDeaeUNln8q0I+rmEqDuHWedmhUAfGjrz6HluoZ+DsT +RVZJQFCVZ4KtLarIJamvhFVmDaRp2ZN/e4Kq2aSCW8j47Hs6dWyNYQgclqCdZFC+ +KCBVk4iysTgAXWuDX1jbZD9RsuRGJLTLlD5fILaIsGVi0AKHb2cC+pfGN8hICTqk +3cEm+cGCaz7UovBl0XR4OcE88bev6/plzdkjxEY9WfpUS5MncIojWP7iy4NCHnd1 +2J/9Ba0GUj2Ka7aEHSx/+gLt8OxBsQt4N2D0NUVf3LjLVIy3Ea31ywlzQFZudAay +ZK/pYUwmT8bLN1Nh/JDxHtAAWa0D0ir7Pwap1QH/QxHZAgMBAAGjITAfMB0GA1Ud +DgQWBBR3a5NkfVMhAyhAQ9dAxZZh3qRQFjANBgkqhkiG9w0BAQsFAAOCAQEAPAbb +CWupGtRhrWuGBsHSmk1hqYHHlG22fpz0tp7B7h3YKP03Y0L/7kOJ8hKr1NqFaPiA +qO8/YBomI7wda/x6Q4q//QGzvjjShG87ONAN6Dl3F+ouulDKdAn5OrDPlpkANuNy +yqBViidPcnRNLwf2/vJ9b6g0MM8+Sj4viHxM4u5aB2VzB6w1tZUuY5zY8USMubQn +YAegPispP7gAU3U6iceJHkNEbMh6VO8/704PjNge57Az4yVT4gBJmq0+x7DIVAi1 +/FLmkMD5zcxGj043dRZphwiUQI8Jhc1ycxvR0I5uqgrrtQG3UVVGqawuq/aeRdWk +5eiJEJZtCeaY5zzLpA== +-----END CERTIFICATE----- diff --git a/python/socketd/test/cases/ssl/server.csr b/python/socketd/test/cases/ssl/server.csr new file mode 100644 index 0000000000000000000000000000000000000000..80d9ac401644bb7d9d56fc61795a50c60c895738 --- /dev/null +++ b/python/socketd/test/cases/ssl/server.csr @@ -0,0 +1,16 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIICijCCAXICAQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx +ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAN5p5Q2WfyrQj6uYSoO4dZ52aFQB8aOvPoeW6hn4 +OxNFVklAUJVngq0tqsglqa+EVWYNpGnZk397gqrZpIJbyPjsezp1bI1hCByWoJ1k +UL4oIFWTiLKxOABda4NfWNtkP1Gy5EYktMuUPl8gtoiwZWLQAodvZwL6l8Y3yEgJ +OqTdwSb5wYJrPtSi8GXRdHg5wTzxt6/r+mXN2SPERj1Z+lRLkydwiiNY/uLLg0Ie +d3XYn/0FrQZSPYprtoQdLH/6Au3w7EGxC3g3YPQ1RV/cuMtUjLcRrfXLCXNAVm50 +BrJkr+lhTCZPxss3U2H8kPEe0ABZrQPSKvs/BqnVAf9DEdkCAwEAAaAAMA0GCSqG +SIb3DQEBCwUAA4IBAQAJaM0gOhNAGOjVqngyvGXyH/ntRdb8FDJsAi7jVmR6Wmn7 +1o6ncgcNEqRGXceiV9xFt54zSwR7YGHSXCc0+BL7akKPQtbW6aAFZYNtr1mpjuUr +ZUTUMl0YjI+xV5V27O8t66ooPLh0mOIiyVaSnogslT3mhlfwQq1fnRVSOVJEIK40 +no0baUa9DVDpZbSJXWVCCvkCvmKUiBR0mdab5kGKfaY1rsU2DgIqN0FI06Qd/hkm +H80rqbBwhJBp6dPgM1snXjXjsGRKTrg2Hm24yKLUizuw1om+2xkDzltyrBEB8DeP +dE3vWT7MknZXZurKT56La9c46DSTgjwvjyDLqah/ +-----END CERTIFICATE REQUEST----- diff --git a/python/socketd/test/cases/ssl/server.key b/python/socketd/test/cases/ssl/server.key new file mode 100644 index 0000000000000000000000000000000000000000..b502da3d531b0c91f168ab394e124ec3aec04815 --- /dev/null +++ b/python/socketd/test/cases/ssl/server.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDeaeUNln8q0I+r +mEqDuHWedmhUAfGjrz6HluoZ+DsTRVZJQFCVZ4KtLar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