[
https://issues.apache.org/jira/browse/HTTPCLIENT-1955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16719076#comment-16719076
]
ASF GitHub Bot commented on HTTPCLIENT-1955:
--------------------------------------------
GitHub user jborgland opened a pull request:
https://github.com/apache/httpcomponents-client/pull/123
Better handling of http(s).proxyUser and http(s).proxyPassword
Suggested fix for HTTPCLIENT-1955.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jborgland/httpcomponents-client 4.5.x
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/httpcomponents-client/pull/123.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #123
----
commit 44b60dd691a62e112f9b80390db7db055bb91bd5
Author: Jens Borgland <jborglan@...>
Date: 2018-12-12T14:58:39Z
Better handling of http(s).proxyUser and http(s).proxyPassword
----
> Proxy authentication doesn't fully work when using system properties
> --------------------------------------------------------------------
>
> Key: HTTPCLIENT-1955
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1955
> Project: HttpComponents HttpClient
> Issue Type: Bug
> Components: HttpClient (classic)
> Affects Versions: 4.5.6
> Reporter: Jens Borgland
> Priority: Minor
>
> *Repro*:
> # Set up an authenticating HTTP proxy (I used Squid)
> # Specify the {{https.proxyHost}}, {{https.proxyPort}}, {{https.proxyUser}}
> and {{https.proxyPassword}} system properties
> # Specify {{useSystemProperties}} when creating the client
> # Make a call (to an HTTPS target)
> *Result*:
> The call fails with a 407.
> *Expected*:
> That the client would be able to authenticate towards the proxy.
> Example code:
> {code:java}
> System.setProperty("https.proxyHost" , "localhost");
> System.setProperty("https.proxyPort" , "3128");
> System.setProperty("https.proxyUser", "squid");
> System.setProperty("https.proxyPassword", "squid");
> CloseableHttpClient httpclient =
> HttpClients.custom().useSystemProperties().build();
> HttpGet httpGet = new HttpGet("https://www.google.com");
> CloseableHttpResponse res = httpclient.execute(httpGet);
> System.out.println(res.getStatusLine());
> {code}
> *Technical*:
> The reason that it doesn't work is that the {{AuthScope}} given to
> {{SystemDefaultCredentialsProvider}} uses "http" as scope (the
> {{SystemDefaultRoutePlanner}} always selects "http") but
> {{SystemDefaultCredentialsProvider}} uses this protocol as part of the name
> of the system properties from which to retrieve credentials and therefore
> looks for {{http.proxyHost}}, {{http.proxyPort}}, {{http.proxyUser}} and
> {{http.proxyPassword}}.
> (a workaround is thus to specify all eight parameters, with both the http.
> and https. prefixes but that doesn't seem like a good solution)
> I'll make a pull request with a suggested fix.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]