apache / apache/dubbo

Provider export tri protocol with declare context-path, consumer got a "Bad path format xxx" exception

Open
#11,059 9 comments 0 reactions 1 assignee Claimed by @twz007 View on GitHub
type/enhancement
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

- [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.

### Environment

* Dubbo version: 3.1.1
* Operating System version: win10
* Java version: 1.8

### Steps to reproduce this issue

1. 提供者声明 `dubbo.protocols.tri.contextpath: ${spring.application.name}`
2. 消费者以tri协议调用 `@DubboReference(protocol = "tri")`
3. 消费者收到报错 `org.apache.dubbo.rpc.StatusRpcException: UNIMPLEMENTED : Bad path format:/context-path/com.a.b/c`

定位报错代码处:`org.apache.dubbo.rpc.protocol.tri.stream.TripleServerStream.ServerTransportObserver#processHeader`
```java
// ...... 省略
// path = /context-path/com.a.b/c
String[] parts = path.split("/");
// parts.length = 4 报错
if (parts.length != 3) {
responseErr(TriRpcStatus.UNIMPLEMENTED.withDescription("Bad path format:" + path));
return;
}
// ...... 省略

```
上述代码限制了长度一定为3,实际可能为4

Pls. provide [GitHub address] to reproduce this issue.

### Expected Behavior
兼容掉声明了context-path的情况

### Actual Behavior
未兼容

If there is an exception, please attach the exception trace:

```
Just put your stack trace here!
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.