Skip to content

HTTP/1: End stream before closing when a response ends with its headers - #374

Open
the-mikedavis wants to merge 1 commit into
ninenines:masterfrom
the-mikedavis:md/end-stream-on-connection-close
Open

HTTP/1: End stream before closing when a response ends with its headers#374
the-mikedavis wants to merge 1 commit into
ninenines:masterfrom
the-mikedavis:md/end-stream-on-connection-close

Conversation

@the-mikedavis

Copy link
Copy Markdown

When an HTTP/1.1 response asks for the connection to be closed and has no body (for example a 204, a 304, or a content-length: 0 response), gun issued the close command without removing the completed stream from the state first. The stream was therefore still around when the connection was torn down, so its owner received a spurious gun_error with reason {closed, normal} and the stream ref was listed in the killed_streams element of the gun_down message, even though the response had completed successfully. We can use the end_stream/1 helper to fix this behavior.

When an HTTP/1.1 response asks for the connection to be closed and has
no body (for example a 204, a 304, or a `content-length: 0` response),
gun issued the `close` command without removing the completed stream
from the state first. The stream was therefore still around when the
connection was torn down, so its owner received a spurious `gun_error`
with reason `{closed, normal}` and the stream ref was listed in the
`killed_streams` element of the `gun_down` message, even though the
response had completed successfully. We can use the `end_stream/1`
helper to fix this behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant