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

Skip to content

Commit 76ca3c1

Browse files
committed
Fix bug with somtimes uninitialized port
1 parent 9f14863 commit 76ca3c1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/httplib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ def connect(self, host, *args):
5656
port = args[0]
5757
else:
5858
i = string.find(host, ':')
59+
port = None
5960
if i >= 0:
6061
host, port = host[:i], host[i+1:]
6162
try: port = string.atoi(port)
62-
except string.atoi_error: port = None
63+
except string.atoi_error: pass
6364
if not port: port = HTTP_PORT
6465
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
6566
if self.debuglevel > 0: print 'connect:', (host, port)

0 commit comments

Comments
 (0)