[ https://issues.apache.org/jira/browse/CAMEL-20812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-20812: -------------------------------- Priority: Minor (was: Major) > camel-netty-http: hostnameVerification option not used > ------------------------------------------------------ > > Key: CAMEL-20812 > URL: https://issues.apache.org/jira/browse/CAMEL-20812 > Project: Camel > Issue Type: Bug > Components: camel-netty-http > Environment: Camel 3.x > Java 11 > Reporter: Björn Pettersson > Priority: Minor > > I was trying to set query parameter hostnameVerification=true, in netty-http > component, but it would not take effect. > After some fault-finding it turns out that the implementation of > hostnameVerification is in DefaultClientInitializerFactory (which is used by > default in the netty component). However, in the netty-http component, > HttpClientInitializerFactory is used by default, which does not use the > hostnameVerification option. > A workaround solution was to override HttpClientInitializerFactory: > {code:java} > public class HttpsClientInitializerFactory extends > HttpClientInitializerFactory { > [constructors removed] > @Override > protected void initChannel(Channel ch) throws Exception { > super.initChannel(ch); > if (configuration.isHostnameVerification()) { > ChannelHandler handler = ch.pipeline().get("ssl"); > SSLEngine engine = ((SslHandler)handler).engine(); > SSLParameters sslParams = engine.getSSLParameters(); > sslParams.setEndpointIdentificationAlgorithm("HTTPS"); > engine.setSSLParameters(sslParams); > } > } > }{code} > The hostnameVerification option is documented in both netty and netty-http > components and it seems odd that it would require a custom > ClientInitializerFactory. > A possible solution would be to re-use the implementation from > DefaultClientInitializerFactory in HttpClientInitializerFactory. > Only tested in Camel 3.x but dont see any changes affecting this since > implementation in CAMEL-16315 -- This message was sent by Atlassian Jira (v8.20.10#820010)