Revert "http/https proxy (#7600)" (#7801)

This reverts commit da57fcb641.
This commit is contained in:
RustDesk
2024-04-23 15:26:16 +08:00
committed by GitHub
parent da57fcb641
commit ac7f8a6447
68 changed files with 133 additions and 1231 deletions

View File

@@ -4,7 +4,7 @@ use hbb_common::{
allow_err,
bytes::Bytes,
config::{
self, Config, LocalConfig, PeerConfig, CONNECT_TIMEOUT, RENDEZVOUS_PORT,
self, Config, LocalConfig, PeerConfig, CONNECT_TIMEOUT, HARD_SETTINGS, RENDEZVOUS_PORT,
},
directories_next,
futures::future::join_all,
@@ -65,7 +65,6 @@ lazy_static::lazy_static! {
id: "".to_owned(),
}));
static ref ASYNC_JOB_STATUS : Arc<Mutex<String>> = Default::default();
static ref ASYNC_HTTP_STATUS : Arc<Mutex<HashMap<String, String>>> = Arc::new(Mutex::new(HashMap::new()));
static ref TEMPORARY_PASSWD : Arc<Mutex<String>> = Arc::new(Mutex::new("".to_owned()));
}
@@ -422,16 +421,6 @@ pub fn set_socks(proxy: String, username: String, password: String) {
.ok();
}
#[inline]
pub fn get_proxy_status() -> bool {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
return ipc::get_proxy_status();
// Currently, only the desktop version has proxy settings.
#[cfg(any(target_os = "android", target_os = "ios"))]
return false;
}
#[cfg(any(target_os = "android", target_os = "ios"))]
pub fn set_socks(_: String, _: String, _: String) {}
@@ -719,28 +708,6 @@ pub fn change_id(id: String) {
});
}
#[inline]
pub fn http_request(url: String, method: String, body: Option<String>, header: String) {
// Respond to concurrent requests for resources
let current_request = ASYNC_HTTP_STATUS.clone();
current_request.lock().unwrap().insert(url.clone()," ".to_owned());
std::thread::spawn(move || {
let res = match crate::http_request_sync(url.clone(), method, body, header) {
Err(err) => { log::error!("{}", err); err.to_string() },
Ok(text) => text,
};
current_request.lock().unwrap().insert(url,res);
});
}
#[inline]
pub fn get_async_http_status(url: String) -> Option<String> {
match ASYNC_HTTP_STATUS.lock().unwrap().get(&url) {
None => {None}
Some(_str) => {Some(_str.to_string())}
}
}
#[inline]
pub fn post_request(url: String, body: String, header: String) {
*ASYNC_JOB_STATUS.lock().unwrap() = " ".to_owned();