Skip to content

Commit 9b615ed

Browse files
committed
Fix missing sslInfo with Reactor Netty and http/2
Prior to this commit, the `SslInfo` would be missing for WebFlux apps when deployed on Reactor Netty with http/2. This commit ensures that the request adapter checks the current channel and the parent channel for the presence of the `SslHander`. In the case of http/2, the `SslHander` is tied to the parent channel. Fixes gh-25278
1 parent d07be59 commit 9b615ed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

spring-web/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpRequest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import javax.net.ssl.SSLSession;
2525

26+
import io.netty.channel.Channel;
2627
import io.netty.handler.codec.http.HttpHeaderNames;
2728
import io.netty.handler.codec.http.cookie.Cookie;
2829
import io.netty.handler.ssl.SslHandler;
@@ -166,7 +167,11 @@ public InetSocketAddress getRemoteAddress() {
166167
@Override
167168
@Nullable
168169
protected SslInfo initSslInfo() {
169-
SslHandler sslHandler = ((Connection) this.request).channel().pipeline().get(SslHandler.class);
170+
Channel channel = ((Connection) this.request).channel();
171+
SslHandler sslHandler = channel.pipeline().get(SslHandler.class);
172+
if (sslHandler == null && channel.parent() != null) { // HTTP/2
173+
sslHandler = channel.parent().pipeline().get(SslHandler.class);
174+
}
170175
if (sslHandler != null) {
171176
SSLSession session = sslHandler.engine().getSession();
172177
return new DefaultSslInfo(session);

0 commit comments

Comments
 (0)