Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
36596a3c
Commit
36596a3c
authored
Jul 26, 2009
by
Jack Diederich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fix issue #6106, Telnet.process_rawq default handling of WILL/WONT/DO/DONT
parent
f346ac08
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
1 deletion
+51
-1
Lib/telnetlib.py
Lib/telnetlib.py
+1
-1
Lib/test/test_telnetlib.py
Lib/test/test_telnetlib.py
+46
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/telnetlib.py
View file @
36596a3c
...
...
@@ -459,7 +459,7 @@ class Telnet:
# unless we did a WILL/DO before.
self
.
msg
(
'IAC %d not recognized'
%
ord
(
c
))
elif
len
(
self
.
iacseq
)
==
2
:
cmd
=
self
.
iacseq
[
1
]
cmd
=
self
.
iacseq
[
1
:
2
]
self
.
iacseq
=
b''
opt
=
c
if
cmd
in
(
DO
,
DONT
):
...
...
Lib/test/test_telnetlib.py
View file @
36596a3c
...
...
@@ -3,6 +3,8 @@ import threading
import
telnetlib
import
time
import
queue
import
sys
import
io
from
unittest
import
TestCase
from
test
import
support
...
...
@@ -304,6 +306,20 @@ class nego_collector(object):
self
.
sb_seen
+=
sb_data
tl
=
telnetlib
class
TelnetDebuglevel
(
tl
.
Telnet
):
''' Telnet-alike that captures messages written to stdout when
debuglevel > 0
'''
_messages
=
''
def
msg
(
self
,
msg
,
*
args
):
orig_stdout
=
sys
.
stdout
sys
.
stdout
=
fake_stdout
=
io
.
StringIO
()
tl
.
Telnet
.
msg
(
self
,
msg
,
*
args
)
self
.
_messages
+=
fake_stdout
.
getvalue
()
sys
.
stdout
=
orig_stdout
return
class
OptionTests
(
TestCase
):
setUp
=
_read_setUp
tearDown
=
_read_tearDown
...
...
@@ -363,6 +379,36 @@ class OptionTests(TestCase):
self
.
assertEqual
(
b''
,
telnet
.
read_sb_data
())
nego
.
sb_getter
=
None
# break the nego => telnet cycle
def
_test_debuglevel
(
self
,
data
,
expected_msg
):
""" helper for testing debuglevel messages """
self
.
setUp
()
self
.
dataq
.
put
(
data
)
telnet
=
TelnetDebuglevel
(
HOST
,
self
.
port
)
telnet
.
set_debuglevel
(
1
)
self
.
dataq
.
join
()
txt
=
telnet
.
read_all
()
self
.
assertTrue
(
expected_msg
in
telnet
.
_messages
,
msg
=
(
telnet
.
_messages
,
expected_msg
))
self
.
tearDown
()
def
test_debuglevel
(
self
):
# test all the various places that self.msg(...) is called
given_a_expect_b
=
[
# Telnet.fill_rawq
(
b'a'
,
": recv b''
\
n
"
),
# Telnet.process_rawq
(
tl
.
IAC
+
bytes
([
88
]),
": IAC 88 not recognized
\
n
"
),
(
tl
.
IAC
+
tl
.
DO
+
bytes
([
1
]),
": IAC DO 1
\
n
"
),
(
tl
.
IAC
+
tl
.
DONT
+
bytes
([
1
]),
": IAC DONT 1
\
n
"
),
(
tl
.
IAC
+
tl
.
WILL
+
bytes
([
1
]),
": IAC WILL 1
\
n
"
),
(
tl
.
IAC
+
tl
.
WONT
+
bytes
([
1
]),
": IAC WONT 1
\
n
"
),
# Telnet.write
# XXX, untested
]
for
a
,
b
in
given_a_expect_b
:
self
.
_test_debuglevel
([
a
,
EOF_sigil
],
b
)
return
def
test_main
(
verbose
=
None
):
support
.
run_unittest
(
GeneralTests
,
ReadTests
,
OptionTests
)
...
...
Misc/ACKS
View file @
36596a3c
...
...
@@ -709,6 +709,7 @@ Michael Stone
Ken Stox
Dan Stromberg
Daniel Stutzbach
Pal Subbiah
Nathan Sullivan
Mark Summerfield
Hisao Suzuki
...
...
Misc/NEWS
View file @
36596a3c
...
...
@@ -60,6 +60,9 @@ C-API
Library
-------
- Issue #6106: telnetlib.Telnet.process_rawq doesn't handle default WILL/WONT
DO/DONT correctly.
- Issue #1424152: Fix for http.client, urllib.request to support SSL while
working through proxy. Original patch by Christopher Li, changes made by
Senthil Kumaran
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment