You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/08/16 03:01:56 UTC

[GitHub] [dubbo] guohao commented on a change in pull request #8497: Fixed TLS using scheme HTTP when using TRI protocol

guohao commented on a change in pull request #8497:
URL: https://github.com/apache/dubbo/pull/8497#discussion_r689212149



##########
File path: dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleClientHandler.java
##########
@@ -82,6 +82,8 @@ private void writeRequest(ChannelHandlerContext ctx, final Request req, final Ch
         } else {
             stream = AbstractClientStream.stream(url);
         }
+        boolean ssl = url.getParameter(CommonConstants.SSL_ENABLED_KEY,false);
+        ctx.channel().attr(TripleConstant.SSL_ATTRIBUTE_KEY).set(ssl);

Review comment:
       Set attr only if  ssl `enabled`

##########
File path: dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ClientTransportObserver.java
##########
@@ -41,6 +41,12 @@
     public ClientTransportObserver(ChannelHandlerContext ctx, AbstractClientStream stream, ChannelPromise promise) {
         this.ctx = ctx;
         this.promise = promise;
+        Boolean ssl = ctx.channel().attr(TripleConstant.SSL_ATTRIBUTE_KEY).get();
+        if (ssl != null && ssl) {
+            SCHEME = AsciiString.of("https");

Review comment:
       `of` will create a new AsciiString instance , try reuse a literal variable.




-- 
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-unsubscribe@dubbo.apache.org

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



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