[Python-checkins] CVS: python/dist/src/Lib httplib.py,1.40,1.41

Jeremy Hylton jhylton@users.sourceforge.net
2001年10月11日 10:47:24 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv10232
Modified Files:
	httplib.py 
Log Message:
Fix for SF buf #458835
Try to be systematic about dealing with socket and ssl exceptions in
FakeSocket.makefile(). The previous version of the code caught all
ssl errors and treated them as EOF, even though most of the errors
don't mean EOF.
An SSL error can mean on of three things:
 1. The SSL/TLS connection was closed.
 2. The operation should be retried.
 3. An error occurred.
Also, if a socket error occurred and the error was EINTR, retry the
call. Otherwise, it was a legitimate error and the caller should
receive the exception.
Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** httplib.py	2001年10月07日 08:53:32	1.40
--- httplib.py	2001年10月11日 17:47:22	1.41
***************
*** 67,72 ****
 """
 
! import socket
 import mimetools
 
 try:
--- 67,73 ----
 """
 
! import errno
 import mimetools
+ import socket
 
 try:
***************
*** 605,610 ****
 try:
 buf = self.__ssl.read()
! except socket.sslerror, msg:
! break
 if buf == '':
 break
--- 606,621 ----
 try:
 buf = self.__ssl.read()
! except socket.sslerror, err:
! if (err[0] == socket.SSL_ERROR_WANT_READ
! or err[0] == socket.SSL_ERROR_WANT_WRITE
! or 0):
! continue
! if err[0] == socket.SSL_ERROR_ZERO_RETURN:
! break
! raise
! except socket.error, err:
! if err[0] = errno.EINTR:
! continue
! raise
 if buf == '':
 break

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