summaryrefslogtreecommitdiffstats
path: root/Lib/telnetlib.py
diff options
context:
space:
mode:
authorJack Diederich <jackdied@gmail.com>2009-04-10 05:33:26 (GMT)
committerJack Diederich <jackdied@gmail.com>2009-04-10 05:33:26 (GMT)
commit1c8f38c4f7d6db22d0de6f2a64a67536afbcd405 (patch)
treecfd1efe8a7e3f28400dec7293d5f8ca679cd5b77 /Lib/telnetlib.py
parent175cb23bb9796cc2e0cfe6b33b3fa6c1b89c4912 (diff)
downloadcpython-1c8f38c4f7d6db22d0de6f2a64a67536afbcd405.zip
cpython-1c8f38c4f7d6db22d0de6f2a64a67536afbcd405.tar.gz
cpython-1c8f38c4f7d6db22d0de6f2a64a67536afbcd405.tar.bz2
-fixes telnetlib constants to be one-length byte arrays instead of ints
-this fixes telnet negotiation (broken in 3.0) -merged/ported telnetlib tests from trunk (below) Merged revisions 71302,71377,71385 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r71302 | jack.diederich | 2009-04-05 22:08:44 -0400 (Sun, 05 Apr 2009) | 1 line test the telnetlib.Telnet interface more thoroughly ........ r71377 | jack.diederich | 2009-04-07 16:22:59 -0400 (Tue, 07 Apr 2009) | 1 line eliminate more race conditions in telnetlib tests ........ r71385 | jack.diederich | 2009-04-07 19:56:57 -0400 (Tue, 07 Apr 2009) | 4 lines - Make timing assertions very generous (a la test_timeout.py) - Break the gc cycle in negotiation tests - test the different guarantees of read_lazy and read_very_lazy ........
Diffstat (limited to 'Lib/telnetlib.py')
-rw-r--r--Lib/telnetlib.py146
1 files changed, 73 insertions, 73 deletions
diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py
index 14d05571..11e1a65 100644
--- a/Lib/telnetlib.py
+++ b/Lib/telnetlib.py
@@ -47,87 +47,87 @@ DEBUGLEVEL = 0
TELNET_PORT = 23
# Telnet protocol characters (don't change)
-IAC = 255 # "Interpret As Command"
-DONT = 254
-DO = 253
-WONT = 252
-WILL = 251
-theNULL = 0
-
-SE = 240 # Subnegotiation End
-NOP = 241 # No Operation
-DM = 242 # Data Mark
-BRK = 243 # Break
-IP = 244 # Interrupt process
-AO = 245 # Abort output
-AYT = 246 # Are You There
-EC = 247 # Erase Character
-EL = 248 # Erase Line
-GA = 249 # Go Ahead
-SB = 250 # Subnegotiation Begin
+IAC = bytes([255]) # "Interpret As Command"
+DONT = bytes([254])
+DO = bytes([253])
+WONT = bytes([252])
+WILL = bytes([251])
+theNULL = bytes([0])
+
+SE = bytes([240]) # Subnegotiation End
+NOP = bytes([241]) # No Operation
+DM = bytes([242]) # Data Mark
+BRK = bytes([243]) # Break
+IP = bytes([244]) # Interrupt process
+AO = bytes([245]) # Abort output
+AYT = bytes([246]) # Are You There
+EC = bytes([247]) # Erase Character
+EL = bytes([248]) # Erase Line
+GA = bytes([249]) # Go Ahead
+SB = bytes([250]) # Subnegotiation Begin
# Telnet protocol options code (don't change)
# These ones all come from arpa/telnet.h
-BINARY = 0 # 8-bit data path
-ECHO = 1 # echo
-RCP = 2 # prepare to reconnect
-SGA = 3 # suppress go ahead
-NAMS = 4 # approximate message size
-STATUS = 5 # give status
-TM = 6 # timing mark
-RCTE = 7 # remote controlled transmission and echo
-NAOL = 8 # negotiate about output line width
-NAOP = 9 # negotiate about output page size
-NAOCRD = 10 # negotiate about CR disposition
-NAOHTS = 11 # negotiate about horizontal tabstops
-NAOHTD = 12 # negotiate about horizontal tab disposition
-NAOFFD = 13 # negotiate about formfeed disposition
-NAOVTS = 14 # negotiate about vertical tab stops
-NAOVTD = 15 # negotiate about vertical tab disposition
-NAOLFD = 16 # negotiate about output LF disposition
-XASCII = 17 # extended ascii character set
-LOGOUT = 18 # force logout
-BM = 19 # byte macro
-DET = 20 # data entry terminal
-SUPDUP = 21 # supdup protocol
-SUPDUPOUTPUT = 22 # supdup output
-SNDLOC = 23 # send location
-TTYPE = 24 # terminal type
-EOR = 25 # end or record
-TUID = 26 # TACACS user identification
-OUTMRK = 27 # output marking
-TTYLOC = 28 # terminal location number
-VT3270REGIME = 29 # 3270 regime
-X3PAD = 30 # X.3 PAD
-NAWS = 31 # window size
-TSPEED = 32 # terminal speed
-LFLOW = 33 # remote flow control
-LINEMODE = 34 # Linemode option
-XDISPLOC = 35 # X Display Location
-OLD_ENVIRON = 36 # Old - Environment variables
-AUTHENTICATION = 37 # Authenticate
-ENCRYPT = 38 # Encryption option
-NEW_ENVIRON = 39 # New - Environment variables
+BINARY = bytes([0]) # 8-bit data path
+ECHO = bytes([1]) # echo
+RCP = bytes([2]) # prepare to reconnect
+SGA = bytes([3]) # suppress go ahead
+NAMS = bytes([4]) # approximate message size
+STATUS = bytes([5]) # give status
+TM = bytes([6]) # timing mark
+RCTE = bytes([7]) # remote controlled transmission and echo
+NAOL = bytes([8]) # negotiate about output line width
+NAOP = bytes([9]) # negotiate about output page size
+NAOCRD = bytes([10]) # negotiate about CR disposition
+NAOHTS = bytes([11]) # negotiate about horizontal tabstops
+NAOHTD = bytes([12]) # negotiate about horizontal tab disposition
+NAOFFD = bytes([13]) # negotiate about formfeed disposition
+NAOVTS = bytes([14]) # negotiate about vertical tab stops
+NAOVTD = bytes([15]) # negotiate about vertical tab disposition
+NAOLFD = bytes([16]) # negotiate about output LF disposition
+XASCII = bytes([17]) # extended ascii character set
+LOGOUT = bytes([18]) # force logout
+BM = bytes([19]) # byte macro
+DET = bytes([20]) # data entry terminal
+SUPDUP = bytes([21]) # supdup protocol
+SUPDUPOUTPUT = bytes([22]) # supdup output
+SNDLOC = bytes([23]) # send location
+TTYPE = bytes([24]) # terminal type
+EOR = bytes([25]) # end or record
+TUID = bytes([26]) # TACACS user identification
+OUTMRK = bytes([27]) # output marking
+TTYLOC = bytes([28]) # terminal location number
+VT3270REGIME = bytes([29]) # 3270 regime
+X3PAD = bytes([30]) # X.3 PAD
+NAWS = bytes([31]) # window size
+TSPEED = bytes([32]) # terminal speed
+LFLOW = bytes([33]) # remote flow control
+LINEMODE = bytes([34]) # Linemode option
+XDISPLOC = bytes([35]) # X Display Location
+OLD_ENVIRON = bytes([36]) # Old - Environment variables
+AUTHENTICATION = bytes([37]) # Authenticate
+ENCRYPT = bytes([38]) # Encryption option
+NEW_ENVIRON = bytes([39]) # New - Environment variables
# the following ones come from
# http://www.iana.org/assignments/telnet-options
# Unfortunately, that document does not assign identifiers
# to all of them, so we are making them up
-TN3270E = 40 # TN3270E
-XAUTH = 41 # XAUTH
-CHARSET = 42 # CHARSET
-RSP = 43 # Telnet Remote Serial Port
-COM_PORT_OPTION = 44 # Com Port Control Option
-SUPPRESS_LOCAL_ECHO = 45 # Telnet Suppress Local Echo
-TLS = 46 # Telnet Start TLS
-KERMIT = 47 # KERMIT
-SEND_URL = 48 # SEND-URL
-FORWARD_X = 49 # FORWARD_X
-PRAGMA_LOGON = 138 # TELOPT PRAGMA LOGON
-SSPI_LOGON = 139 # TELOPT SSPI LOGON
-PRAGMA_HEARTBEAT = 140 # TELOPT PRAGMA HEARTBEAT
-EXOPL = 255 # Extended-Options-List
-NOOPT = 0
+TN3270E = bytes([40]) # TN3270E
+XAUTH = bytes([41]) # XAUTH
+CHARSET = bytes([42]) # CHARSET
+RSP = bytes([43]) # Telnet Remote Serial Port
+COM_PORT_OPTION = bytes([44]) # Com Port Control Option
+SUPPRESS_LOCAL_ECHO = bytes([45]) # Telnet Suppress Local Echo
+TLS = bytes([46]) # Telnet Start TLS
+KERMIT = bytes([47]) # KERMIT
+SEND_URL = bytes([48]) # SEND-URL
+FORWARD_X = bytes([49]) # FORWARD_X
+PRAGMA_LOGON = bytes([138]) # TELOPT PRAGMA LOGON
+SSPI_LOGON = bytes([139]) # TELOPT SSPI LOGON
+PRAGMA_HEARTBEAT = bytes([140]) # TELOPT PRAGMA HEARTBEAT
+EXOPL = bytes([255]) # Extended-Options-List
+NOOPT = bytes([0])
class Telnet: