mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-29 18:44:43 +00:00
Detect more cases to close the connection, and close response objects
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3437 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
d22b6b5c68
commit
4b818cb4b3
1 changed files with 4 additions and 1 deletions
|
|
@ -192,6 +192,7 @@ class HttpUrl (internpaturl.InternPatternUrl, proxysupport.ProxySupport):
|
||||||
# check response
|
# check response
|
||||||
if response:
|
if response:
|
||||||
self.check_response(response)
|
self.check_response(response)
|
||||||
|
response.close()
|
||||||
|
|
||||||
def check_http_connection (self):
|
def check_http_connection (self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -230,6 +231,7 @@ class HttpUrl (internpaturl.InternPatternUrl, proxysupport.ProxySupport):
|
||||||
_("Enforced proxy %r ignored, aborting.") % newproxy,
|
_("Enforced proxy %r ignored, aborting.") % newproxy,
|
||||||
valid=False)
|
valid=False)
|
||||||
return response
|
return response
|
||||||
|
response.close()
|
||||||
response = self._get_http_response()
|
response = self._get_http_response()
|
||||||
# restore old proxy settings
|
# restore old proxy settings
|
||||||
self.proxy, self.proxyauth = oldproxy
|
self.proxy, self.proxyauth = oldproxy
|
||||||
|
|
@ -374,6 +376,7 @@ class HttpUrl (internpaturl.InternPatternUrl, proxysupport.ProxySupport):
|
||||||
# pretend to be finished and logged
|
# pretend to be finished and logged
|
||||||
return -1, response
|
return -1, response
|
||||||
# new response data
|
# new response data
|
||||||
|
response.close()
|
||||||
response = self._get_http_response()
|
response = self._get_http_response()
|
||||||
tries += 1
|
tries += 1
|
||||||
return tries, response
|
return tries, response
|
||||||
|
|
@ -486,7 +489,7 @@ class HttpUrl (internpaturl.InternPatternUrl, proxysupport.ProxySupport):
|
||||||
print "XXX", self.url_connection
|
print "XXX", self.url_connection
|
||||||
raise
|
raise
|
||||||
response = self.url_connection.getresponse()
|
response = self.url_connection.getresponse()
|
||||||
self.persistent = headers.http_persistent(response)
|
self.persistent = not response.will_close
|
||||||
self.timeout = headers.http_timeout(response)
|
self.timeout = headers.http_timeout(response)
|
||||||
self.headers = response.msg
|
self.headers = response.msg
|
||||||
# If possible, use official W3C HTTP response name
|
# If possible, use official W3C HTTP response name
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue