forked from proxmox-mirrors/proxmox
http: clippy fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
5e630472ec
commit
94d388b988
@ -170,6 +170,7 @@ impl hyper::service::Service<Uri> for HttpsConnector {
|
||||
|
||||
if use_connect {
|
||||
async move {
|
||||
use std::fmt::Write as _;
|
||||
let tcp_stream = connector.call(proxy_uri).await.map_err(|err| {
|
||||
format_err!("error connecting to {} - {}", proxy_authority, err)
|
||||
})?;
|
||||
@ -181,10 +182,13 @@ impl hyper::service::Service<Uri> for HttpsConnector {
|
||||
|
||||
let mut connect_request = format!("CONNECT {0}:{1} HTTP/1.1\r\n", host, port);
|
||||
if let Some(authorization) = authorization {
|
||||
connect_request
|
||||
.push_str(&format!("Proxy-Authorization: {}\r\n", authorization));
|
||||
let _ = write!(
|
||||
connect_request,
|
||||
"Proxy-Authorization: {}\r\n",
|
||||
authorization
|
||||
);
|
||||
}
|
||||
connect_request.push_str(&format!("Host: {0}:{1}\r\n\r\n", host, port));
|
||||
let _ = write!(connect_request, "Host: {0}:{1}\r\n\r\n", host, port);
|
||||
|
||||
tcp_stream.write_all(connect_request.as_bytes()).await?;
|
||||
tcp_stream.flush().await?;
|
||||
|
@ -15,14 +15,16 @@ use super::{RateLimiter, ShareableRateLimit};
|
||||
|
||||
type SharedRateLimit = Arc<dyn ShareableRateLimit>;
|
||||
|
||||
pub type RateLimiterCallback =
|
||||
dyn Fn() -> (Option<SharedRateLimit>, Option<SharedRateLimit>) + Send;
|
||||
|
||||
/// A rate limited stream using [RateLimiter]
|
||||
pub struct RateLimitedStream<S> {
|
||||
read_limiter: Option<SharedRateLimit>,
|
||||
read_delay: Option<Pin<Box<Sleep>>>,
|
||||
write_limiter: Option<SharedRateLimit>,
|
||||
write_delay: Option<Pin<Box<Sleep>>>,
|
||||
update_limiter_cb:
|
||||
Option<Box<dyn Fn() -> (Option<SharedRateLimit>, Option<SharedRateLimit>) + Send>>,
|
||||
update_limiter_cb: Option<Box<RateLimiterCallback>>,
|
||||
last_limiter_update: Instant,
|
||||
stream: S,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user