summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubbleboy14 <mario.balibrera@gmail.com>2022-11-03 20:50:17 -0700
committerGitHub <noreply@github.com>2022-11-03 23:50:17 -0400
commite7445f8e8629530cb3491c020295986606d8dbd8 (patch)
tree6c490f01124fb6c7712027679f55825af1b2e05b
parent664b0898b07cd054f8d0fb08c73a24dbb3095d5b (diff)
downloadwebsocket-client-e7445f8e8629530cb3491c020295986606d8dbd8.tar.gz
create_dispatcher() w/ is_ssl determined by url instead of sslopt (#875)
* create_dispatcher() w/ is_ssl determined by url instead of sslopt * added .lower() (per @rm-you's suggestion) * create_dispatcher() w/ parse_url()-derived is_ssl * Fix failing test, missing wss Co-authored-by: engn33r <engn33r@users.noreply.github.com>
-rw-r--r--websocket/_app.py3
-rw-r--r--websocket/tests/test_app.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/websocket/_app.py b/websocket/_app.py
index 20bcbfe..e0a88e2 100644
--- a/websocket/_app.py
+++ b/websocket/_app.py
@@ -5,6 +5,7 @@ import threading
import time
import traceback
from ._abnf import ABNF
+from ._url import parse_url
from ._core import WebSocket, getdefaulttimeout
from ._exceptions import *
from . import _logging
@@ -441,7 +442,7 @@ class WebSocketApp:
teardown()
custom_dispatcher = bool(dispatcher)
- dispatcher = self.create_dispatcher(ping_timeout, dispatcher, not not sslopt)
+ dispatcher = self.create_dispatcher(ping_timeout, dispatcher, parse_url(self.url)[3])
if ping_interval:
event = threading.Event()
diff --git a/websocket/tests/test_app.py b/websocket/tests/test_app.py
index 8614d08..5526d3e 100644
--- a/websocket/tests/test_app.py
+++ b/websocket/tests/test_app.py
@@ -191,7 +191,7 @@ class WebSocketAppTest(unittest.TestCase):
""" Test WebSocketApp binary opcode
"""
# The lack of wss:// in the URL below is on purpose
- app = ws.WebSocketApp('streaming.vn.teslamotors.com/streaming/')
+ app = ws.WebSocketApp('wss://streaming.vn.teslamotors.com/streaming/')
app.run_forever(ping_interval=2, ping_timeout=1, ping_payload="Ping payload")
@unittest.skipUnless(TEST_WITH_INTERNET, "Internet-requiring tests are disabled")