diff options
author | Joffrey F <joffrey@docker.com> | 2018-06-05 10:51:54 -0700 |
---|---|---|
committer | Joffrey F <joffrey@docker.com> | 2018-06-06 17:32:20 -0700 |
commit | d2520d71abfb7b9e9d4f3f2bfc9657d29b1f34a0 (patch) | |
tree | 856554c631d4a731e50b8265f5021efcbe88d2d7 /docker | |
parent | 22b7b76142bd735c6be4f678dda8cf9d413e9f1c (diff) | |
download | docker-py-1997-http-socket-read-win32.tar.gz |
Fix socket reading function for TCP (non-HTTPS) connections on Windows1997-http-socket-read-win32
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'docker')
-rw-r--r-- | docker/utils/socket.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/docker/utils/socket.py b/docker/utils/socket.py index 0945f0a..7b96d4f 100644 --- a/docker/utils/socket.py +++ b/docker/utils/socket.py @@ -1,6 +1,7 @@ import errno import os import select +import socket as pysocket import struct import six @@ -28,6 +29,8 @@ def read(socket, n=4096): try: if hasattr(socket, 'recv'): return socket.recv(n) + if six.PY3 and isinstance(socket, getattr(pysocket, 'SocketIO')): + return socket.read(n) return os.read(socket.fileno(), n) except EnvironmentError as e: if e.errno not in recoverable_errors: |