Skip to content

Commit

Permalink
[WebTransport] Check event type before using its properties (#31036)
Browse files Browse the repository at this point in the history
The below code is problematic

  if self._session_stream_id == event.stream_id and\
    isinstance(event, WebTransportStreamDataReceived):

because it uses event's property before checking its type. This
leads to errors when event without stream_id comes here. This
change fixes that.
  • Loading branch information
yutakahirano authored Sep 30, 2021
1 parent d884c5c commit a302497
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/webtransport/h3/webtransport_h3_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def _h3_event_received(self, event: H3Event) -> None:
self._send_error_response(event.stream_id, 400)
self._session_stream_id = event.stream_id

if self._session_stream_id == event.stream_id and\
isinstance(event, WebTransportStreamDataReceived):
if isinstance(event, WebTransportStreamDataReceived) and\
self._session_stream_id == event.stream_id:
self._session_stream_data += event.data
if event.stream_ended:
close_info = None
Expand Down

0 comments on commit a302497

Please sign in to comment.