diff --git a/src/async_impl/client.rs b/src/async_impl/client.rs index a64869582..faed4f6a3 100644 --- a/src/async_impl/client.rs +++ b/src/async_impl/client.rs @@ -468,12 +468,6 @@ impl ClientBuilder { config.quic_receive_window, config.quic_send_window, config.local_address, - #[cfg(any( - target_os = "android", - target_os = "fuchsia", - target_os = "linux" - ))] - config.interface.as_deref(), &config.http_version_pref, )?; } @@ -639,7 +633,14 @@ impl ClientBuilder { } #[cfg(not(feature = "__tls"))] - Connector::new(http, proxies.clone(), config.local_address, config.nodelay) + Connector::new( + http, + proxies.clone(), + config.local_address, + #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] + config.interface.as_deref(), + config.nodelay, + ) }; connector.set_timeout(config.connect_timeout); diff --git a/src/connect.rs b/src/connect.rs index 2aa59b9e3..c9418265d 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -63,12 +63,18 @@ impl Connector { mut http: HttpConnector, proxies: Arc>, local_addr: T, + #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] + interface: Option<&str>, nodelay: bool, ) -> Connector where T: Into>, { http.set_local_address(local_addr.into()); + #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] + if let Some(interface) = interface { + http.set_interface(interface.to_owned()); + } http.set_nodelay(nodelay); Connector {