[Patches] socket.connect patch
Fredrik Lundh
Fredrik Lundh" <effbot@telia.com
Tue, 28 Mar 2000 22:47:17 +0200
This is a multi-part message in MIME format.
------=_NextPart_000_00E0_01BF9907.91498AC0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
this fixes a bunch of socket.connect(host, post) calls.
note that I haven't tested all modules -- I don't have
enough servers here...
</F>
I confirm that, to the best of my knowledge and belief, this =
contribution
is free of any claims of third parties under copyright, patent or
other rights or interests ("claims"). To the extent that I have
any such claims, I hereby grant to CNRI a nonexclusive, irrevocable,
royalty-free, worldwide license to reproduce, distribute, perform and/or
display publicly, prepare derivative versions, and otherwise use this
contribution as part of the Python software and its related =
documentation,
or any derivative versions thereof, at no cost to CNRI or its licensed
users, and to authorize others to do so.
=20
I acknowledge that CNRI may, at its sole discretion, decide whether
or not to incorporate this contribution in the Python software and its
related documentation. I further grant CNRI permission to use my name
and other identifying information provided to CNRI by me for use in
connection with the Python software and its related documentation.
------=_NextPart_000_00E0_01BF9907.91498AC0
Content-Type: application/octet-stream;
name="connect-patch-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="connect-patch-1"
diff -u bak/ftplib.py ./ftplib.py
--- bak/ftplib.py Wed Mar 01 08:03:23 2000
+++ ./ftplib.py Tue Mar 28 22:42:43 2000
@@ -115,7 +115,7 @@
if port: self.port = port
self.passiveserver = 0
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect(self.host, self.port)
+ self.sock.connect((self.host, self.port))
self.file = self.sock.makefile('rb')
self.welcome = self.getresp()
return self.welcome
@@ -265,7 +265,7 @@
if self.passiveserver:
host, port = parse227(self.sendcmd('PASV'))
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- conn.connect(host, port)
+ conn.connect((host, port))
resp = self.sendcmd(cmd)
if resp[0] <> '1':
raise error_reply, resp
diff -u bak/gopherlib.py ./gopherlib.py
--- bak/gopherlib.py Wed Mar 01 08:03:23 2000
+++ ./gopherlib.py Tue Mar 28 22:42:47 2000
@@ -66,7 +66,7 @@
elif type(port) == type(''):
port = string.atoi(port)
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect(host, port)
+ s.connect((host, port))
s.send(selector + CRLF)
s.shutdown(1)
return s.makefile('rb')
diff -u bak/httplib.py ./httplib.py
--- bak/httplib.py Wed Mar 01 08:03:23 2000
+++ ./httplib.py Tue Mar 28 22:42:57 2000
@@ -109,7 +109,7 @@
if not port: port = HTTP_PORT
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.debuglevel > 0: print 'connect:', (host, port)
- self.sock.connect(host, port)
+ self.sock.connect((host, port))
def send(self, str):
"""Send `str' to the server."""
@@ -209,7 +209,7 @@
if not port: port = HTTPS_PORT
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.debuglevel > 0: print 'connect:', (host, port)
- sock.connect(host, port)
+ sock.connect((host, port))
ssl = socket.ssl(sock, self.key_file, self.cert_file)
self.sock = FakeSocket(sock, ssl)
diff -u bak/imaplib.py ./imaplib.py
--- bak/imaplib.py Tue Mar 28 22:09:29 2000
+++ ./imaplib.py Tue Mar 28 22:43:05 2000
@@ -191,7 +191,7 @@
def open(self, host, port):
"""Setup 'self.sock' and 'self.file'."""
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect(self.host, self.port)
+ self.sock.connect((self.host, self.port))
self.file = self.sock.makefile('r')
diff -u bak/nntplib.py ./nntplib.py
--- bak/nntplib.py Wed Mar 01 08:03:23 2000
+++ ./nntplib.py Tue Mar 28 22:43:09 2000
@@ -108,7 +108,7 @@
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect(self.host, self.port)
+ self.sock.connect((self.host, self.port))
self.file = self.sock.makefile('rb')
self.debugging = 0
self.welcome = self.getresp()
diff -u bak/poplib.py ./poplib.py
--- bak/poplib.py Wed Mar 01 08:03:25 2000
+++ ./poplib.py Tue Mar 28 22:43:13 2000
@@ -77,7 +77,7 @@
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect(self.host, self.port)
+ self.sock.connect((self.host, self.port))
self.file = self.sock.makefile('rb')
self._debugging = 0
self.welcome = self._getresp()
--- bak/smtplib.py Wed Mar 01 08:03:25 2000
+++ ./smtplib.py Tue Mar 28 22:43:21 2000
@@ -213,7 +213,7 @@
if not port: port = SMTP_PORT
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.debuglevel > 0: print 'connect:', (host, port)
- self.sock.connect(host, port)
+ self.sock.connect((host, port))
(code,msg)=self.getreply()
if self.debuglevel >0 : print "connect:", msg
return (code,msg)
------=_NextPart_000_00E0_01BF9907.91498AC0--