Skip to content

Added async_client #8

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakobbraun
Copy link

Hi,

thanks for your great work creating this library!

With this PR I added an async client for being also able to query RPC methods from async code. I refactored the existing sync client to use the async_client while keeping it's API unchanged. By that there's no duplication but existing users don't have to change their code.

Merging this PR has the following benefits for users of this lib:

  • Async queries are possible
  • The PR replaces the quite old hyper 0.10.15 by version 1.6.0. By that the lib can now be used in projects that use latest hyper.

Thank you in advance for your time to check this PR!

rursprung added a commit to rursprung/xml-rpc-rs that referenced this pull request Apr 3, 2025
`hyper` v0.10 is extremely outdated, the current release is v1.6. this
old version pulls in vulnerable dependencies (incl. `hyper` v0.10
itself).

rather than upgrading to `hyper` v1.6 i opted to replace it with
`reqwest` since this crate here is not `async` and `hyper` v1 is
completely `async`. due to the very limited amount of features needed
from `hyper` (just executing HTTP POST requests) it can instead be
replaced with the much simpler `reqwest` crate. while it hasn't hit v1.0
yet it is very widely used (nearly 200 million downloads on crates.io).

this is a breaking change for consumers since the URLs can now just be
passed as strings rather than having to call `.parse()?` on the string.

note that this is similar to, but not the same as, adnanademovic#8.

fixes adnanademovic#9
@rursprung
Copy link

see #11 where i'm doing something very similar.
i don't think that providing a blocking and async API at the same time is worth it for a small crate like this, so i'd propose that @adnanademovic decides whether he wants to have an async API and if so just completely moves to that instead (see my comment on my PR about that).

@rursprung rursprung mentioned this pull request Apr 3, 2025
rursprung added a commit to rursprung/xml-rpc-rs that referenced this pull request May 15, 2025
`hyper` v0.10 is extremely outdated, the current release is v1.6. this
old version pulls in vulnerable dependencies (incl. `hyper` v0.10
itself).

rather than upgrading to `hyper` v1.6 i opted to replace it with
`reqwest` since this crate here is not `async` and `hyper` v1 is
completely `async`. due to the very limited amount of features needed
from `hyper` (just executing HTTP POST requests) it can instead be
replaced with the much simpler `reqwest` crate. while it hasn't hit v1.0
yet it is very widely used (nearly 200 million downloads on crates.io).

this is a breaking change for consumers since the URLs can now just be
passed as strings rather than having to call `.parse()?` on the string.

note that this is similar to, but not the same as, adnanademovic#8.

fixes adnanademovic#9
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

Successfully merging this pull request may close these issues.

2 participants