Repository navigation
Conversation
The proxy username and password were registered under AuthScope(null, -1), which HttpClient also consults for an origin server's 401 challenge, so a server reached through the proxy could collect the proxy password with a Basic challenge. Scope the credentials to the proxy host and port, and add them to a credentials provider the request already carries instead of replacing it, so origin credentials set through enableAuthentication survive.
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.
HTTPProxyConfigurator.configure registered the proxy username and password under AuthScope(null, -1), the any-host scope, on the credentials provider that HttpClient 5 also consults for an origin server's 401. a server reached through the proxy, or any host a redirect lands on, could answer a repeatable request (GET, DELETE, an unchunked POST or one with allowedRetry) with a Basic challenge and get Authorization: Basic proxyuser:proxypass on the retry, inside its own TLS session when tunnelled. configure also replaced the provider that RequestImpl.enableAuthentication had already filled, so with both configured the origin was given the proxy password instead of its own. scope the credentials to the proxy host and port and add them to the existing BasicCredentialsProvider; ProxyCredentialScopeTest drives RequestImpl through a stub proxy with a real HttpClient and fails on master for both the origin 401 and the overridden origin credentials, while the proxy's 407 is still answered. HTTPProxyConfiguratorTest in modules/integration now also asserts an origin scope gets no credentials.