Convert the telnet protocols over for Py3.
This commit is contained in:
parent
1da3e0caa0
commit
b88c74a316
8 changed files with 63 additions and 55 deletions
|
|
@ -9,11 +9,12 @@ NAWS allows telnet clients to report their current window size to the
|
|||
client and update it when the size changes
|
||||
|
||||
"""
|
||||
from codecs import encode as codecs_encode
|
||||
from builtins import object
|
||||
from django.conf import settings
|
||||
|
||||
NAWS = chr(31)
|
||||
IS = chr(0)
|
||||
NAWS = b'\x1f'
|
||||
IS = b'\x00'
|
||||
# default taken from telnet specification
|
||||
DEFAULT_WIDTH = settings.CLIENT_DEFAULT_WIDTH
|
||||
DEFAULT_HEIGHT = settings.CLIENT_DEFAULT_HEIGHT
|
||||
|
|
@ -76,6 +77,6 @@ class Naws(object):
|
|||
if len(options) == 4:
|
||||
# NAWS is negotiated with 16bit words
|
||||
width = options[0] + options[1]
|
||||
self.protocol.protocol_flags['SCREENWIDTH'][0] = int(width.encode('hex'), 16)
|
||||
self.protocol.protocol_flags['SCREENWIDTH'][0] = int(codecs_encode(width, 'hex'), 16)
|
||||
height = options[2] + options[3]
|
||||
self.protocol.protocol_flags['SCREENHEIGHT'][0] = int(height.encode('hex'), 16)
|
||||
self.protocol.protocol_flags['SCREENHEIGHT'][0] = int(codecs_encode(height, 'hex'), 16)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue