Skip to content

HTTP1Connection: Close on error while in request #425

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

Merged

Conversation

fabianfett
Copy link
Member

Motivation

In the HTTP1ConnectionStateMachine we set the connection state to .closed after having forwarded an error to the inner RequestStateMachine. Since we set the error to close, the state.modify function did not create an action that would close the connection.

Changes

  • Modify the ConnectionState based on the RequestStateMachine only in the state.modify function.
  • Add a test to verify the fixed behavior.
  • Use ExpressibleByDictionaryLiteral syntax for some HTTPHeaders to increase readability.

Result

Connections are closed, if an error happens, while we are in a request.

@fabianfett fabianfett added the 🔨 semver/patch No public API change. label Sep 13, 2021
@fabianfett fabianfett added this to the HTTP/2 support milestone Sep 13, 2021
@fabianfett fabianfett requested a review from Lukasa September 13, 2021 17:48
Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

@fabianfett fabianfett merged commit 324adb7 into swift-server:main Sep 14, 2021
@fabianfett fabianfett deleted the ff-close-on-error-while-in-request branch September 14, 2021 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants