This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -17,7 +17,10 @@ struct Args {
|
|||||||
#[arg(short, long, env, default_value = "x-target-host")]
|
#[arg(short, long, env, default_value = "x-target-host")]
|
||||||
target_host_port_header: String,
|
target_host_port_header: String,
|
||||||
|
|
||||||
/// Name of optional header that contains path to add to the request
|
/// Name of optional header that contains path to add to the request.
|
||||||
|
///
|
||||||
|
/// If this value is defined, all clients packets are inspected in research for path to
|
||||||
|
/// manipulate
|
||||||
#[arg(short, long, env)]
|
#[arg(short, long, env)]
|
||||||
path_prefix_header: Option<String>,
|
path_prefix_header: Option<String>,
|
||||||
}
|
}
|
||||||
@@ -125,6 +128,14 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In case of connection reuse, we need to reanalyze data
|
||||||
|
if ARGS.path_prefix_header.is_some() &&
|
||||||
|
let Ok(Some(res))= process_headers(&buf_client[..count])
|
||||||
|
&& let Err(e) = upstream.write_all(&res.buff).await {
|
||||||
|
log::error!("[{conn_id}] Failed to write to upstream! {e}");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if let Err(e)=upstream.write_all(&buf_client[..count]).await {
|
if let Err(e)=upstream.write_all(&buf_client[..count]).await {
|
||||||
log::error!("[{conn_id}] Failed to write to upstream! {e}");
|
log::error!("[{conn_id}] Failed to write to upstream! {e}");
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user