diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2001-10-07 08:53:32 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2001-10-07 08:53:32 (GMT) |
commit | 322c0d187d834013d70ffdb0f7f1b6f72eef6443 (patch) | |
tree | ca8bbe6526e9f3c88b6311691e7936bfdc0480b0 /Lib/httplib.py | |
parent | fb163784ab8ec237fdc3bffd018efe653ae07a1d (diff) | |
download | cpython-322c0d187d834013d70ffdb0f7f1b6f72eef6443.zip cpython-322c0d187d834013d70ffdb0f7f1b6f72eef6443.tar.gz cpython-322c0d187d834013d70ffdb0f7f1b6f72eef6443.tar.bz2 |
Only close sockets if they have been created. Reported by Blake Winton.
Diffstat (limited to 'Lib/httplib.py')
-rw-r--r-- | Lib/httplib.py | 3 |
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 |