[Python-checkins] CVS: python/dist/src/Lib ftplib.py,1.60.10.1,1.60.10.2 gopherlib.py,1.10,1.10.16.1 httplib.py,1.42,1.42.10.1 imaplib.py,1.39.8.2,1.39.8.3 nntplib.py,1.28,1.28.10.1 poplib.py,1.19,1.19.6.1 smtplib.py,1.46,1.46.4.1 socket.py,1.16,1.16.4.1 telnetlib.py,1.16,1.16.10.1

Martin v. L?wis loewis@users.sourceforge.net
2002年2月16日 15:08:28 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv22003
Modified Files:
 Tag: release22-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, copied from release21-maint. Fixes #516715.
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.60.10.1
retrieving revision 1.60.10.2
diff -C2 -d -r1.60.10.1 -r1.60.10.2
*** ftplib.py	28 Dec 2001 10:11:32 -0000	1.60.10.1
--- ftplib.py	16 Feb 2002 23:08:24 -0000	1.60.10.2
***************
*** 169,173 ****
 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())
--- 169,173 ----
 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())
***************
*** 232,236 ****
 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'):
--- 232,236 ----
 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'):
***************
*** 423,427 ****
 buf = fp.read(blocksize)
 if not buf: break
! conn.send(buf)
 conn.close()
 return self.voidresp()
--- 423,427 ----
 buf = fp.read(blocksize)
 if not buf: break
! conn.sendall(buf)
 conn.close()
 return self.voidresp()
***************
*** 437,441 ****
 if buf[-1] in CRLF: buf = buf[:-1]
 buf = buf + CRLF
! conn.send(buf)
 conn.close()
 return self.voidresp()
--- 437,441 ----
 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.10
retrieving revision 1.10.16.1
diff -C2 -d -r1.10 -r1.10.16.1
*** gopherlib.py	13 Aug 2001 14:52:37 -0000	1.10
--- gopherlib.py	16 Feb 2002 23:08:24 -0000	1.10.16.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.42
retrieving revision 1.42.10.1
diff -C2 -d -r1.42 -r1.42.10.1
*** httplib.py	11 Oct 2001 18:15:51 -0000	1.42
--- httplib.py	16 Feb 2002 23:08:24 -0000	1.42.10.1
***************
*** 404,408 ****
 print "send:", repr(str)
 try:
! self.sock.send(str)
 except socket.error, v:
 if v[0] == 32: # Broken pipe
--- 404,408 ----
 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.39.8.2
retrieving revision 1.39.8.3
diff -C2 -d -r1.39.8.2 -r1.39.8.3
*** imaplib.py	5 Jan 2002 17:22:20 -0000	1.39.8.2
--- imaplib.py	16 Feb 2002 23:08:25 -0000	1.39.8.3
***************
*** 223,234 ****
 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
! 
 
 def shutdown(self):
--- 223,227 ----
 def send(self, data):
 """Send data to remote."""
! self.sock.sendall(data)
 
 def shutdown(self):
Index: nntplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v
retrieving revision 1.28
retrieving revision 1.28.10.1
diff -C2 -d -r1.28 -r1.28.10.1
*** nntplib.py	18 Oct 2001 20:58:25 -0000	1.28
--- nntplib.py	16 Feb 2002 23:08:25 -0000	1.28.10.1
***************
*** 180,184 ****
 line = line + CRLF
 if self.debugging > 1: print '*put*', `line`
! self.sock.send(line)
 
 def putcmd(self, line):
--- 180,184 ----
 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.19
retrieving revision 1.19.6.1
diff -C2 -d -r1.19 -r1.19.6.1
*** poplib.py	5 Dec 2001 22:37:21 -0000	1.19
--- poplib.py	16 Feb 2002 23:08:25 -0000	1.19.6.1
***************
*** 98,102 ****
 def _putline(self, line):
 if self._debugging > 1: print '*put*', `line`
! self.sock.send('%s%s' % (line, CRLF))
 
 
--- 98,102 ----
 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.46
retrieving revision 1.46.4.1
diff -C2 -d -r1.46 -r1.46.4.1
*** smtplib.py	14 Dec 2001 20:34:20 -0000	1.46
--- smtplib.py	16 Feb 2002 23:08:25 -0000	1.46.4.1
***************
*** 291,297 ****
 if self.sock:
 try:
! sendptr = 0
! while sendptr < len(str):
! sendptr = sendptr + self.sock.send(str[sendptr:])
 except socket.error:
 self.close()
--- 291,295 ----
 if self.sock:
 try:
! self.sock.sendall(str)
 except socket.error:
 self.close()
Index: socket.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v
retrieving revision 1.16
retrieving revision 1.16.4.1
diff -C2 -d -r1.16 -r1.16.4.1
*** socket.py	18 Dec 2001 22:22:25 -0000	1.16
--- socket.py	16 Feb 2002 23:08:25 -0000	1.16.4.1
***************
*** 182,186 ****
 def flush(self):
 if self._wbuf:
! self._sock.send(self._wbuf)
 self._wbuf = ""
 
--- 182,186 ----
 def flush(self):
 if self._wbuf:
! self._sock.sendall(self._wbuf)
 self._wbuf = ""
 
***************
*** 198,202 ****
 
 def writelines(self, list):
! filter(self._sock.send, list)
 self.flush()
 
--- 198,202 ----
 
 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.16
retrieving revision 1.16.10.1
diff -C2 -d -r1.16 -r1.16.10.1
*** telnetlib.py	7 Oct 2001 08:53:32 -0000	1.16
--- telnetlib.py	16 Feb 2002 23:08:25 -0000	1.16.10.1
***************
*** 270,274 ****
 buffer = buffer.replace(IAC, IAC+IAC)
 self.msg("send %s", `buffer`)
! self.sock.send(buffer)
 
 def read_until(self, match, timeout=None):
--- 270,274 ----
 buffer = buffer.replace(IAC, IAC+IAC)
 self.msg("send %s", `buffer`)
! self.sock.sendall(buffer)
 
 def read_until(self, match, timeout=None):
***************
*** 412,416 ****
 self.option_callback(self.sock, c, opt)
 else:
! self.sock.send(IAC + WONT + opt)
 elif c in (WILL, WONT):
 opt = self.rawq_getchar()
--- 412,416 ----
 self.option_callback(self.sock, c, opt)
 else:
! self.sock.sendall(IAC + WONT + opt)
 elif c in (WILL, WONT):
 opt = self.rawq_getchar()
***************
*** 420,424 ****
 self.option_callback(self.sock, c, opt)
 else:
! self.sock.send(IAC + DONT + opt)
 else:
 self.msg('IAC %d not recognized' % ord(opt))
--- 420,424 ----
 self.option_callback(self.sock, c, opt)
 else:
! self.sock.sendall(IAC + DONT + opt)
 else:
 self.msg('IAC %d not recognized' % ord(opt))

AltStyle によって変換されたページ (->オリジナル) /