Skip to content

Commit 5e262a3

Browse files
committed
Add javadoc to Netty ENABLE_SSL_HOSTNAME_VERIFICATION configuration property
Signed-off-by: jansupol <jan.supol@oracle.com>
1 parent 6421e1f commit 5e262a3

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyClientProperties.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -54,5 +54,18 @@ public class NettyClientProperties {
5454
*/
5555
public static final String MAX_CONNECTIONS = "jersey.config.client.maxConnections";
5656

57+
/**
58+
* <p>
59+
* Sets the endpoint identification algorithm to HTTPS.
60+
* </p>
61+
* <p>
62+
* The default value is {@code true} (for HTTPS uri scheme).
63+
* </p>
64+
* <p>
65+
* The name of the configuration property is <tt>{@value}</tt>.
66+
* </p>
67+
* @since 2.35
68+
* @see javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String)
69+
*/
5770
public static final String ENABLE_SSL_HOSTNAME_VERIFICATION = "jersey.config.client.tls.enableHostnameVerification";
5871
}

connectors/netty-connector/src/main/java/org/glassfish/jersey/netty/connector/NettyConnector.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -61,7 +61,9 @@
6161
import io.netty.handler.codec.http.HttpUtil;
6262
import io.netty.handler.codec.http.HttpVersion;
6363
import io.netty.handler.proxy.HttpProxyHandler;
64+
import io.netty.handler.ssl.ApplicationProtocolConfig;
6465
import io.netty.handler.ssl.ClientAuth;
66+
import io.netty.handler.ssl.IdentityCipherSuiteFilter;
6567
import io.netty.handler.ssl.JdkSslContext;
6668
import io.netty.handler.ssl.SslHandler;
6769
import io.netty.handler.stream.ChunkedWriteHandler;
@@ -241,7 +243,16 @@ protected void initChannel(SocketChannel ch) throws Exception {
241243
// Enable HTTPS if necessary.
242244
if ("https".equals(requestUri.getScheme())) {
243245
// making client authentication optional for now; it could be extracted to configurable property
244-
JdkSslContext jdkSslContext = new JdkSslContext(client.getSslContext(), true, ClientAuth.NONE);
246+
JdkSslContext jdkSslContext = new JdkSslContext(
247+
client.getSslContext(),
248+
true,
249+
(Iterable) null,
250+
IdentityCipherSuiteFilter.INSTANCE,
251+
(ApplicationProtocolConfig) null,
252+
ClientAuth.NONE,
253+
(String[]) null, /* enable default protocols */
254+
false /* true if the first write request shouldn't be encrypted */
255+
);
245256
int port = requestUri.getPort();
246257
SslHandler sslHandler = jdkSslContext.newHandler(ch.alloc(), requestUri.getHost(),
247258
port <= 0 ? 443 : port, executorService);

0 commit comments

Comments
 (0)