HTTP/1: End stream before closing when a response ends with its headers - #374
Open
the-mikedavis wants to merge 1 commit into
Open
HTTP/1: End stream before closing when a response ends with its headers#374the-mikedavis wants to merge 1 commit into
the-mikedavis wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: 0response), gun issued theclosecommand 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 spuriousgun_errorwith reason{closed, normal}and the stream ref was listed in thekilled_streamselement of thegun_downmessage, even though the response had completed successfully. We can use theend_stream/1helper to fix this behavior.