diff options
author | metamuffin <metamuffin@disroot.org> | 2023-08-28 14:52:24 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-08-28 14:52:24 +0200 |
commit | 2bc557bbddb01b535dd8512fe3aadb0d4091a42d (patch) | |
tree | ab376b39df3ef1719c77842f4caf4583e48dfcb6 /src/proxy.rs | |
parent | 951c4e90b573f3d14a137bade0853fb3f0f21a5d (diff) | |
download | gnix-2bc557bbddb01b535dd8512fe3aadb0d4091a42d.tar gnix-2bc557bbddb01b535dd8512fe3aadb0d4091a42d.tar.bz2 gnix-2bc557bbddb01b535dd8512fe3aadb0d4091a42d.tar.zst |
update all deps, including a new horrible version hyper
Diffstat (limited to 'src/proxy.rs')
-rw-r--r-- | src/proxy.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/proxy.rs b/src/proxy.rs index 7070500..10d7e3d 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -1,4 +1,4 @@ -use crate::{ServiceError, State}; +use crate::{helper::TokioIo, ServiceError, State}; use http_body_util::{combinators::BoxBody, BodyExt}; use hyper::{ body::Incoming, @@ -51,9 +51,11 @@ pub async fn proxy_request( if let Some(_limit_guard) = state.l_outgoing.obtain() { debug!("\tforwarding to {}", backend); let mut resp = { - let client_stream = TcpStream::connect(backend) - .await - .map_err(|_| ServiceError::CantConnect)?; + let client_stream = TokioIo( + TcpStream::connect(backend) + .await + .map_err(|_| ServiceError::CantConnect)?, + ); let (mut sender, conn) = hyper::client::conn::http1::handshake(client_stream) .await @@ -77,11 +79,11 @@ pub async fn proxy_request( on_upgrade_upstream.unwrap().await, on_upgrade_downstream.unwrap().await, ) { - (Ok(mut upgraded_upstream), Ok(mut upgraded_downstream)) => { + (Ok(upgraded_upstream), Ok(upgraded_downstream)) => { debug!("upgrade successful"); match tokio::io::copy_bidirectional( - &mut upgraded_downstream, - &mut upgraded_upstream, + &mut TokioIo(upgraded_downstream), + &mut TokioIo(upgraded_upstream), ) .await { |