Comments (12)
I donβt think anything would change other than the removal of the intermediate crate.
from http-client.
Dependency doesn't seem to be optional https://github.com/http-rs/surf/blob/main/Cargo.toml#L67 or maybe I misunderstood something. I'm not that experienced in Rust π
from http-client.
How would this be solved if http-client
was merged into Surf
? You would need to create a separate surf crates for each HTTP backend no? surf-hyper
, surf-curl
to solve feature flag situation. Unfortunately feature flags in Cargo aren't solved in very elegant way. I try to avoid using them whenever I can. If you could remove a direct dependency on async-std
in Surf
then I guess it would be a fine alternative to http-client
traits.
The problem with Rust right now is that the async ecosystem is pretty much an opinionated mess and many api client libraries just choose 1 http client for the job, mostly reqwest
which uses tokio
under the hood.
It doesn't give a lot of freedom with async runtime choice and feature flags is mostly just additional boilerplate code that's hard to maintain. What users of these libraries can do is either move to the supported runtime, write their own library or fork the existing library and replace the runtime or add support to another runtime via feature flags.
from http-client.
Yeah that makes a lot of sense. Do you have a sketch of what that API would look like? I'm still interested in eventually implementing a win32-native HTTP client backend. Getting a sense of what that would look like under this model would be nice.
from http-client.
Does that mean surf will replace http-client? I'm kind of confused right now.
from http-client.
Yes
from http-client.
Oh but Surf only supports async-std. I think that defeats the purpose of http-client crate.
from http-client.
You can still run surf with the hyper backend...?
from http-client.
Do you actually use http-client
for something that is not Surf and if so, what is it?
from http-client.
I planned to use it as an abstraction for API client libraries to avoid coupling them to specific async runtime and HTTP client.
from http-client.
Then you will need to help me maintain http-client
. As I said, the feature flag situation with Surf is quite poor right now, and development is just overcomplicated by having this be a separate library.
surf with an http-client-only
feature would probably be better or something
from http-client.
Upcoming Rust 2021 edition will also solve some of feature flags hell. If I am not mistaken resolver 2 can be explicitly used from older versions of rust.
from http-client.
Related Issues (20)
- IsahcClient created without Config ignores the timeout setting.
- The IsahcClient timeout setting is not a connection timeout HOT 1
- HttpsClient::send crashes for IsahcClient
- Dependencies update HOT 2
- impl `HttpClient` also for `Arc<H: HttpClient>` and `Rc<H: HttpClient>`?
- Use send_wrapper for WASM instead of InnerFuture HOT 2
- HttpClient instances should be Clone HOT 1
- Reorganize feature flags to separate out different tls implementations HOT 1
- Incomplete response body using curl-client HOT 1
- Make "fetch" module public HOT 1
- Customizing h1_client e.g. ClientConfig HOT 5
- h1_client: Windows Error 10053 'WSAECONNABORTED'
- Hyper 0.14 support HOT 2
- h1-client: "Connection closed" error when re-using the H1Client for a 2nd request HOT 7
- h1 client fails to resolve localhost HOT 6
- open design question: some mechanism for handling upgrades HOT 4
- Only pull in the dashmap dep for h1_client
- fix api docs for unstable-config HOT 1
- Stabilize Config
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http-client.