Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 93a7c0f

Browse files
committed
Fredrik Lundh:
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...
1 parent 1916b35 commit 93a7c0f

7 files changed

Lines changed: 9 additions & 9 deletions

File tree

Lib/ftplib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def connect(self, host = '', port = 0):
115115
if port: self.port = port
116116
self.passiveserver = 0
117117
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
118-
self.sock.connect(self.host, self.port)
118+
self.sock.connect((self.host, self.port))
119119
self.file = self.sock.makefile('rb')
120120
self.welcome = self.getresp()
121121
return self.welcome
@@ -265,7 +265,7 @@ def ntransfercmd(self, cmd):
265265
if self.passiveserver:
266266
host, port = parse227(self.sendcmd('PASV'))
267267
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
268-
conn.connect(host, port)
268+
conn.connect((host, port))
269269
resp = self.sendcmd(cmd)
270270
if resp[0] <> '1':
271271
raise error_reply, resp

Lib/gopherlib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def send_selector(selector, host, port = 0):
6666
elif type(port) == type(''):
6767
port = string.atoi(port)
6868
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
69-
s.connect(host, port)
69+
s.connect((host, port))
7070
s.send(selector + CRLF)
7171
s.shutdown(1)
7272
return s.makefile('rb')

Lib/httplib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def connect(self, host, port = 0):
109109
if not port: port = HTTP_PORT
110110
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
111111
if self.debuglevel > 0: print 'connect:', (host, port)
112-
self.sock.connect(host, port)
112+
self.sock.connect((host, port))
113113

114114
def send(self, str):
115115
"""Send `str' to the server."""
@@ -209,7 +209,7 @@ def connect(self, host, port = 0):
209209
if not port: port = HTTPS_PORT
210210
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
211211
if self.debuglevel > 0: print 'connect:', (host, port)
212-
sock.connect(host, port)
212+
sock.connect((host, port))
213213
ssl = socket.ssl(sock, self.key_file, self.cert_file)
214214
self.sock = FakeSocket(sock, ssl)
215215

Lib/imaplib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def __getattr__(self, attr):
191191
def open(self, host, port):
192192
"""Setup 'self.sock' and 'self.file'."""
193193
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
194-
self.sock.connect(self.host, self.port)
194+
self.sock.connect((self.host, self.port))
195195
self.file = self.sock.makefile('r')
196196

197197

Lib/nntplib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(self, host, port=NNTP_PORT, user=None, password=None,
108108
self.host = host
109109
self.port = port
110110
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
111-
self.sock.connect(self.host, self.port)
111+
self.sock.connect((self.host, self.port))
112112
self.file = self.sock.makefile('rb')
113113
self.debugging = 0
114114
self.welcome = self.getresp()

Lib/poplib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(self, host, port = POP3_PORT):
7777
self.host = host
7878
self.port = port
7979
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
80-
self.sock.connect(self.host, self.port)
80+
self.sock.connect((self.host, self.port))
8181
self.file = self.sock.makefile('rb')
8282
self._debugging = 0
8383
self.welcome = self._getresp()

Lib/smtplib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ def connect(self, host='localhost', port = 0):
213213
if not port: port = SMTP_PORT
214214
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
215215
if self.debuglevel > 0: print 'connect:', (host, port)
216-
self.sock.connect(host, port)
216+
self.sock.connect((host, port))
217217
(code,msg)=self.getreply()
218218
if self.debuglevel >0 : print "connect:", msg
219219
return (code,msg)

0 commit comments

Comments
 (0)