From 981b693402929dbe24f4f48cc5a42bb7b95b3285 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Wed, 20 Jul 2022 15:25:22 -0400 Subject: [PATCH] Make HTTPS protocols work with the protocol switcher magic. --- src/allmydata/protocol_switch.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/allmydata/protocol_switch.py b/src/allmydata/protocol_switch.py index 21d896793..d3e68f860 100644 --- a/src/allmydata/protocol_switch.py +++ b/src/allmydata/protocol_switch.py @@ -138,6 +138,13 @@ class _FoolscapOrHttps(Protocol, metaclass=_PretendToBeNegotiation): protocol = self.https_factory.buildProtocol(self.transport.getPeer()) protocol.makeConnection(self.transport) protocol.dataReceived(self._buffer) + + # Update the factory so it knows we're transforming to a new + # protocol object (we'll do that next) + value = self.https_factory.protocols.pop(protocol) + self.https_factory.protocols[self] = value + + # Transform self into the TLS protocol 🪄 self.__class__ = protocol.__class__ self.__dict__ = protocol.__dict__