Repository navigation
Remove url dependency, add feature flags for WebSocket and TLS support - #1659
Open
torkelrogstad wants to merge 4 commits into
Open
torkelrogstad wants to merge 4 commits into
torkelrogstad wants to merge 4 commits into
Conversation
The HTTP client only used `url` to validate and normalize the target, but it pulls in `idna` and the ICU crates, about 27 crates in total. Parse the target with `http::Uri` instead, which is already available through `hyper`. Normalization is unchanged: scheme and host are lowercased, the default port is omitted, an empty path becomes `/` and the fragment is dropped. Credentials in the userinfo are still moved into a basic `Authorization` header. Unlike `url`, non-ASCII hosts and paths are now rejected rather than punycode/percent-encoded, and dot segments in the path are kept as is. The WebSocket client and transport still depend on `url`, since `Url` is part of their public API.
Add a `ws` feature to `jsonrpsee-server`, enabled by default, which gates the WebSocket transport and with it `soketto` and its SHA-1 and `rand` dependencies. Without it, upgrade requests are handled as plain HTTP requests and `ServerConfigBuilder::ws_only` is unavailable. The ping and subscription settings remain but have no effect. Add an `http-server` feature to `jsonrpsee` for the server without WebSocket support. `server` enables the same as before. Users of `jsonrpsee-server` that already set `default-features = false` now need to enable `ws` explicitly.
The `http-client` feature enables `jsonrpsee-http-client` with its default features, so users of the `jsonrpsee` crate can't opt out of TLS and always build `rustls` and `ring`, even if they only talk plain HTTP. Add an `http-client-no-tls` feature for the HTTP client without TLS, like the existing `client-ws-transport-no-tls`. `http-client` enables the same as before.
0e4ef622
reviewed
Oct 4, 2026
Comment on lines
+571
to
+574
| let client = HttpTransportClientBuilder::new().build("http://user:p%40ss@localhost:9999/path").unwrap(); | ||
| assert_eq!(&client.target, "http://localhost:9999/path"); | ||
| // base64 of "user:p%40ss" | ||
| assert_eq!(client.headers[hyper::header::AUTHORIZATION], "Basic dXNlcjpwJTQwc3M="); |
There was a problem hiding this comment.
It should be base64 of user:p@ss, not user:p%40ss. This an existing issue, see #1639.
Credentials in the URL userinfo were base64-encoded as written, so `http://user:p%40ss@host` sent `user:p%40ss` instead of `user:p@ss` in the `Authorization: Basic` header. Decode them first. Fixes paritytech#1639 for the HTTP client.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation for removing
urlis in the commit message.In total this allows for reducing the dependency graph of this library by quite a lot. For example a regular
http-clientgoes from 103 to 76 members in the dependency graph. Going tohttp-client-no-tlsreduces it further to 58. Removing WebSocket from the server by doinghttp-serverinstead ofserver, we go from 90 to 74.