handle clients that send only \r for enter key

This commit is contained in:
Jeremy Penner 2020-06-27 18:53:10 -04:00
parent 59f0fc890a
commit 23c1b75be4

View file

@ -142,11 +142,18 @@ class AnsiTelnet(protocol.Protocol):
self.client.removeDgQuit(self.transport.loseConnection)
self.client.quit()
class DOSNewlineTelnetTransport(telnet.TelnetTransport):
def dataReceived(self, data):
telnet.TelnetTransport.dataReceived(self, data)
if self.state == 'newline':
self.state = 'data'
self.applicationDataReceived(b'\r')
class AnsiFactory(ServerFactory):
def __init__(self, fnRun):
self.fnRun = fnRun
def buildProtocol(self, addr):
p = telnet.TelnetTransport(AnsiTelnet, engine.Client())
p = DOSNewlineTelnetTransport(AnsiTelnet, engine.Client())
p.factory = self
print "built protocol for ", addr
return p