Fix bug with somtimes uninitialized port
This commit is contained in:
parent
9f14863053
commit
76ca3c17f0
|
@ -56,10 +56,11 @@ class HTTP:
|
||||||
port = args[0]
|
port = args[0]
|
||||||
else:
|
else:
|
||||||
i = string.find(host, ':')
|
i = string.find(host, ':')
|
||||||
|
port = None
|
||||||
if i >= 0:
|
if i >= 0:
|
||||||
host, port = host[:i], host[i+1:]
|
host, port = host[:i], host[i+1:]
|
||||||
try: port = string.atoi(port)
|
try: port = string.atoi(port)
|
||||||
except string.atoi_error: port = None
|
except string.atoi_error: pass
|
||||||
if not port: port = HTTP_PORT
|
if not port: port = HTTP_PORT
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
if self.debuglevel > 0: print 'connect:', (host, port)
|
if self.debuglevel > 0: print 'connect:', (host, port)
|
||||||
|
|
Loading…
Reference in New Issue