Fix bugs and resource leaks in Apache HttpClient protocol implementation#1863
Merged
Fix bugs and resource leaks in Apache HttpClient protocol implementation#1863
Conversation
The proxy race condition fix (a08a456) introduced two regressions: The local builder for proxied requests lost: Default headers User-Agent A new CloseableHttpClient was created on every request, even when no proxy was used Fixes applied Store userAgent and defaultHeaders as fields Pass these fields to the proxy builder Build the client once in configure() and reuse it for non-proxy requests Additional fixes Fix toByteArray() returning null when the entity input stream is null Close the static CONNECTION_MANAGER in cleanup() Wrap the entity InputStream in a try-with-resources block
jnioche
approved these changes
Apr 1, 2026
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.
The proxy race condition fix (
a08a456b) introduced two regressions:The local builder for proxied requests lost:
A new
CloseableHttpClientwas created on every request, even when no proxy was usedFixes applied
userAgentanddefaultHeadersas fieldsconfigure()and reuse it for non-proxy requestsAdditional fixes
toByteArray()returningnullwhen the entity input stream isnullCONNECTION_MANAGERincleanup()InputStreamin a try-with-resources block