http-rs / surf

Fast and friendly HTTP client framework for async Rust
https://docs.rs/surf
Apache License 2.0
1.45k stars 119 forks source link

Fix a typo in `set_tls_config` h1-client feature check #327

Closed link2xt closed 2 years ago

link2xt commented 2 years ago

Needed for https://github.com/deltachat/deltachat-core-rust/pull/2782

link2xt commented 2 years ago

CI is broken, it tests cargo check --no-default-features --features h1-client,h1-client-rustls

Fishrock123 commented 2 years ago

Looks like this fixes https://github.com/http-rs/surf/issues/326

Fishrock123 commented 2 years ago

The CI needs to be adjusted to not try --features h1-client,h1-client-rustls since those are mutually exclusive ...

link2xt commented 2 years ago

@Fishrock123 I pushed a fix

Fishrock123 commented 2 years ago

Released 2.3.2 https://github.com/http-rs/surf/releases/tag/v2.3.2

mlafeldt commented 2 years ago

Could it be that this change broke the h1-client-rustls client?

I'm getting this error:

error[E0201]: duplicate definitions with name `set_tls_config`:
   --> /Users/mathias/.cargo/registry/src/github.com-1ecc6299db9ec823/surf-2.3.2/src/config.rs:207:5
    |
197 | /     pub fn set_tls_config(
198 | |         mut self,
199 | |         tls_config: Option<std::sync::Arc<rustls_crate::ClientConfig>>,
200 | |     ) -> Self {
201 | |         self.http_config.tls_config = tls_config;
202 | |         self
203 | |     }
    | |_____- previous definition of `set_tls_config` here
...
207 | /     pub fn set_tls_config(
208 | |         mut self,
209 | |         tls_config: Option<std::sync::Arc<async_native_tls::TlsConnector>>,
210 | |     ) -> Self {
211 | |         self.http_config.tls_config = tls_config;
212 | |         self
213 | |     }
    | |_____^ duplicate definition

With this Cargo.toml:

[target.'cfg(target_arch = "wasm32")'.dependencies]
surf = { version = "2", default-features = false, features = ["wasm-client"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
surf = { version = "2", default-features = false, features = ["h1-client-rustls"] }

Pinning the previous release fixes compilation:

[target.'cfg(target_arch = "wasm32")'.dependencies]
surf = { version = "=2.3.1", default-features = false, features = ["wasm-client"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
surf = { version = "=2.3.1", default-features = false, features = ["h1-client-rustls"] }
Fishrock123 commented 2 years ago

Unlikely in of itself but it may need extra cfg checking in this area to prevent overlap in that case. feel free to send such a pr.

mlafeldt commented 2 years ago

Might have been fixed by https://github.com/http-rs/surf/commit/e60727afe1661878ad68462632cff6d05aa106b3