Github user ok2c commented on a diff in the pull request:
https://github.com/apache/httpcomponents-client/pull/123#discussion_r241344569
--- Diff:
httpclient/src/main/java/org/apache/http/impl/client/SystemDefaultCredentialsProvider.java
---
@@ -116,25 +116,16 @@ public Credentials getCredentials(final AuthScope
authscope) {
if (systemcreds == null) {
systemcreds = getSystemCreds(protocol, authscope,
Authenticator.RequestorType.PROXY);
}
- if (systemcreds == null) {
- final String proxyHost = System.getProperty(protocol +
".proxyHost");
- if (proxyHost != null) {
- final String proxyPort = System.getProperty(protocol +
".proxyPort");
- if (proxyPort != null) {
- try {
- final AuthScope systemScope = new
AuthScope(proxyHost, Integer.parseInt(proxyPort));
- if (authscope.match(systemScope) >= 0) {
- final String proxyUser =
System.getProperty(protocol + ".proxyUser");
- if (proxyUser != null) {
- final String proxyPassword =
System.getProperty(protocol + ".proxyPassword");
- systemcreds = new
PasswordAuthentication(proxyUser, proxyPassword != null ?
proxyPassword.toCharArray() : new char[] {});
- }
- }
- } catch (final NumberFormatException ex) {
- }
- }
- }
- }
+ if (systemcreds == null) {
+ // Look for values given using
http.proxyUser/http.proxyPassword or
+ // https.proxyUser/https.proxyPassword. We
cannot simply use the protocol from
+ // the origin since a proxy retrieved from
https.proxyHost/https.proxyPort will
+ // still use http as protocol
+ systemcreds = getProxyCredentials("http",
authscope);
+ if (systemcreds == null) {
+ systemcreds =
getProxyCredentials("https", authscope);
+ }
--- End diff --
@jborgland Feel free to propose API changes in master
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]