diff --git a/Cargo.toml b/Cargo.toml index f6f0375..e6290b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ cookies = ["cookie", "cookie_store"] socks-proxy = ["socks"] gzip = ["flate2"] brotli = ["brotli-decompressor"] -http = ["dep:http"] +http-interop = ["dep:http"] [dependencies] base64 = "0.21" diff --git a/src/request.rs b/src/request.rs index c7cb507..f736588 100644 --- a/src/request.rs +++ b/src/request.rs @@ -500,7 +500,7 @@ impl Request { } } -#[cfg(feature = "http")] +#[cfg(feature = "http-interop")] impl From for Request { fn from(value: http::request::Builder) -> Self { let mut new_request = crate::agent().request( @@ -529,7 +529,7 @@ impl From for Request { } } -#[cfg(feature = "http")] +#[cfg(feature = "http-interop")] impl From for http::request::Builder { fn from(value: Request) -> Self { value diff --git a/src/response.rs b/src/response.rs index 3f5f67e..a282902 100644 --- a/src/response.rs +++ b/src/response.rs @@ -28,7 +28,7 @@ use flate2::read::MultiGzDecoder; #[cfg(feature = "brotli")] use brotli_decompressor::Decompressor as BrotliDecoder; -#[cfg(feature = "http")] +#[cfg(feature = "http-interop")] use std::net::{IpAddr, Ipv4Addr}; pub const DEFAULT_CONTENT_TYPE: &str = "text/plain"; @@ -875,7 +875,7 @@ impl Read for ErrorReader { } } -#[cfg(feature = "http")] +#[cfg(feature = "http-interop")] impl + Send + Sync + 'static> From> for Response { fn from(value: http::Response) -> Self { let version_str = format!("{:?}", value.version()); @@ -907,7 +907,7 @@ impl + Send + Sync + 'static> From> for Respons } } -#[cfg(feature = "http")] +#[cfg(feature = "http-interop")] fn create_builder(response: &Response) -> http::response::Builder { let http_version = match response.http_version() { "HTTP/0.9" => http::Version::HTTP_09, @@ -935,14 +935,14 @@ fn create_builder(response: &Response) -> http::response::Builder { response_builder } -#[cfg(feature = "http")] +#[cfg(feature = "http-interop")] impl From for http::Response> { fn from(value: Response) -> Self { create_builder(&value).body(value.into_reader()).unwrap() } } -#[cfg(feature = "http")] +#[cfg(feature = "http-interop")] impl From for http::Response { fn from(value: Response) -> Self { create_builder(&value) @@ -1291,7 +1291,7 @@ mod tests { } #[test] - #[cfg(feature = "http")] + #[cfg(feature = "http-interop")] fn convert_http_response() { use http::{Response, StatusCode, Version}; @@ -1319,7 +1319,7 @@ mod tests { } #[test] - #[cfg(feature = "http")] + #[cfg(feature = "http-interop")] fn convert_http_response_string() { use http::{Response, StatusCode, Version}; @@ -1337,7 +1337,7 @@ mod tests { } #[test] - #[cfg(feature = "http")] + #[cfg(feature = "http-interop")] fn convert_http_response_bad_header() { use http::{Response, StatusCode, Version};