Skip to content

Commit 3735c2c

Browse files
aojeayliaog
authored andcommitted
use subprotocols from handshake
1 parent 8b5b8c1 commit 3735c2c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

kubernetes/base/stream/ws_client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ def __init__(self, configuration, url, headers, capture_all, binary=False):
7373
self._all = _IgnoredIO()
7474
self.sock = create_websocket(configuration, url, headers)
7575
self.subprotocol = getattr(self.sock, 'subprotocol', None)
76+
if not self.subprotocol and self.sock:
77+
headers_dict = self.sock.getheaders()
78+
if headers_dict:
79+
for k, v in headers_dict.items():
80+
if k.lower() == 'sec-websocket-protocol':
81+
self.subprotocol = v
82+
break
7683
self._connected = True
7784
self._returncode = None
7885

0 commit comments

Comments
 (0)