Skip to content

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

@adriangb

Description

@adriangb

Prompted by Kludex/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions