This commit is contained in:
Σrebe - Romain GERARD 2023-12-04 08:50:47 +01:00
parent 32e7cdcb8e
commit 8495870bff
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4
3 changed files with 17 additions and 7 deletions

View file

@ -1,5 +1,6 @@
use ahash::{HashMap, HashMapExt};
use anyhow::anyhow;
use base64::Engine;
use futures_util::{pin_mut, Stream, StreamExt};
use std::cmp::min;
use std::fmt::Debug;
@ -264,9 +265,14 @@ async fn server_upgrade(
.instrument(Span::current()),
);
response
.headers_mut()
.insert(COOKIE, HeaderValue::from_str(&format!("fake://{}:{}", dest, port)).unwrap());
if protocol == LocalProtocol::ReverseSocks5 {
response.headers_mut().insert(
COOKIE,
HeaderValue::from_str(
&base64::engine::general_purpose::STANDARD.encode(format!("fake://{}:{}", dest, port)),
)?,
);
}
Ok(response)
}