[Python-checkins] python/dist/src/Lib httplib.py,1.34.2.5,1.34.2.6

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Thu, 29 Aug 2002 13:12:29 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv15977

Modified Files:
      Tag: release21-maint
	httplib.py 
Log Message:
Fix SF bug [ 599838 ] httplib.connect broken in 2.1 branch

Some IPv6-specific changes crept into the 2.1 branch when I backported
other bug fixes.


Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.34.2.5
retrieving revision 1.34.2.6
diff -C2 -d -r1.34.2.5 -r1.34.2.6
*** httplib.py	12 Jul 2002 15:22:07 -0000	1.34.2.5
--- httplib.py	29 Aug 2002 20:12:26 -0000	1.34.2.6
***************
*** 506,528 ****
      def connect(self):
          """Connect to the host and port specified in __init__."""
!         msg = "getaddrinfo returns an empty list"
!         for res in socket.getaddrinfo(self.host, self.port, 0,
!                                       socket.SOCK_STREAM):
!             af, socktype, proto, canonname, sa = res
!             try:
!                 self.sock = socket.socket(af, socktype, proto)
!                 if self.debuglevel > 0:
!                     print "connect: (%s, %s)" % (self.host, self.port)
!                 self.sock.connect(sa)
!             except socket.error, msg:
!                 if self.debuglevel > 0:
!                     print 'connect fail:', (self.host, self.port)
!                 if self.sock:
!                     self.sock.close()
!                 self.sock = None
!                 continue
!             break
!         if not self.sock:
!             raise socket.error, msg
  
      def close(self):
--- 506,513 ----
      def connect(self):
          """Connect to the host and port specified in __init__."""
!         self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
!         if self.debuglevel > 0:
!             print "connect: (%s, %s)" % (self.host, self.port)
!         self.sock.connect((self.host, self.port))
  
      def close(self):