You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: Handle client disconnection for HTTP and WebSocket according to ASGI spec
For HTTP connections:
- If the app is sending data using the send callable, according to the ASGI spec, it should throw an exception
in case of client disconnection. Previously, even if we processed the client_error message
and set the http->closed state, it wouldn't throw an error because it wasn't handled.
This change ensures that the exception is raised as per the ASGI spec.
For WebSocket connections:
- If the app is awaiting on receive, it would get a 'websocket.disconnect' event.
However, if the app continues to send data using the send callable after receiving this event,
it wouldn't raise an error because ws->state = NXT_WS_DISCONNECTED was never set in that case.
According to the ASGI spec, if send is called after receiving a 'websocket.disconnect' event or on a closed client,
it should raise an exception. This change ensures that the exception is raised as per the ASGI spec.
0 commit comments