[Python-checkins] CVS: python/dist/src/Lib ftplib.py,1.53.2.1,1.53.2.2 gopherlib.py,1.9,1.9.4.1 httplib.py,1.34.2.1,1.34.2.2 imaplib.py,1.27.4.1,1.27.4.2 nntplib.py,1.26,1.26.4.1 poplib.py,1.14,1.14.4.1 smtplib.py,1.36,1.36.4.1 socket.py,1.11.2.1,1.11.2.2 telnetlib.py,1.11,1.11.4.1
Anthony Baxter
anthonybaxter@users.sourceforge.net
Sat, 22 Dec 2001 17:47:13 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv13195
Modified Files:
Tag: release21-maint
ftplib.py gopherlib.py httplib.py imaplib.py nntplib.py
poplib.py smtplib.py socket.py telnetlib.py
Log Message:
The Grande 'sendall()' patch. I believe that I've picked up everything
in the std lib that should be using sendall(), rather than send() - I've
tried to check each of the patches.
Replaces calls to socket.send() (which isn't guaranteed to send all data)
with the new socket.sendall() method.
Index: ftplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ftplib.py,v
retrieving revision 1.53.2.1
retrieving revision 1.53.2.2
diff -C2 -d -r1.53.2.1 -r1.53.2.2
*** ftplib.py 2001/12/18 14:17:02 1.53.2.1
--- ftplib.py 2001/12/23 01:47:10 1.53.2.2
***************
*** 156,160 ****
line = line + CRLF
if self.debugging > 1: print '*put*', self.sanitize(line)
! self.sock.send(line)
# Internal: send one command to the server (through putline())
--- 156,160 ----
line = line + CRLF
if self.debugging > 1: print '*put*', self.sanitize(line)
! self.sock.sendall(line)
# Internal: send one command to the server (through putline())
***************
*** 219,223 ****
line = 'ABOR' + CRLF
if self.debugging > 1: print '*put urgent*', self.sanitize(line)
! self.sock.send(line, MSG_OOB)
resp = self.getmultiline()
if resp[:3] not in ('426', '226'):
--- 219,223 ----
line = 'ABOR' + CRLF
if self.debugging > 1: print '*put urgent*', self.sanitize(line)
! self.sock.sendall(line, MSG_OOB)
resp = self.getmultiline()
if resp[:3] not in ('426', '226'):
***************
*** 373,377 ****
buf = fp.read(blocksize)
if not buf: break
! conn.send(buf)
conn.close()
return self.voidresp()
--- 373,377 ----
buf = fp.read(blocksize)
if not buf: break
! conn.sendall(buf)
conn.close()
return self.voidresp()
***************
*** 387,391 ****
if buf[-1] in CRLF: buf = buf[:-1]
buf = buf + CRLF
! conn.send(buf)
conn.close()
return self.voidresp()
--- 387,391 ----
if buf[-1] in CRLF: buf = buf[:-1]
buf = buf + CRLF
! conn.sendall(buf)
conn.close()
return self.voidresp()
Index: gopherlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/gopherlib.py,v
retrieving revision 1.9
retrieving revision 1.9.4.1
diff -C2 -d -r1.9 -r1.9.4.1
*** gopherlib.py 2001/02/09 10:10:02 1.9
--- gopherlib.py 2001/12/23 01:47:10 1.9.4.1
***************
*** 67,71 ****
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
! s.send(selector + CRLF)
s.shutdown(1)
return s.makefile('rb')
--- 67,71 ----
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
! s.sendall(selector + CRLF)
s.shutdown(1)
return s.makefile('rb')
Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.34.2.1
retrieving revision 1.34.2.2
diff -C2 -d -r1.34.2.1 -r1.34.2.2
*** httplib.py 2001/05/31 18:03:22 1.34.2.1
--- httplib.py 2001/12/23 01:47:10 1.34.2.2
***************
*** 389,393 ****
print "send:", repr(str)
try:
! self.sock.send(str)
except socket.error, v:
if v[0] == 32: # Broken pipe
--- 389,393 ----
print "send:", repr(str)
try:
! self.sock.sendall(str)
except socket.error, v:
if v[0] == 32: # Broken pipe
Index: imaplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/imaplib.py,v
retrieving revision 1.27.4.1
retrieving revision 1.27.4.2
diff -C2 -d -r1.27.4.1 -r1.27.4.2
*** imaplib.py 2001/07/20 10:54:21 1.27.4.1
--- imaplib.py 2001/12/23 01:47:10 1.27.4.2
***************
*** 634,638 ****
try:
! self.sock.send('%s%s' % (data, CRLF))
except socket.error, val:
raise self.abort('socket error: %s' % val)
--- 634,638 ----
try:
! self.sock.sendall('%s%s' % (data, CRLF))
except socket.error, val:
raise self.abort('socket error: %s' % val)
***************
*** 658,663 ****
try:
! self.sock.send(literal)
! self.sock.send(CRLF)
except socket.error, val:
raise self.abort('socket error: %s' % val)
--- 658,663 ----
try:
! self.sock.sendall(literal)
! self.sock.sendall(CRLF)
except socket.error, val:
raise self.abort('socket error: %s' % val)
Index: nntplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v
retrieving revision 1.26
retrieving revision 1.26.4.1
diff -C2 -d -r1.26 -r1.26.4.1
*** nntplib.py 2001/02/09 07:02:17 1.26
--- nntplib.py 2001/12/23 01:47:10 1.26.4.1
***************
*** 179,183 ****
line = line + CRLF
if self.debugging > 1: print '*put*', `line`
! self.sock.send(line)
def putcmd(self, line):
--- 179,183 ----
line = line + CRLF
if self.debugging > 1: print '*put*', `line`
! self.sock.sendall(line)
def putcmd(self, line):
Index: poplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/poplib.py,v
retrieving revision 1.14
retrieving revision 1.14.4.1
diff -C2 -d -r1.14 -r1.14.4.1
*** poplib.py 2001/02/12 02:00:42 1.14
--- poplib.py 2001/12/23 01:47:10 1.14.4.1
***************
*** 85,89 ****
def _putline(self, line):
#if self._debugging > 1: print '*put*', `line`
! self.sock.send('%s%s' % (line, CRLF))
--- 85,89 ----
def _putline(self, line):
#if self._debugging > 1: print '*put*', `line`
! self.sock.sendall('%s%s' % (line, CRLF))
Index: smtplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v
retrieving revision 1.36
retrieving revision 1.36.4.1
diff -C2 -d -r1.36 -r1.36.4.1
*** smtplib.py 2001/02/15 22:15:13 1.36
--- smtplib.py 2001/12/23 01:47:10 1.36.4.1
***************
*** 233,239 ****
if self.sock:
try:
! sendptr = 0
! while sendptr < len(str):
! sendptr = sendptr + self.sock.send(str[sendptr:])
except socket.error:
raise SMTPServerDisconnected('Server not connected')
--- 233,237 ----
if self.sock:
try:
! self.sock.sendall(str)
except socket.error:
raise SMTPServerDisconnected('Server not connected')
Index: socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -C2 -d -r1.11.2.1 -r1.11.2.2
*** socket.py 2001/12/05 06:16:10 1.11.2.1
--- socket.py 2001/12/23 01:47:10 1.11.2.2
***************
*** 177,181 ****
def flush(self):
if self._wbuf:
! self._sock.send(self._wbuf)
self._wbuf = ""
--- 177,181 ----
def flush(self):
if self._wbuf:
! self._sock.sendall(self._wbuf)
self._wbuf = ""
***************
*** 193,197 ****
def writelines(self, list):
! filter(self._sock.send, list)
self.flush()
--- 193,197 ----
def writelines(self, list):
! filter(self._sock.sendall, list)
self.flush()
Index: telnetlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/telnetlib.py,v
retrieving revision 1.11
retrieving revision 1.11.4.1
diff -C2 -d -r1.11 -r1.11.4.1
*** telnetlib.py 2001/03/01 04:27:19 1.11
--- telnetlib.py 2001/12/23 01:47:10 1.11.4.1
***************
*** 191,195 ****
buffer = buffer.replace(IAC, IAC+IAC)
self.msg("send %s", `buffer`)
! self.sock.send(buffer)
def read_until(self, match, timeout=None):
--- 191,195 ----
buffer = buffer.replace(IAC, IAC+IAC)
self.msg("send %s", `buffer`)
! self.sock.sendall(buffer)
def read_until(self, match, timeout=None):
***************
*** 326,335 ****
opt = self.rawq_getchar()
self.msg('IAC %s %d', c == DO and 'DO' or 'DONT', ord(c))
! self.sock.send(IAC + WONT + opt)
elif c in (WILL, WONT):
opt = self.rawq_getchar()
self.msg('IAC %s %d',
c == WILL and 'WILL' or 'WONT', ord(c))
! self.sock.send(IAC + DONT + opt)
else:
self.msg('IAC %s not recognized' % `c`)
--- 326,335 ----
opt = self.rawq_getchar()
self.msg('IAC %s %d', c == DO and 'DO' or 'DONT', ord(c))
! self.sock.sendall(IAC + WONT + opt)
elif c in (WILL, WONT):
opt = self.rawq_getchar()
self.msg('IAC %s %d',
c == WILL and 'WILL' or 'WONT', ord(c))
! self.sock.sendall(IAC + DONT + opt)
else:
self.msg('IAC %s not recognized' % `c`)