diff options
Diffstat (limited to 'python3/httplib2/__init__.py')
-rw-r--r-- | python3/httplib2/__init__.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/python3/httplib2/__init__.py b/python3/httplib2/__init__.py index b1b86f4..8b64c41 100644 --- a/python3/httplib2/__init__.py +++ b/python3/httplib2/__init__.py @@ -15,7 +15,7 @@ __contributors__ = [ "Alex Yu", ] __license__ = "MIT" -__version__ = '0.12.0' +__version__ = '0.12.1' import base64 import calendar @@ -1722,6 +1722,8 @@ The return value is a tuple of (response, content), the first being and instance of the 'Response' class, the second being a string that contains the response entity body. """ + conn_key = '' + try: if headers is None: headers = {} @@ -1924,6 +1926,12 @@ a string that contains the response entity body. cachekey, ) except Exception as e: + is_timeout = isinstance(e, socket.timeout) + if is_timeout: + conn = self.connections.pop(conn_key, None) + if conn: + conn.close() + if self.force_exception_to_status_code: if isinstance(e, HttpLib2ErrorWithResponse): response = e.response |