summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/ftplib.py8
-rw-r--r--Lib/gopherlib.py2
-rw-r--r--Lib/httplib.py2
-rw-r--r--Lib/imaplib.py9
-rw-r--r--Lib/nntplib.py2
-rw-r--r--Lib/poplib.py2
-rwxr-xr-xLib/smtplib.py4
-rw-r--r--Lib/socket.py4
-rw-r--r--Lib/telnetlib.py6
9 files changed, 15 insertions, 24 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 6234f7f..cad7a5b 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -168,7 +168,7 @@ class FTP:
def putline(self, line):
line = line + CRLF
if self.debugging > 1: print '*put*', self.sanitize(line)
- self.sock.send(line)
+ self.sock.sendall(line)
# Internal: send one command to the server (through putline())
def putcmd(self, line):
@@ -231,7 +231,7 @@ class FTP:
tried. Instead, just send the ABOR command as OOB data.'''
line = 'ABOR' + CRLF
if self.debugging > 1: print '*put urgent*', self.sanitize(line)
- self.sock.send(line, MSG_OOB)
+ self.sock.sendall(line, MSG_OOB)
resp = self.getmultiline()
if resp[:3] not in ('426', '226'):
raise error_proto, resp
@@ -417,7 +417,7 @@ class FTP:
while 1:
buf = fp.read(blocksize)
if not buf: break
- conn.send(buf)
+ conn.sendall(buf)
conn.close()
return self.voidresp()
@@ -431,7 +431,7 @@ class FTP:
if buf[-2:] != CRLF:
if buf[-1] in CRLF: buf = buf[:-1]
buf = buf + CRLF
- conn.send(buf)
+ conn.sendall(buf)
conn.close()
return self.voidresp()
diff --git a/Lib/gopherlib.py b/Lib/gopherlib.py
index 8dea566..03d12ec 100644
--- a/Lib/gopherlib.py
+++ b/Lib/gopherlib.py
@@ -66,7 +66,7 @@ def send_selector(selector, host, port = 0):
port = int(port)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
- s.send(selector + CRLF)
+ s.sendall(selector + CRLF)
s.shutdown(1)
return s.makefile('rb')
diff --git a/Lib/httplib.py b/Lib/httplib.py
index cd0bdb9..04cfca6 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -403,7 +403,7 @@ class HTTPConnection:
if self.debuglevel > 0:
print "send:", repr(str)
try:
- self.sock.send(str)
+ self.sock.sendall(str)
except socket.error, v:
if v[0] == 32: # Broken pipe
self.close()
diff --git a/Lib/imaplib.py b/Lib/imaplib.py
index 04d4d87..03513a3 100644
--- a/Lib/imaplib.py
+++ b/Lib/imaplib.py
@@ -222,14 +222,7 @@ class IMAP4:
def send(self, data):
"""Send data to remote."""
- bytes = len(data)
- while bytes > 0:
- sent = self.sock.send(data)
- if sent == bytes:
- break # avoid copy
- data = data[sent:]
- bytes = bytes - sent
-
+ self.sock.sendall(data)
def shutdown(self):
"""Close I/O established in "open"."""
diff --git a/Lib/nntplib.py b/Lib/nntplib.py
index fad6b08..21faab1 100644
--- a/Lib/nntplib.py
+++ b/Lib/nntplib.py
@@ -179,7 +179,7 @@ class NNTP:
"""Internal: send one line to the server, appending CRLF."""
line = line + CRLF
if self.debugging > 1: print '*put*', `line`
- self.sock.send(line)
+ self.sock.sendall(line)
def putcmd(self, line):
"""Internal: send one command to the server (through putline())."""
diff --git a/Lib/poplib.py b/Lib/poplib.py
index 23c0b46..0525043 100644
--- a/Lib/poplib.py
+++ b/Lib/poplib.py
@@ -97,7 +97,7 @@ class POP3:
def _putline(self, line):
if self._debugging > 1: print '*put*', `line`
- self.sock.send('%s%s' % (line, CRLF))
+ self.sock.sendall('%s%s' % (line, CRLF))
# Internal: send one command to the server (through _putline())
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index cb15de2..f024bff 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -290,9 +290,7 @@ class SMTP:
if self.debuglevel > 0: print 'send:', `str`
if self.sock:
try:
- sendptr = 0
- while sendptr < len(str):
- sendptr = sendptr + self.sock.send(str[sendptr:])
+ self.sock.sendall(str)
except socket.error:
self.close()
raise SMTPServerDisconnected('Server not connected')
diff --git a/Lib/socket.py b/Lib/socket.py
index c460c5f..45131ce 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -185,7 +185,7 @@ class _fileobject:
def flush(self):
if self._wbuf:
- self._sock.send(self._wbuf)
+ self._sock.sendall(self._wbuf)
self._wbuf = ""
def fileno(self):
@@ -201,7 +201,7 @@ class _fileobject:
self.flush()
def writelines(self, list):
- filter(self._sock.send, list)
+ filter(self._sock.sendall, list)
self.flush()
def read(self, n=-1):
diff --git a/Lib/telnetlib.py b/Lib/telnetlib.py
index 15721c6..cdbbd9f 100644
--- a/Lib/telnetlib.py
+++ b/Lib/telnetlib.py
@@ -269,7 +269,7 @@ class Telnet:
if IAC in buffer:
buffer = buffer.replace(IAC, IAC+IAC)
self.msg("send %s", `buffer`)
- self.sock.send(buffer)
+ self.sock.sendall(buffer)
def read_until(self, match, timeout=None):
"""Read until a given string is encountered or until timeout.
@@ -411,7 +411,7 @@ class Telnet:
if self.option_callback:
self.option_callback(self.sock, c, opt)
else:
- self.sock.send(IAC + WONT + opt)
+ self.sock.sendall(IAC + WONT + opt)
elif c in (WILL, WONT):
opt = self.rawq_getchar()
self.msg('IAC %s %d',
@@ -419,7 +419,7 @@ class Telnet:
if self.option_callback:
self.option_callback(self.sock, c, opt)
else:
- self.sock.send(IAC + DONT + opt)
+ self.sock.sendall(IAC + DONT + opt)
else:
self.msg('IAC %d not recognized' % ord(opt))
except EOFError: # raised by self.rawq_getchar()