Rewrite client and server using reqwest and axum #1429
Merged
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.
Pull Request
This PR is to upgrade the network module to hyper 1.1.0.
As mentioned in #1421, hyper 1.1.0 has had many breaking changes. The
Client
struct no longer exists, and requests are now made by aSendRequest
which has a different implementation for HTTP1 and HTTP2. However, this is quite low-level for our needs. Initialization of aSendRequest
object also requires a handshake which causes issues like initialization becoming async, resulting in having to makefn default()
and other such methods async. Also, some exchanges only support HTTP1, but the HTTP1 SendRequest struct is not cloneable at the moment.For now, reqwest provides a very similar Client object, with roughly the same functionality. It is also cloneable. Another option is moving to the legacy Client in the
hyper-util
crate. However, reqwest seems to do the job for now, and we can stay with it until there are some more changes tohyper
that make it easier to implement for our needs.