diff --git a/audio/Cargo.toml b/audio/Cargo.toml index 94b900c7..2740616c 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -19,7 +19,7 @@ bytes = "1" ctr = "0.9" futures-core = "0.3" futures-util = "0.3" -hyper = { version = "0.14", features = ["client"] } +hyper = { version = "0.14", features = ["client", "backports", "deprecated"] } log = "0.4" parking_lot = { version = "0.12", features = ["deadlock_detection"] } tempfile = "3" diff --git a/audio/src/fetch/receive.rs b/audio/src/fetch/receive.rs index 0b001113..c5e2456c 100644 --- a/audio/src/fetch/receive.rs +++ b/audio/src/fetch/receive.rs @@ -7,7 +7,7 @@ use std::{ use bytes::Bytes; use futures_util::StreamExt; -use hyper::StatusCode; +use hyper::{body::HttpBody, StatusCode}; use tempfile::NamedTempFile; use tokio::sync::{mpsc, oneshot}; @@ -97,7 +97,7 @@ async fn receive_data( } let body = response.into_body(); - let data = match hyper::body::to_bytes(body).await { + let data = match body.collect().await.map(|b| b.to_bytes()) { Ok(bytes) => bytes, Err(e) => break Err(e.into()), }; diff --git a/core/Cargo.toml b/core/Cargo.toml index 2f515480..e6e45f94 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -26,7 +26,7 @@ governor = { version = "0.6", default-features = false, features = ["std", "jitt hmac = "0.12" httparse = "1.7" http = "0.2" -hyper = { version = "0.14", features = ["client", "http1", "http2", "tcp"] } +hyper = { version = "0.14", features = ["client", "http1", "http2", "tcp", "backports", "deprecated"] } hyper-proxy = { version = "0.9", default-features = false, features = ["rustls"] } hyper-rustls = { version = "0.24", features = ["http2"] } log = "0.4" diff --git a/core/src/http_client.rs b/core/src/http_client.rs index 14efdcdf..aec65d4d 100644 --- a/core/src/http_client.rs +++ b/core/src/http_client.rs @@ -11,9 +11,7 @@ use governor::{ }; use http::{header::HeaderValue, Uri}; use hyper::{ - client::{HttpConnector, ResponseFuture}, - header::USER_AGENT, - Body, Client, HeaderMap, Request, Response, StatusCode, + body::HttpBody, client::{HttpConnector, ResponseFuture}, header::USER_AGENT, Body, Client, HeaderMap, Request, Response, StatusCode }; use hyper_proxy::{Intercept, Proxy, ProxyConnector}; use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder}; @@ -178,9 +176,7 @@ impl HttpClient { // As correct as that may be technically, we now need all this boilerplate to clone it // ourselves, as any `Request` is moved in the loop. let (parts, body) = req.into_parts(); - let body_as_bytes = hyper::body::to_bytes(body) - .await - .unwrap_or_else(|_| Bytes::new()); + let body_as_bytes = body.collect().await.map(|b| b.to_bytes()).unwrap_or_default(); loop { let mut req = Request::builder() @@ -218,7 +214,7 @@ impl HttpClient { pub async fn request_body(&self, req: Request
) -> Result