summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Barrette <paulbarrette@gmail.com>2018-05-04 16:33:17 -0400
committerPaul Barrette <paulbarrette@gmail.com>2018-05-04 16:33:17 -0400
commit8cedd88d88505ce13f37d22d5e8e1e097a525685 (patch)
tree2890caed3456d264d0eb2f62ced823ca5e696a3d
parent87861f951d1a65ed5d9080f7aaaf44310f376c56 (diff)
downloadwebsocket-client-8cedd88d88505ce13f37d22d5e8e1e097a525685.tar.gz
_http.py: fix windows proxy error due to socktype
Resolves #426 When running on windows 10 with a proxy, there is a connect error: _on_error: exception Socket type must be stream or datagram, not 0 This commit fixes that issue. Signed-off-by: Paul Barrette <paulbarrette@gmail.com>
-rw-r--r--websocket/_http.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/websocket/_http.py b/websocket/_http.py
index c3b53f5..876d04b 100644
--- a/websocket/_http.py
+++ b/websocket/_http.py
@@ -94,7 +94,11 @@ def _get_addrinfo_list(hostname, port, is_secure, proxy):
return addrinfo_list, False, None
else:
pport = pport and pport or 80
- addrinfo_list = socket.getaddrinfo(phost, pport, 0, 0, socket.SOL_TCP)
+ # when running on windows 10, the getaddrinfo used above
+ # returns a socktype 0. This generates an error exception:
+ #_on_error: exception Socket type must be stream or datagram, not 0
+ # Force the socket type to SOCK_STREAM
+ addrinfo_list = socket.getaddrinfo(phost, pport, 0, socket.SOCK_STREAM, socket.SOL_TCP)
return addrinfo_list, True, pauth
except socket.gaierror as e:
raise WebSocketAddressException(e)