Ejemplo n.º 1
0
    def startTLS(self, ctx, normal=True):
        """
        @see: L{ITLSTransport.startTLS}
        """
        if self.dataBuffer or self._tempDataBuffer:
            # pre-TLS bytes are still being written.  Starting TLS now
            # will do the wrong thing.  Instead, mark that we're trying
            # to go into the TLS state.
            self._tlsWaiting = _TLSDelayed([], ctx, normal)
            return False

        startTLS(self, ctx, normal, FileDescriptor)
Ejemplo n.º 2
0
    def startTLS(self, ctx, normal=True):
        """
        @see: L{ITLSTransport.startTLS}
        """
        if self.dataBuffer or self._tempDataBuffer:
            # pre-TLS bytes are still being written.  Starting TLS now
            # will do the wrong thing.  Instead, mark that we're trying
            # to go into the TLS state.
            self._tlsWaiting = _TLSDelayed([], ctx, normal)
            return False

        startTLS(self, ctx, normal, FileDescriptor)
Ejemplo n.º 3
0
    def startTLS(self, ctx, extra=True):
        assert not self.TLS
        if self.dataBuffer or self._tempDataBuffer:
            # pre-TLS bytes are still being written.  Starting TLS now
            # will do the wrong thing.  Instead, mark that we're trying
            # to go into the TLS state.
            self._tlsWaiting = _TLSDelayed([], ctx, extra)
            return False

        self.stopReading()
        self.stopWriting()
        self._startTLS()
        self.socket = SSL.Connection(ctx.getContext(), self.socket)
        self.fileno = self.socket.fileno
        self.startReading()
        return True
Ejemplo n.º 4
0
    def startTLS(self, ctx, extra=True):
        assert not self.TLS
        if self.dataBuffer or self._tempDataBuffer:
            # pre-TLS bytes are still being written.  Starting TLS now
            # will do the wrong thing.  Instead, mark that we're trying
            # to go into the TLS state.
            self._tlsWaiting = _TLSDelayed([], ctx, extra)
            return False

        self.stopReading()
        self.stopWriting()
        self._startTLS()
        self.socket = SSL.Connection(ctx.getContext(), self.socket)
        self.fileno = self.socket.fileno
        self.startReading()
        return True