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

Clarify behavior of Mint.HTTP.stream/3 #459

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/mint/http.ex
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,14 @@ defmodule Mint.HTTP do
where `conn` is the updated connection, `reason` is the error reason, and `responses`
is a list of responses that were correctly parsed before the error.

> #### Graceful Close {: .tip}
>
> If this function returns `{:ok, conn, responses}`, it doesn't *necessarily* mean
> that the connection is still open. For example, TCP/SSL **close** messages are treated
> as errors only if there are in-flight requests. If there are no in-flight requests,
> the connection is closed gracefully and `{:ok, conn, responses}` is returned.
> Always check with `open?/1` to see if the connection is still open.

If the given `message` is not from the connection's socket,
this function returns `:unknown`.

Expand Down
Loading