You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "iJIAJIA (via GitHub)" <gi...@apache.org> on 2023/08/29 12:27:05 UTC

[GitHub] [dubbo] iJIAJIA opened a new issue, #12977: WireProtocol Wrappable

iJIAJIA opened a new issue, #12977:
URL: https://github.com/apache/dubbo/issues/12977

   <!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy -->
   
   - [x ] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
   - [x ] I have searched the [release notes](https://github.com/apache/dubbo/releases) of this repository and believe that this is not a duplicate.
   
   ## Describe the feature
   <!-- Please also discuss possible business value -->
   代码原因导致WireProtocl 无法被Wrapper机制封装.
   
   ### 背景
   应用与应用之间有权限拦截的诉求, 身份认证这块采用了mTLS认证. 应用身份通过tls证书获取, 因此需要将TLS上下文里的身份信息传递到Protocol层. 目前对于Triple协议, 找到了WireProtocol作为切入点, 使用Wrapper机制覆写ChannelHandler配置逻辑. 
   ```java
   @Wrapper(mismatches = {"qos"})
   public class WireProtocolWrapper implements WireProtocol {
   
   }
   ```
   项目测试时 发现此方法会导致NPE. 原因如下:
   ### 影响代码块
   ```java
   @Override
       protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
           throws Exception {
           ....
           if (providerConnectionConfig != null && isSsl(in)) {
               enableSsl(ctx, providerConnectionConfig);
           } else {
               for (final WireProtocol protocol : protocols) {
                   ...
                   switch (result) {
                       case UNRECOGNIZED:
                           continue;
                       case RECOGNIZED:
                          // 这里通过getExtensionName获取protocolName. 由于我对WireProtocol进行了Wrapper, 无法获取正确的protocolName
                           String protocolName = url.getOrDefaultFrameworkModel().getExtensionLoader(WireProtocol.class)
                               .getExtensionName(protocol);
                          // 这里因为protocolName导致ConcurrentHashMap抛出NPE
                          hannelHandler localHandler = this.handlerMapper.getOrDefault(protocolName, handler);
                           ....
                   }
               }
               ....
           }
       }
   ```
   出于扩展性需要, 是不是可以对WireProtocol协议暴露getName方法, 改为WireProtocol#getName 获取ProtocolName.
   
   
   


-- 
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.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


Re: [I] WireProtocol Wrappable [dubbo]

Posted by "paradiseidler (via GitHub)" <gi...@apache.org>.
paradiseidler commented on issue #12977:
URL: https://github.com/apache/dubbo/issues/12977#issuecomment-2469859988

   Has this issue been resolved?


-- 
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


[GitHub] [dubbo] AlbumenJ commented on issue #12977: WireProtocol Wrappable

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #12977:
URL: https://github.com/apache/dubbo/issues/12977#issuecomment-1705874274

   Could u pls submit a PR?


-- 
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


[GitHub] [dubbo] AlbumenJ commented on issue #12977: WireProtocol Wrappable

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #12977:
URL: https://github.com/apache/dubbo/issues/12977#issuecomment-1705874372

   @CrazyHZM @icodening @EarthChen PTAL


-- 
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