Skip to content

Commit

Permalink
g3proxy: send ppv2 header for http connection in divert_tcp escaper
Browse files Browse the repository at this point in the history
  • Loading branch information
zh-jq committed Oct 25, 2024
1 parent ab19798 commit 32c069f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions g3proxy/src/escape/divert_tcp/http_forward/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@

use std::sync::Arc;

use g3_io_ext::{AsyncStream, LimitedBufReader, LimitedWriter, NilLimitedReaderStats};
use g3_io_ext::{
AsyncStream, LimitedBufReader, LimitedWriter, LimitedWriterStats, NilLimitedReaderStats,
};
use g3_types::net::{Host, OpensslClientConfig};

use super::{DivertTcpEscaper, DivertTcpEscaperStats};
Expand All @@ -38,7 +40,12 @@ impl DivertTcpEscaper {
) -> Result<BoxHttpForwardConnection, TcpConnectError> {
let stream = self.tcp_connect_to(tcp_notes, task_notes).await?;

let (ups_r, ups_w) = stream.into_split();
let (ups_r, mut ups_w) = stream.into_split();

let nw = self
.send_pp2_header(&mut ups_w, tcp_notes, task_notes, None)
.await?;
self.stats.add_write_bytes(nw);

let mut w_wrapper_stats = HttpForwardRemoteWrapperStats::new(&self.stats, &task_stats);
let mut r_wrapper_stats = HttpForwardTaskRemoteWrapperStats::new(task_stats);
Expand Down

0 comments on commit 32c069f

Please sign in to comment.