Skip to content

Commit

Permalink
RemoteProtocolError always have an event_hint
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Oct 29, 2022
1 parent cd9018b commit a5dcf5d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions uvicorn/protocols/websockets/wsproto_impl.py
Expand Up @@ -87,13 +87,8 @@ def data_received(self, data):
try:
self.conn.receive_data(data)
except RemoteProtocolError as err:
if err.event_hint is not None:
self.transport.write(self.conn.send(err.event_hint))
self.transport.close()
else:
# Response with the "1002 Protocol Error" code.
# See https://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number
self.handle_no_connect(events.CloseConnection(code=1002))
self.transport.write(self.conn.send(err.event_hint))
self.transport.close()
else:
self.handle_events()

Expand Down

0 comments on commit a5dcf5d

Please sign in to comment.