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] [Resolved] (HTTPCLIENT-1477) javax.net.ssl.keyStore is ignored by HttpClientBuilder.useSystemProperties()
Date Thu, 06 Mar 2014 15:06:47 GMT

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

Oleg Kalnichevski resolved HTTPCLIENT-1477.
-------------------------------------------

    Resolution: Invalid

Saul,

Please note that some of the HttpClientBuilder setters are mutually exclusive. If one provides
a custom connection manager, HttpClientBuilder cannot make use of other settings related to
connection management. It becomes a responsibility of the caller to ensure that  the connection
manager is correctly constructed.

You can re-structure your code like that 

{code:java}
HttpClientBuilder builder = HttpClients.custom()
        .setMaxConnPerRoute(maxConnections)
        .setMaxConnTotal(maxConnections)
        .useSystemProperties();
{code}

or like that

{code:java}
Registry<ConnectionSocketFactory> registry = RegistryBuilder.<ConnectionSocketFactory>create()
        .register("http", PlainConnectionSocketFactory.getSocketFactory())
        .register("https", SSLConnectionSocketFactory.getSystemSocketFactory())
        .build();

PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(registry);
connectionManager.setDefaultMaxPerRoute(maxConnections);
connectionManager.setMaxTotal(maxConnections);

HttpClientBuilder builder = HttpClients.custom()
        .setConnectionManager(connectionManager)
        .useSystemProperties();
{code}


> javax.net.ssl.keyStore is ignored by HttpClientBuilder.useSystemProperties()
> ----------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1477
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1477
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Documentation, HttpClient
>    Affects Versions: 4.3.4
>            Reporter: Saul Hazledine
>            Priority: Minor
>         Attachments: fail.log, program.7z, success.log
>
>
> The javadoc for HttpClientBuilder states that the useSystemProperties() method can be
used to take system properties into account when building a HttpClient.
> The javadoc gives a list of the system properties that are considered. In this list is
the property:
> javax.net.ssl.keyStore
> However, setting javax.net.Debug when using the HttpClientBuilder shows that the keystore
is never read in and client certificate authentication fails.
> Attached (program.7z) is a test program that shows the behaviour. It has the following
usage:
> Usage: [options] URL...
> 	[--help -h] : show help
> 	[--keyStore value] : the key store
> 	[--keyStorePassword value] : the key store password
> 	[--simple] : use a standard JDK connection
> 	[--trustStore value] : the trust store
> 	[--trustStorePassword value] : the trust store password
> When using the --simple flag the keystore is read in using the System properties and
client certificate authentication is successful (attachment success.log). 
> When using the Apache HttpClient the keystore is not read in and client certificate authentication
fails (attachment fail.log).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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


Mime
View raw message