Resolve merge conflicts
This commit is contained in:
commit
0ae76233ee
5 changed files with 24 additions and 16 deletions
|
|
@ -40,11 +40,9 @@ class SuppressGA(object):
|
|||
|
||||
self.protocol.protocol_flags["NOGOAHEAD"] = True
|
||||
# tell the client that we prefer to suppress GA ...
|
||||
self.protocol.will(SUPPRESS_GA).addCallbacks(self.do_suppress_ga, self.dont_suppress_ga)
|
||||
# ... but also accept if the client really wants not to.
|
||||
self.protocol.do(SUPPRESS_GA).addCallbacks(self.do_suppress_ga, self.dont_suppress_ga)
|
||||
self.protocol.will(SUPPRESS_GA).addCallbacks(self.will_suppress_ga, self.wont_suppress_ga)
|
||||
|
||||
def dont_suppress_ga(self, option):
|
||||
def wont_suppress_ga(self, option):
|
||||
"""
|
||||
Called when client requests to not suppress GA.
|
||||
|
||||
|
|
@ -55,9 +53,9 @@ class SuppressGA(object):
|
|||
self.protocol.protocol_flags["NOGOAHEAD"] = False
|
||||
self.protocol.handshake_done()
|
||||
|
||||
def do_suppress_ga(self, option):
|
||||
def will_suppress_ga(self, option):
|
||||
"""
|
||||
Client wants to suppress GA
|
||||
Client will suppress GA
|
||||
|
||||
Args:
|
||||
option (Option): Not used.
|
||||
|
|
|
|||
|
|
@ -243,11 +243,15 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
|||
line (str): Line to send.
|
||||
|
||||
"""
|
||||
# escape IAC in line mode, and correctly add \r\n
|
||||
line += self.delimiter
|
||||
line = line.replace(IAC, IAC + IAC).replace('\n', '\r\n')
|
||||
# escape IAC in line mode, and correctly add \r\n (the TELNET end-of-line)
|
||||
line = line.replace(IAC, IAC + IAC)
|
||||
line = line.replace('\n', '\r\n')
|
||||
if not self.protocol_flags.get("NOGOAHEAD", True):
|
||||
if self.protocol_flags.get("FORCEDENDLINE", False):
|
||||
line += "\r\n"
|
||||
line += IAC + GA
|
||||
elif not line.endswith("\r\n"):
|
||||
line += "\r\n"
|
||||
return self.transport.write(mccp_compress(self, line))
|
||||
|
||||
# Session hooks
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ class Ttype(object):
|
|||
"""
|
||||
self.ttype_step = 0
|
||||
self.protocol = protocol
|
||||
# we set FORCEDENDLINE for clients not supporting ttype
|
||||
self.protocol.protocol_flags["FORCEDENDLINE"] = True
|
||||
self.protocol.protocol_flags['TTYPE'] = False
|
||||
# is it a safe bet to assume ANSI is always supported?
|
||||
self.protocol.protocol_flags['ANSI'] = True
|
||||
|
|
@ -98,6 +100,10 @@ class Ttype(object):
|
|||
# just start the request chain
|
||||
self.protocol.requestNegotiation(TTYPE, SEND)
|
||||
|
||||
# for clients that support TTYPE we assume this is not needed
|
||||
# (they can set it manually if so)
|
||||
self.protocol.protocol_flags["FORCEDENDLINE"] = False
|
||||
|
||||
elif self.ttype_step == 1:
|
||||
# this is supposed to be the name of the client/terminal.
|
||||
# For clients not supporting the extended TTYPE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue