mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 02:05:12 +00:00
[rh:websockets] Upgrade websockets to 13.0 (#10815)
Fixes CI hanging Authored by: coletdjnz
This commit is contained in:
parent
f0bb28504c
commit
6f9e653743
5 changed files with 8 additions and 9 deletions
1
.github/workflows/core.yml
vendored
1
.github/workflows/core.yml
vendored
|
@ -55,6 +55,7 @@ jobs:
|
||||||
- name: Install test requirements
|
- name: Install test requirements
|
||||||
run: python3 ./devscripts/install_deps.py --include test --include curl-cffi
|
run: python3 ./devscripts/install_deps.py --include test --include curl-cffi
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
timeout-minutes: 15
|
||||||
continue-on-error: False
|
continue-on-error: False
|
||||||
run: |
|
run: |
|
||||||
python3 -m yt_dlp -v || true # Print debug head
|
python3 -m yt_dlp -v || true # Print debug head
|
||||||
|
|
1
.github/workflows/quick-test.yml
vendored
1
.github/workflows/quick-test.yml
vendored
|
@ -17,6 +17,7 @@ jobs:
|
||||||
- name: Install test requirements
|
- name: Install test requirements
|
||||||
run: python3 ./devscripts/install_deps.py --include test
|
run: python3 ./devscripts/install_deps.py --include test
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
timeout-minutes: 15
|
||||||
run: |
|
run: |
|
||||||
python3 -m yt_dlp -v || true
|
python3 -m yt_dlp -v || true
|
||||||
python3 ./devscripts/run_tests.py core
|
python3 ./devscripts/run_tests.py core
|
||||||
|
|
|
@ -49,7 +49,7 @@ dependencies = [
|
||||||
"pycryptodomex",
|
"pycryptodomex",
|
||||||
"requests>=2.32.2,<3",
|
"requests>=2.32.2,<3",
|
||||||
"urllib3>=1.26.17,<3",
|
"urllib3>=1.26.17,<3",
|
||||||
"websockets>=12.0",
|
"websockets>=13.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.optional-dependencies]
|
[project.optional-dependencies]
|
||||||
|
|
|
@ -88,7 +88,7 @@ def create_wss_websocket_server():
|
||||||
certfn = os.path.join(TEST_DIR, 'testcert.pem')
|
certfn = os.path.join(TEST_DIR, 'testcert.pem')
|
||||||
sslctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
sslctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
||||||
sslctx.load_cert_chain(certfn, None)
|
sslctx.load_cert_chain(certfn, None)
|
||||||
return create_websocket_server(ssl_context=sslctx)
|
return create_websocket_server(ssl=sslctx)
|
||||||
|
|
||||||
|
|
||||||
MTLS_CERT_DIR = os.path.join(TEST_DIR, 'testdata', 'certificate')
|
MTLS_CERT_DIR = os.path.join(TEST_DIR, 'testdata', 'certificate')
|
||||||
|
@ -103,7 +103,7 @@ def create_mtls_wss_websocket_server():
|
||||||
sslctx.load_verify_locations(cafile=cacertfn)
|
sslctx.load_verify_locations(cafile=cacertfn)
|
||||||
sslctx.load_cert_chain(certfn, None)
|
sslctx.load_cert_chain(certfn, None)
|
||||||
|
|
||||||
return create_websocket_server(ssl_context=sslctx)
|
return create_websocket_server(ssl=sslctx)
|
||||||
|
|
||||||
|
|
||||||
def create_legacy_wss_websocket_server():
|
def create_legacy_wss_websocket_server():
|
||||||
|
@ -112,7 +112,7 @@ def create_legacy_wss_websocket_server():
|
||||||
sslctx.maximum_version = ssl.TLSVersion.TLSv1_2
|
sslctx.maximum_version = ssl.TLSVersion.TLSv1_2
|
||||||
sslctx.set_ciphers('SHA1:AESCCM:aDSS:eNULL:aNULL')
|
sslctx.set_ciphers('SHA1:AESCCM:aDSS:eNULL:aNULL')
|
||||||
sslctx.load_cert_chain(certfn, None)
|
sslctx.load_cert_chain(certfn, None)
|
||||||
return create_websocket_server(ssl_context=sslctx)
|
return create_websocket_server(ssl=sslctx)
|
||||||
|
|
||||||
|
|
||||||
def ws_validate_and_send(rh, req):
|
def ws_validate_and_send(rh, req):
|
||||||
|
@ -139,7 +139,7 @@ def setup_class(cls):
|
||||||
cls.wss_thread, cls.wss_port = create_wss_websocket_server()
|
cls.wss_thread, cls.wss_port = create_wss_websocket_server()
|
||||||
cls.wss_base_url = f'wss://127.0.0.1:{cls.wss_port}'
|
cls.wss_base_url = f'wss://127.0.0.1:{cls.wss_port}'
|
||||||
|
|
||||||
cls.bad_wss_thread, cls.bad_wss_port = create_websocket_server(ssl_context=ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER))
|
cls.bad_wss_thread, cls.bad_wss_port = create_websocket_server(ssl=ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER))
|
||||||
cls.bad_wss_host = f'wss://127.0.0.1:{cls.bad_wss_port}'
|
cls.bad_wss_host = f'wss://127.0.0.1:{cls.bad_wss_port}'
|
||||||
|
|
||||||
cls.mtls_wss_thread, cls.mtls_wss_port = create_mtls_wss_websocket_server()
|
cls.mtls_wss_thread, cls.mtls_wss_port = create_mtls_wss_websocket_server()
|
||||||
|
|
|
@ -47,10 +47,7 @@
|
||||||
# 2: "AttributeError: 'ClientConnection' object has no attribute 'recv_events_exc'. Did you mean: 'recv_events'?"
|
# 2: "AttributeError: 'ClientConnection' object has no attribute 'recv_events_exc'. Did you mean: 'recv_events'?"
|
||||||
import websockets.sync.connection # isort: split
|
import websockets.sync.connection # isort: split
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
# > 12.0
|
|
||||||
websockets.sync.connection.Connection.recv_exc = None
|
websockets.sync.connection.Connection.recv_exc = None
|
||||||
# 12.0
|
|
||||||
websockets.sync.connection.Connection.recv_events_exc = None
|
|
||||||
|
|
||||||
|
|
||||||
class WebsocketsResponseAdapter(WebSocketResponse):
|
class WebsocketsResponseAdapter(WebSocketResponse):
|
||||||
|
@ -162,7 +159,7 @@ def _send(self, request):
|
||||||
additional_headers=headers,
|
additional_headers=headers,
|
||||||
open_timeout=timeout,
|
open_timeout=timeout,
|
||||||
user_agent_header=None,
|
user_agent_header=None,
|
||||||
ssl_context=ssl_ctx if wsuri.secure else None,
|
ssl=ssl_ctx if wsuri.secure else None,
|
||||||
close_timeout=0, # not ideal, but prevents yt-dlp hanging
|
close_timeout=0, # not ideal, but prevents yt-dlp hanging
|
||||||
)
|
)
|
||||||
return WebsocketsResponseAdapter(conn, url=request.url)
|
return WebsocketsResponseAdapter(conn, url=request.url)
|
||||||
|
|
Loading…
Reference in a new issue