Lettuce下redis密码中带@符号时URI java.net.UnknownHostException
- Dominant language
- Java
- Stars
- 5.6k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
RedisLettuceAutoConfiguration initCache 方法中,List uriList = map.values().stream().map((k) -> RedisURI.create(URI.create(k.toString()))) .collect(Collectors.toList());
io.lettuce.core.RedisURI.create下默认截取URI中第一个@符号前的字符做为登录密码,并非取最后一个@符号前做为密码。
```
String userInfo = uri.getUserInfo();
if (isEmpty(userInfo) && isNotEmpty(uri.getAuthority()) && uri.getAuthority().indexOf('@') > 0) {
userInfo = uri.getAuthority().substring(0, uri.getAuthority().indexOf('@'));
}
```
导致 io.lettuce.core.RedisConnectionException: Unable to connect to xxx@host:port 异常。
是否可提供 host + port +password 与 URI 两种连接方式 能力?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in RedisLettuceAutoConfiguration.initCache, focusing on the stream that converts configuration values with RedisURI.create(URI.create(k.toString())). Reproduce a Redis URI whose password contains @ and inspect the resulting connection error. Done means the configuration handles that password correctly and clarifies whether host, port, and password inputs are supported alongside URI input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100