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

Allow default port in clients #1048

Closed
skunert opened this issue Mar 17, 2023 · 1 comment · Fixed by #1172
Closed

Allow default port in clients #1048

skunert opened this issue Mar 17, 2023 · 1 comment · Fixed by #1172
Labels
enhancement New feature or request

Comments

@skunert
Copy link

skunert commented Mar 17, 2023

Currently users have to pass a impl AsRef<str> to the client builder that includes a port.

I know there have been other issues (#554, paritytech/subxt#644) about this, and it is marked as blocked on hyperium/http#509. But I would still like to advocate once more for jsonrpsee handling of a default port when passing a URL to it.

As a library user, I expect that I could pass a valid URL to jsonrpsee. The URL standard says that the port should be omitted if it is the default port. This is also what users expect.

The problem is further amplified by rust url and http crates. If an application takes user input and parses it to an url::Url, the default port gets lost, and there is no nice way to force the crate to add it back when converting to string. http::Uri does not remove the default port, but is not able to provide the default port for different schemes (Url has at least port_or_known_default) if none was provided. As result, every application that takes a user-provided URL and passes it on to jsonrpsee needs to fiddle with the ports.

Ideas:

@niklasad1
Copy link
Member

Fair enough, I don't expect that issue to resolved any time soon so better provide some solution around it

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

Successfully merging a pull request may close this issue.

2 participants