Skip to content

Commit

Permalink
KTOR-4712 Use Netty's alpn check instead of attempting to load jetty-…
Browse files Browse the repository at this point in the history
…alpn class (#3115)

Prefer SslProvider.OPENSSL over SslProvider.JDK for better performance
  • Loading branch information
ascheja committed Sep 2, 2022
1 parent aab530a commit d917744
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,15 @@ public class NettyChannelInitializer(

private fun findAlpnProvider(): SslProvider? {
try {
Class.forName("sun.security.ssl.ALPNExtension", true, null)
return SslProvider.JDK
if (SslProvider.isAlpnSupported(SslProvider.OPENSSL)) {
return SslProvider.OPENSSL
}
} catch (ignore: Throwable) {
}

try {
if (SslProvider.isAlpnSupported(SslProvider.OPENSSL)) {
return SslProvider.OPENSSL
if (SslProvider.isAlpnSupported(SslProvider.JDK)) {
return SslProvider.JDK
}
} catch (ignore: Throwable) {
}
Expand Down

0 comments on commit d917744

Please sign in to comment.