walklown commented on code in PR #14026: URL: https://github.com/apache/dubbo/pull/14026#discussion_r1579263649
########## dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java: ########## @@ -143,13 +148,63 @@ 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); + }))); + // 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()); + final Http2FrameCodec codec = TripleHttp2FrameCodecBuilder.forServer() Review Comment: Down. -- 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