-
Notifications
You must be signed in to change notification settings - Fork 22
Fix and optimize behaviors around Connection
header and re-used transport connections
#444
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
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
Updated the ExchangeCompletionSource to use TrySetResult instead of SetResult. This change allows for a safer attempt to set the result without throwing an exception if the result has already been set.
Added a `_disposed` field to manage object state and prevent operations on disposed objects. Updated the `Dispose` method to check this state before proceeding. Enhanced connection management by replacing asynchronous client reading with a loop to handle incoming connections more effectively. Ensured errors are ignored during listener shutdown and that connections are properly completed before resource release.
Added a line to set the `shouldClose` variable to false before returning the result of the status code check. This change ensures that the connection closure logic is consistently handled in this context.
The check for whether to close the downstream connection has been removed. The code now simply awaits the completion of the exchange without modifying the `shouldCloseConnectionToDownStream` variable.
Modified the condition for checking if reading is complete in `MetricsStream.cs`. The check now verifies if `TotalRead` is greater than or equal to `_expectedLength` instead of the previous logic. This change ensures correct evaluation of the final read notification when the expected length is specified.
…thout notifications
- Added checks in `Http11PoolProcessing.cs` to manage connection closure based on response body presence and `Content-Length` header. - Introduced `ReadUntilClose` property in `Exchange.cs` to control reading until connection closure. - Updated `ProxyOrchestrator.cs` to close downstream connections when `ReadUntilClose` is true. - Removed outdated comment regarding HTTP/2 response handling.
Updated the TransformResponse method to utilize an asynchronous function. The new implementation now waits for the originalStream to be drained asynchronously before creating and returning the MemoryStream with the drained content.
- Added _emptyBody and _ommitContentLength fields to ConnectionCloseTestServer. - Updated TcpListener port from 0 to 8501 and modified constructor. - Implemented checks for empty body and missing Content-Length in HTTP responses. - Created RandomConnectionBehaviourTest.cs with tests for connection closure scenarios. - Removed SubsequentSslClose.cs as it is no longer needed.
The method now returns a new object with a configured timeout of 15 seconds for the HTTP message handler, improving request management by adding a time limit for responses.
This was referenced Aug 26, 2025
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.
No description provided.