Further refactor when an extra endline is added with the FORCEDENDLINE option
This commit is contained in:
parent
9d34cd9956
commit
3a3f2bfe9e
2 changed files with 4 additions and 5 deletions
|
|
@ -234,12 +234,10 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
# escape IAC in line mode, and correctly add \r\n (the TELNET end-of-line)
|
# escape IAC in line mode, and correctly add \r\n (the TELNET end-of-line)
|
||||||
line = line.replace(IAC, IAC + IAC)
|
line = line.replace(IAC, IAC + IAC)
|
||||||
line = line.replace('\n', '\r\n')
|
line = line.replace('\n', '\r\n')
|
||||||
if not self.protocol_flags.get("NOGOAHEAD", True):
|
if not line.endswith("\r\n") and self.protocol_flags.get("FORCEDENDLINE", True):
|
||||||
if self.protocol_flags.get("FORCEDENDLINE", False):
|
|
||||||
line += "\r\n"
|
|
||||||
line += IAC + GA
|
|
||||||
elif not line.endswith("\r\n"):
|
|
||||||
line += "\r\n"
|
line += "\r\n"
|
||||||
|
if not self.protocol_flags.get("NOGOAHEAD", True):
|
||||||
|
line += IAC + GA
|
||||||
return self.transport.write(mccp_compress(self, line))
|
return self.transport.write(mccp_compress(self, line))
|
||||||
|
|
||||||
# Session hooks
|
# Session hooks
|
||||||
|
|
|
||||||
|
|
@ -113,6 +113,7 @@ class Ttype(object):
|
||||||
# only support after a certain version, but all support
|
# only support after a certain version, but all support
|
||||||
# it since at least 4 years. We assume recent client here for now.
|
# it since at least 4 years. We assume recent client here for now.
|
||||||
cupper = clientname.upper()
|
cupper = clientname.upper()
|
||||||
|
xterm256 = False
|
||||||
if cupper.startswith("MUDLET"):
|
if cupper.startswith("MUDLET"):
|
||||||
# supports xterm256 stably since 1.1 (2010?)
|
# supports xterm256 stably since 1.1 (2010?)
|
||||||
xterm256 = cupper.split("MUDLET", 1)[1].strip() >= "1.1"
|
xterm256 = cupper.split("MUDLET", 1)[1].strip() >= "1.1"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue