walklown commented on code in PR #14026:
URL: https://github.com/apache/dubbo/pull/14026#discussion_r1594238993


##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java:
##########
@@ -143,31 +149,54 @@ public void configServerProtocolHandler(URL url, 
ChannelOperator operator) {
     }
 
     private void configurerHttp1Handlers(URL url, List<ChannelHandler> 
handlers) {
-        handlers.add(new ChannelHandlerPretender(new HttpServerCodec()));
+        final HttpServerCodec sourceCodec = new HttpServerCodec();
+        handlers.add(new ChannelHandlerPretender(sourceCodec));
+        // Triple protocol http1 upgrade support
+        handlers.add(new ChannelHandlerPretender(new HttpServerUpgradeHandler(
+                sourceCodec,
+                protocol -> {
+                    if 
(!AsciiString.contentEquals(Http2CodecUtil.HTTP_UPGRADE_PROTOCOL_NAME, 
protocol)) {
+                        // Not upgrade request
+                        return null;
+                    }
+                    return buildHttp2ServerUpgradeCodec(url);
+                },
+                Integer.MAX_VALUE)));
+        // If the upgrade was successful, remove the message from the output 
list
+        // so that it's not propagated to the next handler. This request will
+        // be propagated as a user event instead.
         handlers.add(new ChannelHandlerPretender(new 
HttpObjectAggregator(Integer.MAX_VALUE)));
         handlers.add(new ChannelHandlerPretender(new NettyHttp1Codec()));
         handlers.add(new ChannelHandlerPretender(new 
NettyHttp1ConnectionHandler(
                 url, frameworkModel, 
DefaultHttp11ServerTransportListenerFactory.INSTANCE)));
     }
 
+    private Http2ServerUpgradeCodec buildHttp2ServerUpgradeCodec(URL url) {
+        Configuration config = 
ConfigurationUtils.getGlobalConfiguration(url.getOrDefaultApplicationModel());

Review Comment:
   configurerHttp2Handlers -> buildHttp2FrameCodec,do not need this. This next 
piece of advice is great !



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org

Reply via email to