From: Piers Lauder Date: Sun, 21 Oct 2001 20:26:37 +0000 (+0000) Subject: fix send method not noticing when partial sends happen X-Git-Tag: v2.2.1c1~1131 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0402dd18cb025b7510760142087c97729702e23a;p=python fix send method not noticing when partial sends happen --- diff --git a/Lib/imaplib.py b/Lib/imaplib.py index 005cf16019..204148bc8e 100644 --- a/Lib/imaplib.py +++ b/Lib/imaplib.py @@ -222,7 +222,13 @@ class IMAP4: def send(self, data): """Send data to remote.""" - self.sock.send(data) + bytes = len(data) + while bytes > 0: + sent = self.sock.send(data) + if sent == bytes: + break # avoid copy + data = data[sent:] + bytes = bytes - sent def shutdown(self):