handle clients that send only \r for enter key
This commit is contained in:
parent
59f0fc890a
commit
23c1b75be4
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue