Close HTTPSConnection in case of exception

This commit is contained in:
Hugo 2018-04-11 10:38:00 +03:00
parent c929b5bd8f
commit 85efc31c10

View file

@ -857,8 +857,10 @@ class _Request(object):
except Exception as e:
raise MalformedResponseError(self.network, e)
self._check_response_for_errors(response_text)
conn.close()
try:
self._check_response_for_errors(response_text)
finally:
conn.close()
return response_text
def execute(self, cacheable=False):