fix: unforwarded request
This commit is contained in:
parent
312ba329e5
commit
c5e30d916d
@ -123,7 +123,7 @@ impl Agent {
|
|||||||
|
|
||||||
if self.check_request_blocked(&request.path) {
|
if self.check_request_blocked(&request.path) {
|
||||||
log::info!("CLIENT --> PROXY --> {host}");
|
log::info!("CLIENT --> PROXY --> {host}");
|
||||||
let mut outbound = self.io(self.builder.connect(&host))?;
|
let mut outbound = self.io(self.builder.connect(host))?;
|
||||||
|
|
||||||
// forward intercepted request
|
// forward intercepted request
|
||||||
outbound.write_all(request.as_bytes()).await?;
|
outbound.write_all(request.as_bytes()).await?;
|
||||||
@ -134,7 +134,7 @@ impl Agent {
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let target = self.io(TcpStream::connect(host))?;
|
let mut target = self.io(TcpStream::connect(host))?;
|
||||||
log::info!("CLIENT <-> TARGET (direct)");
|
log::info!("CLIENT <-> TARGET (direct)");
|
||||||
|
|
||||||
if let http::Method::CONNECT = request.method {
|
if let http::Method::CONNECT = request.method {
|
||||||
@ -143,6 +143,11 @@ impl Agent {
|
|||||||
conn.write_all(resp).await?;
|
conn.write_all(resp).await?;
|
||||||
conn.flush().await?;
|
conn.flush().await?;
|
||||||
log::debug!("Received CONNECT (200 OK)");
|
log::debug!("Received CONNECT (200 OK)");
|
||||||
|
} else {
|
||||||
|
// forward intercepted request
|
||||||
|
target.write_all(request.as_bytes()).await?;
|
||||||
|
target.flush().await?;
|
||||||
|
log::debug!("CLIENT --> (intercepted) --> TARGET");
|
||||||
}
|
}
|
||||||
|
|
||||||
self.tunnel(conn, target).await?;
|
self.tunnel(conn, target).await?;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user