mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Enable deprecation warnings and address
This commit is contained in:
parent
8f9bec21d7
commit
98a97588d3
6 changed files with 10 additions and 15 deletions
|
@ -19,7 +19,7 @@ bytes = "1"
|
||||||
ctr = "0.9"
|
ctr = "0.9"
|
||||||
futures-core = "0.3"
|
futures-core = "0.3"
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
hyper = { version = "0.14", features = ["client"] }
|
hyper = { version = "0.14", features = ["client", "backports", "deprecated"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
parking_lot = { version = "0.12", features = ["deadlock_detection"] }
|
parking_lot = { version = "0.12", features = ["deadlock_detection"] }
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
|
|
|
@ -7,7 +7,7 @@ use std::{
|
||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
use futures_util::StreamExt;
|
use futures_util::StreamExt;
|
||||||
use hyper::StatusCode;
|
use hyper::{body::HttpBody, StatusCode};
|
||||||
use tempfile::NamedTempFile;
|
use tempfile::NamedTempFile;
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ async fn receive_data(
|
||||||
}
|
}
|
||||||
|
|
||||||
let body = response.into_body();
|
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,
|
Ok(bytes) => bytes,
|
||||||
Err(e) => break Err(e.into()),
|
Err(e) => break Err(e.into()),
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,7 +26,7 @@ governor = { version = "0.6", default-features = false, features = ["std", "jitt
|
||||||
hmac = "0.12"
|
hmac = "0.12"
|
||||||
httparse = "1.7"
|
httparse = "1.7"
|
||||||
http = "0.2"
|
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-proxy = { version = "0.9", default-features = false, features = ["rustls"] }
|
||||||
hyper-rustls = { version = "0.24", features = ["http2"] }
|
hyper-rustls = { version = "0.24", features = ["http2"] }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
|
@ -11,9 +11,7 @@ use governor::{
|
||||||
};
|
};
|
||||||
use http::{header::HeaderValue, Uri};
|
use http::{header::HeaderValue, Uri};
|
||||||
use hyper::{
|
use hyper::{
|
||||||
client::{HttpConnector, ResponseFuture},
|
body::HttpBody, client::{HttpConnector, ResponseFuture}, header::USER_AGENT, Body, Client, HeaderMap, Request, Response, StatusCode
|
||||||
header::USER_AGENT,
|
|
||||||
Body, Client, HeaderMap, Request, Response, StatusCode,
|
|
||||||
};
|
};
|
||||||
use hyper_proxy::{Intercept, Proxy, ProxyConnector};
|
use hyper_proxy::{Intercept, Proxy, ProxyConnector};
|
||||||
use hyper_rustls::{HttpsConnector, HttpsConnectorBuilder};
|
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
|
// 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.
|
// ourselves, as any `Request` is moved in the loop.
|
||||||
let (parts, body) = req.into_parts();
|
let (parts, body) = req.into_parts();
|
||||||
let body_as_bytes = hyper::body::to_bytes(body)
|
let body_as_bytes = body.collect().await.map(|b| b.to_bytes()).unwrap_or_default();
|
||||||
.await
|
|
||||||
.unwrap_or_else(|_| Bytes::new());
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let mut req = Request::builder()
|
let mut req = Request::builder()
|
||||||
|
@ -218,7 +214,7 @@ impl HttpClient {
|
||||||
|
|
||||||
pub async fn request_body(&self, req: Request<Body>) -> Result<Bytes, Error> {
|
pub async fn request_body(&self, req: Request<Body>) -> Result<Bytes, Error> {
|
||||||
let response = self.request(req).await?;
|
let response = self.request(req).await?;
|
||||||
Ok(hyper::body::to_bytes(response.into_body()).await?)
|
Ok(response.into_body().collect().await?.to_bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn request_stream(&self, req: Request<Body>) -> Result<IntoStream<ResponseFuture>, Error> {
|
pub fn request_stream(&self, req: Request<Body>) -> Result<IntoStream<ResponseFuture>, Error> {
|
||||||
|
|
|
@ -18,7 +18,7 @@ form_urlencoded = "1.0"
|
||||||
futures-core = "0.3"
|
futures-core = "0.3"
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
hmac = "0.12"
|
hmac = "0.12"
|
||||||
hyper = { version = "0.14", features = ["http1", "server", "tcp"] }
|
hyper = { version = "0.14", features = ["http1", "server", "tcp", "backports", "deprecated"] }
|
||||||
libmdns = "0.8"
|
libmdns = "0.8"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
|
|
|
@ -15,8 +15,7 @@ use futures_core::Stream;
|
||||||
use futures_util::{FutureExt, TryFutureExt};
|
use futures_util::{FutureExt, TryFutureExt};
|
||||||
use hmac::{Hmac, Mac};
|
use hmac::{Hmac, Mac};
|
||||||
use hyper::{
|
use hyper::{
|
||||||
service::{make_service_fn, service_fn},
|
body::HttpBody, service::{make_service_fn, service_fn}, Body, Method, Request, Response, StatusCode
|
||||||
Body, Method, Request, Response, StatusCode,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use log::{debug, error, warn};
|
use log::{debug, error, warn};
|
||||||
|
@ -219,7 +218,7 @@ impl RequestHandler {
|
||||||
debug!("{:?} {:?} {:?}", parts.method, parts.uri.path(), params);
|
debug!("{:?} {:?} {:?}", parts.method, parts.uri.path(), params);
|
||||||
}
|
}
|
||||||
|
|
||||||
let body = hyper::body::to_bytes(body).await?;
|
let body = body.collect().await?.to_bytes();
|
||||||
|
|
||||||
params.extend(form_urlencoded::parse(&body));
|
params.extend(form_urlencoded::parse(&body));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue