Skip to content

Commit

Permalink
Use sanitised result of selected_subprotocol
Browse files Browse the repository at this point in the history
- Fix #442
- Fix #445
  • Loading branch information
benz0li committed Feb 16, 2024
1 parent 9b624c4 commit e7429df
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions jupyter_server_proxy/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ async def start_websocket_connection():
request=request,
on_message_callback=message_cb,
on_ping_callback=ping_cb,
subprotocols=self.subprotocols,
subprotocols=self.selected_subprotocol,
resolver=resolver,
)
self._record_activity()
Expand Down Expand Up @@ -530,14 +530,6 @@ def check_xsrf_cookie(self):
Defer to proxied apps.
"""

def select_subprotocol(self, subprotocols):
"""Select a single Sec-WebSocket-Protocol during handshake."""
self.subprotocols = subprotocols
if isinstance(subprotocols, list) and subprotocols:
self.log.debug(f"Client sent subprotocols: {subprotocols}")
return subprotocols[0]
return super().select_subprotocol(subprotocols)


class LocalProxyHandler(ProxyHandler):
"""
Expand Down

0 comments on commit e7429df

Please sign in to comment.