|
33 | 33 | import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
|
34 | 34 | import io.netty.util.internal.logging.InternalLogger;
|
35 | 35 | import io.netty.util.internal.logging.InternalLoggerFactory;
|
| 36 | +import reactor.core.Exceptions; |
36 | 37 | import reactor.netty.tcp.SslProvider;
|
37 | 38 |
|
38 | 39 | import javax.net.ssl.HostnameVerifier;
|
39 | 40 | import javax.net.ssl.SSLEngine;
|
40 | 41 | import javax.net.ssl.SSLException;
|
41 | 42 | import java.io.File;
|
42 | 43 | import java.net.InetSocketAddress;
|
43 |
| -import java.util.function.Consumer; |
44 | 44 |
|
45 | 45 | import static io.asyncer.r2dbc.mysql.internal.util.AssertUtils.requireNonNull;
|
46 | 46 | import static io.netty.handler.ssl.SslProvider.JDK;
|
@@ -151,10 +151,16 @@ private void handleSslState(ChannelHandlerContext ctx, SslState state) {
|
151 | 151 | switch (state) {
|
152 | 152 | case BRIDGING:
|
153 | 153 | logger.debug("SSL event triggered, enable SSL handler to pipeline");
|
154 |
| - |
155 |
| - SslProvider sslProvider = SslProvider.builder() |
156 |
| - .sslContext(MySqlSslContextSpec.forClient(ssl, context)) |
157 |
| - .build(); |
| 154 | + final SslProvider sslProvider; |
| 155 | + try { |
| 156 | + // Workaround for a forward incompatible change in reactor-netty version 1.2.0 |
| 157 | + // See: https://github.com/reactor/reactor-netty/commit/6d0c24d83a7c5b15e403475272293f847415191c |
| 158 | + sslProvider = SslProvider.builder() |
| 159 | + .sslContext(MySqlSslContextSpec.forClient(ssl, context).sslContext()) |
| 160 | + .build(); |
| 161 | + } catch (SSLException e) { |
| 162 | + throw Exceptions.propagate(e); |
| 163 | + } |
158 | 164 | SslHandler sslHandler = sslProvider.getSslContext().newHandler(ctx.alloc());
|
159 | 165 |
|
160 | 166 | this.sslEngine = sslHandler.engine();
|
@@ -195,24 +201,14 @@ private static boolean isTls13Enabled(ConnectionContext context) {
|
195 | 201 | || (version.isGreaterThanOrEqualTo(MYSQL_5_6_0) && version.isEnterprise());
|
196 | 202 | }
|
197 | 203 |
|
198 |
| - private static final class MySqlSslContextSpec implements SslProvider.ProtocolSslContextSpec { |
| 204 | + private static final class MySqlSslContextSpec { |
199 | 205 |
|
200 | 206 | private final SslContextBuilder builder;
|
201 | 207 |
|
202 | 208 | private MySqlSslContextSpec(SslContextBuilder builder) {
|
203 | 209 | this.builder = builder;
|
204 | 210 | }
|
205 | 211 |
|
206 |
| - @Override |
207 |
| - public MySqlSslContextSpec configure(Consumer<SslContextBuilder> customizer) { |
208 |
| - requireNonNull(customizer, "customizer must not be null"); |
209 |
| - |
210 |
| - customizer.accept(builder); |
211 |
| - |
212 |
| - return this; |
213 |
| - } |
214 |
| - |
215 |
| - @Override |
216 | 212 | public SslContext sslContext() throws SSLException {
|
217 | 213 | return builder.build();
|
218 | 214 | }
|
|
0 commit comments