Skip to content

Commit 6b6f1d4

Browse files
authored
Clarify behavior of Mint.HTTP.stream/3 (#459)
1 parent 0d15d72 commit 6b6f1d4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/mint/http.ex

+8
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,14 @@ defmodule Mint.HTTP do
710710
where `conn` is the updated connection, `reason` is the error reason, and `responses`
711711
is a list of responses that were correctly parsed before the error.
712712
713+
> #### Graceful Close {: .tip}
714+
>
715+
> If this function returns `{:ok, conn, responses}`, it doesn't *necessarily* mean
716+
> that the connection is still open. For example, TCP/SSL **close** messages are treated
717+
> as errors only if there are in-flight requests. If there are no in-flight requests,
718+
> the connection is closed gracefully and `{:ok, conn, responses}` is returned.
719+
> Always check with `open?/1` to see if the connection is still open.
720+
713721
If the given `message` is not from the connection's socket,
714722
this function returns `:unknown`.
715723

0 commit comments

Comments
 (0)