add persistent connections back to the connection cache, close all others

git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3444 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
calvin 2006-09-15 19:59:30 +00:00
parent d6676ab0a0
commit 6348205dcc

View file

@ -642,11 +642,11 @@ class HttpUrl (internpaturl.InternPatternUrl, proxysupport.ProxySupport):
# add to cached connections
_user, _password = self.get_user_password()
key = ("http", self.urlparts[1], _user, _password)
cache_add = self.aggregate.connections.add
# note: only cache the connection when it is persistent
# and all pending content has been received
if not self.persistent or not self.has_content or \
not cache_add(key, self.url_connection, self.timeout):
if self.persistent:
#assert self.url_connection.is_idle(), str(self)
cache_add = self.aggregate.connections.add
cache_add(key, self.url_connection, self.timeout)
else:
try:
self.url_connection.close()
except: