Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fifthangel opened this issue Aug 30, 2023 · 2 comments
Open

Comments

@fifthangel
Copy link

fifthangel commented Aug 30, 2023

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
Copy link
Collaborator

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

@areyouok
Copy link
Collaborator

areyouok commented Sep 1, 2023

我理解是没有做转义吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants