mirror of
https://github.com/rustdesk/hbb_common.git
synced 2026-10-23 00:37:59 +00:00
fix: reuse the initial TCP connection for HTTPS proxies
This commit is contained in:
1 parent
4c04a7a130
commit
2d998e7b02
2 files changed
+158
-8
No files matched your search
+7
-8
@@ -428,8 +428,7 @@ impl Proxy {
|
||||
TlsType::NativeTls => {
|
||||
self.https_connect_nativetls_wrap_danger(
|
||||
&url,
|
||||
local,
|
||||
proxy,
|
||||
stream,
|
||||
&target_addr,
|
||||
danger_accept_invalid_cert,
|
||||
)
|
||||
@@ -480,12 +479,10 @@ impl Proxy {
|
||||
async fn https_connect_nativetls_wrap_danger<'a>(
|
||||
&self,
|
||||
url: &str,
|
||||
local: SocketAddr,
|
||||
proxy: SocketAddr,
|
||||
stream: tokio::net::TcpStream,
|
||||
target_addr: &TargetAddr<'a>,
|
||||
danger_accept_invalid_cert: Option<bool>,
|
||||
) -> ResultType<DynTcpStream> {
|
||||
let stream = self.new_stream(local, proxy).await?;
|
||||
let s = super::timeout(
|
||||
self.ms_timeout,
|
||||
self.https_connect_nativetls(
|
||||
@@ -535,7 +532,10 @@ impl Proxy {
|
||||
danger_accept_invalid_cert: Option<bool>,
|
||||
origin_danger_accept_invalid_cert: Option<bool>,
|
||||
) -> ResultType<DynTcpStream> {
|
||||
let stream = stream.unwrap_or(self.new_stream(local, proxy).await?);
|
||||
let stream = match stream {
|
||||
Some(stream) => stream,
|
||||
None => self.new_stream(local, proxy).await?,
|
||||
};
|
||||
match super::timeout(
|
||||
self.ms_timeout,
|
||||
self.https_connect_rustls(
|
||||
@@ -587,8 +587,7 @@ impl Proxy {
|
||||
log::warn!("Falling back to native-tls for HTTPS proxy server.");
|
||||
self.https_connect_nativetls_wrap_danger(
|
||||
&url,
|
||||
local,
|
||||
proxy,
|
||||
self.new_stream(local, proxy).await?,
|
||||
&target_addr,
|
||||
origin_danger_accept_invalid_cert,
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user