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
c28d4708
Commit
c28d4708
authored
Jun 23, 2002
by
Piers Lauder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix IMAP4_SSL read and send methods to take account of short data
parent
2c99866d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
Lib/imaplib.py
Lib/imaplib.py
+16
-3
No files found.
Lib/imaplib.py
View file @
c28d4708
...
...
@@ -18,7 +18,7 @@ Public functions: Internaldate2tuple
# IMAP4_SSL contributed by Tino Lange <Tino.Lange@isg.de> March 2002.
# GET/SETQUOTA contributed by Andreas Zeidler <az@kreativkombinat.de> June 2002.
__version__
=
"2.5
2
"
__version__
=
"2.5
3
"
import
binascii
,
re
,
socket
,
time
,
random
,
sys
...
...
@@ -1056,11 +1056,17 @@ class IMAP4_SSL(IMAP4):
def
read
(
self
,
size
):
"""Read 'size' bytes from remote."""
return
self
.
sslobj
.
read
(
size
)
# sslobj.read() sometimes returns < size bytes
data
=
self
.
sslobj
.
read
(
size
)
while
len
(
data
)
<
size
:
data
+=
self
.
sslobj
.
read
(
len
(
data
)
-
size
)
return
data
def
readline
(
self
):
"""Read line from remote."""
# NB: socket.ssl needs a "readline" method, or perhaps a "makefile" method.
line
=
""
while
1
:
char
=
self
.
sslobj
.
read
(
1
)
...
...
@@ -1070,7 +1076,14 @@ class IMAP4_SSL(IMAP4):
def
send
(
self
,
data
):
"""Send data to remote."""
self
.
sslobj
.
write
(
data
)
# NB: socket.ssl needs a "sendall" method to match socket objects.
bytes
=
len
(
data
)
while
bytes
>
0
:
sent
=
self
.
sslobj
.
write
(
data
)
if
sent
==
bytes
:
break
# avoid copy
data
=
data
[
sent
:]
bytes
=
bytes
-
sent
def
shutdown
(
self
):
...
...
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