alibaba / jetcache

JetCache is a Java cache framework.
Apache License 2.0
5.03k stars 1.05k forks source link

Lettuce下redis密码中带@符号时URI java.net.UnknownHostException #810

Open fifthangel opened 1 year ago

fifthangel commented 1 year ago

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 两种连接方式 能力?

areyouok commented 1 year ago

看描述我只大概知道是什么意思,这个还是自己想办法吧

areyouok commented 1 year ago

我理解是没有做转义吧