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
800b6dc7
Commit
800b6dc7
authored
Feb 10, 2014
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge with 3.3
parent
ed55b4a1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
5 deletions
+41
-5
Doc/tools/sphinxext/susp-ignored.csv
Doc/tools/sphinxext/susp-ignored.csv
+1
-0
Lib/idlelib/NEWS.txt
Lib/idlelib/NEWS.txt
+0
-1
Lib/smtplib.py
Lib/smtplib.py
+4
-1
Lib/test/mock_socket.py
Lib/test/mock_socket.py
+7
-2
Lib/test/test_smtplib.py
Lib/test/test_smtplib.py
+29
-1
No files found.
Doc/tools/sphinxext/susp-ignored.csv
View file @
800b6dc7
...
...
@@ -282,3 +282,4 @@ whatsnew/changelog,,:PythonCmd,"With Tk < 8.5 _tkinter.c:PythonCmd() raised Unic
whatsnew/changelog,,::,": Fix FTP tests for IPv6, bind to ""::1"" instead of ""localhost""."
whatsnew/changelog,,::,": Use ""127.0.0.1"" or ""::1"" instead of ""localhost"" as much as"
whatsnew/changelog,,:password,user:password
whatsnew/changelog,,:gz,w:gz
Lib/idlelib/NEWS.txt
View file @
800b6dc7
...
...
@@ -875,4 +875,3 @@ What's New in IDLEfork 0.9 Alpha 1?
--------------------------------------------------------------------
Refer to HISTORY.txt for additional information on earlier releases.
--------------------------------------------------------------------
Lib/smtplib.py
View file @
800b6dc7
...
...
@@ -62,6 +62,7 @@ SMTP_PORT = 25
SMTP_SSL_PORT
=
465
CRLF
=
"
\
r
\
n
"
bCRLF
=
b"
\
r
\
n
"
_MAXLINE
=
8192
# more than 8 times larger than RFC 821, 4.5.3
OLDSTYLE_AUTH
=
re
.
compile
(
r"auth=(.*)"
,
re
.
I
)
...
...
@@ -365,7 +366,7 @@ class SMTP:
self.file = self.sock.makefile('rb')
while 1:
try:
line = self.file.readline()
line = self.file.readline(
_MAXLINE + 1
)
except OSError as e:
self.close()
raise SMTPServerDisconnected("Connection unexpectedly closed: "
...
...
@@ -375,6 +376,8 @@ class SMTP:
raise SMTPServerDisconnected("Connection unexpectedly closed")
if self.debuglevel > 0:
print('
reply
:
', repr(line), file=stderr)
if len(line) > _MAXLINE:
raise SMTPResponseException(500, "Line too long.")
resp.append(line[4:].strip(b'
\
t
\
r
\
n
'))
code = line[:3]
# Check that the error code is syntactically correct.
...
...
Lib/test/mock_socket.py
View file @
800b6dc7
...
...
@@ -21,8 +21,13 @@ class MockFile:
"""
def
__init__
(
self
,
lines
):
self
.
lines
=
lines
def
readline
(
self
):
return
self
.
lines
.
pop
(
0
)
+
b'
\
r
\
n
'
def
readline
(
self
,
limit
=-
1
):
result
=
self
.
lines
.
pop
(
0
)
+
b'
\
r
\
n
'
if
limit
>=
0
:
# Re-insert the line, removing the \r\n we added.
self
.
lines
.
insert
(
0
,
result
[
limit
:
-
2
])
result
=
result
[:
limit
]
return
result
def
close
(
self
):
pass
...
...
Lib/test/test_smtplib.py
View file @
800b6dc7
...
...
@@ -563,6 +563,33 @@ class BadHELOServerTests(unittest.TestCase):
HOST
,
self
.
port
,
'localhost'
,
3
)
@
unittest
.
skipUnless
(
threading
,
'Threading required for this test.'
)
class
TooLongLineTests
(
unittest
.
TestCase
):
respdata
=
b'250 OK'
+
(
b'.'
*
smtplib
.
_MAXLINE
*
2
)
+
b'
\
n
'
def
setUp
(
self
):
self
.
old_stdout
=
sys
.
stdout
self
.
output
=
io
.
StringIO
()
sys
.
stdout
=
self
.
output
self
.
evt
=
threading
.
Event
()
self
.
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
sock
.
settimeout
(
15
)
self
.
port
=
support
.
bind_port
(
self
.
sock
)
servargs
=
(
self
.
evt
,
self
.
respdata
,
self
.
sock
)
threading
.
Thread
(
target
=
server
,
args
=
servargs
).
start
()
self
.
evt
.
wait
()
self
.
evt
.
clear
()
def
tearDown
(
self
):
self
.
evt
.
wait
()
sys
.
stdout
=
self
.
old_stdout
def
testLineTooLong
(
self
):
self
.
assertRaises
(
smtplib
.
SMTPResponseException
,
smtplib
.
SMTP
,
HOST
,
self
.
port
,
'localhost'
,
3
)
sim_users
=
{
'Mr.A@somewhere.com'
:
'John A'
,
'Ms.B@xn--fo-fka.com'
:
'Sally B'
,
'Mrs.C@somewhereesle.com'
:
'Ruth C'
,
...
...
@@ -888,7 +915,8 @@ class SMTPSimTests(unittest.TestCase):
def
test_main
(
verbose
=
None
):
support
.
run_unittest
(
GeneralTests
,
DebuggingServerTests
,
NonConnectingTests
,
BadHELOServerTests
,
SMTPSimTests
)
BadHELOServerTests
,
SMTPSimTests
,
TooLongLineTests
)
if
__name__
==
'__main__'
:
test_main
()
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