Add IAC+GA for telnet messaging, as per #1330.

This commit is contained in:
Griatch 2017-06-04 11:25:17 +02:00
parent cbf2e44dc8
commit b269ef265e
2 changed files with 6 additions and 2 deletions

View file

@ -221,7 +221,7 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
# escape IAC in line mode, and correctly add \r\n
line += self.delimiter
line = line.replace(IAC, IAC + IAC).replace('\n', '\r\n')
return self.transport.write(mccp_compress(self, line))
return self.transport.write(mccp_compress(self, line + IAC + GA))
# Session hooks

View file

@ -47,7 +47,11 @@ IAC = chr(255)
SB = chr(250)
SE = chr(240)
force_str = lambda inp: to_str(inp, force_string=True)
def force_str(inp):
"""Helper to shorten code"""
return to_str(inp, force_string=True)
# pre-compiled regexes
# returns 2-tuple