We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 721edfd + 537b468 commit d68984dCopy full SHA for d68984d
docker/client.py
@@ -262,7 +262,16 @@ def _get_raw_response_socket(self, response):
262
sock = response.raw._fp.fp.raw._sock
263
else:
264
sock = response.raw._fp.fp._sock
265
- sock._response = response
+ try:
266
+ # Keep a reference to the response to stop it being garbage
267
+ # collected. If the response is garbage collected, it will close
268
+ # TLS sockets.
269
+ sock._response = response
270
+ except AttributeError:
271
+ # UNIX sockets can't have attributes set on them, but that's fine
272
+ # because we won't be doing TLS over them
273
+ pass
274
+
275
return sock
276
277
def _stream_helper(self, response):
0 commit comments