-
Notifications
You must be signed in to change notification settings - Fork 18
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
implement optional async support #150
Open
wfraser
wants to merge
28
commits into
dropbox:master
Choose a base branch
from
wfraser:async-mode
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
This creates async HTTP client traits which mirror the existing sync ones. It also reimplements sync in terms of async, since we can use now_or_never as an escape hatch to get back to sync land, but the reverse is not possible. One ugly wart is that there's no good escape hatch to convert the sync-reader-in-async-wrapper response body back to a sync reader other than an unsafe pointer cast. No async routes generated yet; that's coming next.
…use the async ones instead
… on, for compatibility
this helps users who have no-default-features but also default_client; they want all the routes in the old places
…penssl and native-tls which we don't use
Then this can be used by the oauth2 code to provide better responses when tokens are bogus
…auth access tokens
We're using HTTP2 where it's just a repeat of the code number anyway, so it adds no value.
not just 2.0.0; the signature of ureq::Response::into_reader() was changed in 2.5.0
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.
The new features controlling this are
async_routes
which enables compiling the async functions, and anddefault_async_client
which enables a default HTTP client based on reqwest.For most current use cases this should be a seamless transition, as I've made great pains to ensure that types are in the same locations unless you use the new features.
However if users have implemented a custom HTTP client, they will need to rework it a lot, as the HTTP client traits have been completely rewritten and are very different. That said, the new trait moves more things to the helper code, so implementing a custom client should be easier now.
This change violates our MSRV policy by quite a lot (requiring rust 1.75.0 which is only ~4 months old instead of the desired 12) so I'm proposing to land this as a beta release for now.
Checklist
General Contributing
RELEASE_NOTES.md
file, or believe it's not necessary for this change.Validation
A copy of the
demo
example has been made (calleddemo-async
) which uses the default async client, which acts as a decent integration test.