hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (HTTPASYNC-118) HttpAsyncClients.createSystem() won't use a SystemDefaultCredentialsProvider
Date Thu, 23 Feb 2017 15:09:44 GMT

     [ https://issues.apache.org/jira/browse/HTTPASYNC-118?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oleg Kalnichevski updated HTTPASYNC-118:
----------------------------------------
    Affects Version/s:     (was: 4.1.2)
                       4.1.3
        Fix Version/s: 4.1.4

> HttpAsyncClients.createSystem() won't use a SystemDefaultCredentialsProvider
> ----------------------------------------------------------------------------
>
>                 Key: HTTPASYNC-118
>                 URL: https://issues.apache.org/jira/browse/HTTPASYNC-118
>             Project: HttpComponents HttpAsyncClient
>          Issue Type: Improvement
>    Affects Versions: 4.1.3
>            Reporter: Yves ERB
>            Priority: Minor
>             Fix For: 4.1.4
>
>
> My HTTP proxy needs authentication.
> First I setup my proxy :
> {code:borderStyle=solid}
> System.setProperty("http.proxyHost", host);
> System.setProperty("http.proxyPort", String.valueOf(port));
> System.setProperty("https.proxyHost", host);
> System.setProperty("https.proxyPort", String.valueOf(port));
> System.setProperty("http.nonProxyHosts", exclusions);
> System.setProperty("https.nonProxyHosts", exclusions);
> Authenticator.setDefault(new ProxyAuthenticator(user, password));
> {code}
> Nothing particular here.
> When I create an HttpClient like this:
> {code:borderStyle=solid}
> HttpClients.createSystem();
> {code}
> or
> {code:borderStyle=solid}
> HttpClientBuilder.create.useSystemProperties().build();
> {code}
> The client is able to use my proxy. However, when I create an HttpAsyncClient like this
:
> {code:borderStyle=solid}
> HttpAsyncClients.createSystem();
> {code}
> or
> {code:borderStyle=solid}
> HttpAsyncClientBuilder.create().useSystemProperties().build();
> {code}
> The async client gets a 407.
> It's due to different default settings.
> In HttpClientBuilder:
> {code:borderStyle=solid}
> CredentialsProvider defaultCredentialsProvider = this.credentialsProvider;
> if (defaultCredentialsProvider == null) {
>     if (systemProperties) {
>         defaultCredentialsProvider = new SystemDefaultCredentialsProvider();
>     } else {
>         defaultCredentialsProvider = new BasicCredentialsProvider();
>     }
> }
> {code}
> In HttpAsyncClientBuilder:
> {code:borderStyle=solid}
> CredentialsProvider defaultCredentialsProvider = this.credentialsProvider;
> if (defaultCredentialsProvider == null) {
>     defaultCredentialsProvider = new BasicCredentialsProvider();
> }
> {code}
> I can fix the async client with this code :
> {code:borderStyle=solid}
> HttpAsyncClientBuilder.create().useSystemProperties()
>     .setDefaultCredentialsProvider(new SystemDefaultCredentialsProvider())
>     .build();
> {code}
> However it would be nice to have consistent builders.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message