summaryrefslogtreecommitdiffstats
path: root/Lib/httplib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r--Lib/httplib.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 0e0ec56..fa63787 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -368,7 +368,8 @@ class HTTPConnection:
except socket.error, msg:
if self.debuglevel > 0:
print 'connect fail:', (self.host, self.port)
- self.sock.close()
+ if self.sock:
+ self.sock.close()
self.sock = None
continue
break