Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should "http.disconnect" be sent once or repeatedly? #334

Closed
adriangb opened this issue Jun 26, 2022 · 1 comment · Fixed by #344
Closed

Should "http.disconnect" be sent once or repeatedly? #334

adriangb opened this issue Jun 26, 2022 · 1 comment · Fixed by #344

Comments

@adriangb
Copy link
Contributor

Prompted by encode/starlette#1706 (comment)

The spec currently says:

Sent to the application when a HTTP connection is closed or if receive is called after a response has been sent.

After reading this multiple times it sounds to me like it is saying that if the HTTP connection is closed the message might only be sent once but in the case "receive is called after the response was sent" it would be delivered multiple times (otherwise it should say "the first time receive is called after a response has been sent).

Uvicorn seems to always send the message multiple times, but it's unclear if that's part of the spec or just an implementation detail.

Could we clarify the spec to:

Sent to the application if receive is called after a response has been sent or after the HTTP connection has been closed.

I think that makes it clearer that the server will continue to deliver this message multiple times in either scenario.

adriangb added a commit to adriangb/asgiref that referenced this issue Sep 9, 2022
andrewgodwin pushed a commit that referenced this issue Sep 9, 2022
@andrewgodwin
Copy link
Member

Totally agreed here - I've accepted the PR in. Thanks for bringing it up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants