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

[Issue] nacos-client : ServerHttpAgent builds the unnormalized URL #2560

Closed
mercyblitz opened this issue Mar 31, 2020 · 0 comments
Closed

[Issue] nacos-client : ServerHttpAgent builds the unnormalized URL #2560

mercyblitz opened this issue Mar 31, 2020 · 0 comments
Assignees
Labels
kind/enhancement Category issues or prs related to enhancement.

Comments

@mercyblitz
Copy link
Member

nacos-client: 1.2.1

The method ServerHttpAgent#getUrl(String,String) builds an HTTP URL when nacos-client sends a request to nacos server, however the generated URL is unnormalized if the return value of ServerListManager#getContentPath() includes mupltile slashes ("/") :

    private String getUrl(String serverAddr, String relativePath) {
        String contextPath = serverListMgr.getContentPath().startsWith("/") ?
                serverListMgr.getContentPath() : "/" + serverListMgr.getContentPath();
        return serverAddr + contextPath + relativePath;
    }

Assuming that the arguments:

  • serverAddr is "http://127.0.0.1:8080"
  • serverListMgr.getContentPath() is "//"
  • relativePath is "/v1/cs/configs"

The above method will result in "http://127.0.0.1:8848//nacos/v1/cs/configs", it's the unnormalized URL.

@chuntaojun chuntaojun self-assigned this Apr 1, 2020
@chuntaojun chuntaojun added the kind/enhancement Category issues or prs related to enhancement. label Apr 1, 2020
@chuntaojun chuntaojun mentioned this issue Apr 1, 2020
5 tasks
@yanlinly yanlinly mentioned this issue May 15, 2020
5 tasks
@yanlinly yanlinly mentioned this issue Jun 5, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

No branches or pull requests

2 participants