]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix bug with somtimes uninitialized port
authorGuido van Rossum <guido@python.org>
Tue, 22 Feb 1994 16:06:02 +0000 (16:06 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 22 Feb 1994 16:06:02 +0000 (16:06 +0000)
Lib/httplib.py

index ea6e565fbe210806689db6398c9c8b4488d3c412..d494e21ef04c3bc8e04ae6cad550f1ba5a66b099 100644 (file)
@@ -56,10 +56,11 @@ class HTTP:
                        port = args[0]
                else:
                        i = string.find(host, ':')
+                       port = None
                        if i >= 0:
                                host, port = host[:i], host[i+1:]
                                try: port = string.atoi(port)
-                               except string.atoi_error: port = None
+                               except string.atoi_error: pass
                if not port: port = HTTP_PORT
                self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                if self.debuglevel > 0: print 'connect:', (host, port)