2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-10 07:44:36 +00:00

Try alternate invocation for handshake

Newer versions of websocket change internal call, and we must follow.

This is a consequence of the library providing no means to customize the
TLS handling, so we have to dig in a little to get that customization.
This commit is contained in:
Jarrod Johnson 2025-01-14 08:59:17 -05:00
parent 32bc5afe03
commit cdfb76de57
2 changed files with 8 additions and 2 deletions

View File

@ -83,7 +83,10 @@ class WrappedWebSocket(wso):
if not self._certverify(bincert):
raise pygexc.UnrecognizedCertificate('Unknown certificate', bincert)
try:
self.handshake_response = websocket._handshake.handshake(self.sock, *addrs, **options)
try:
self.handshake_response = websocket._handshake.handshake(self.sock, *addrs, **options)
except TypeError:
self.handshake_response = websocket._handshake.handshake(self.sock, url, *addrs, **options)
if self.handshake_response.status in websocket._handshake.SUPPORTED_REDIRECT_STATUSES:
options['redirect_limit'] = options.pop('redirect_limit', 3) - 1
if options['redirect_limit'] < 0:

View File

@ -82,7 +82,10 @@ class WrappedWebSocket(wso):
if not self._certverify(bincert):
raise pygexc.UnrecognizedCertificate('Unknown certificate', bincert)
try:
self.handshake_response = websocket._handshake.handshake(self.sock, *addrs, **options)
try:
self.handshake_response = websocket._handshake.handshake(self.sock, *addrs, **options)
except TypeError:
self.handshake_response = websocket._handshake.handshake(self.sock, url, *addrs, **options)
if self.handshake_response.status in websocket._handshake.SUPPORTED_REDIRECT_STATUSES:
options['redirect_limit'] = options.pop('redirect_limit', 3) - 1
if options['redirect_limit'] < 0: