diff --git a/Cargo.toml b/Cargo.toml index c2a9df3..e7edc93 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ udpgw = [] [dependencies] async-trait = "0.1" -base64 = { version = "0.22" } +base64easy = "0.1" chrono = "0.4" clap = { version = "4", features = ["derive", "wrap_help", "color"] } ctrlc2 = { version = "3", features = ["tokio", "termination"] } diff --git a/src/http.rs b/src/http.rs index 6c5f0d6..0b6adf5 100644 --- a/src/http.rs +++ b/src/http.rs @@ -4,7 +4,6 @@ use crate::{ proxy_handler::{ProxyHandler, ProxyHandlerManager}, session_info::{IpProtocol, SessionInfo}, }; -use base64::Engine; use httparse::Response; use socks5_impl::protocol::UserKey; use std::{ @@ -141,8 +140,7 @@ impl HttpConnection { .extend(format!("{}: {}\r\n", PROXY_AUTHORIZATION, response.to_header_string()).as_bytes()); } AuthenticationScheme::Basic => { - let cred = format!("{}:{}", credentials.username, credentials.password); - let auth_b64 = base64::engine::general_purpose::STANDARD.encode(cred); + let auth_b64 = base64easy::encode(credentials.to_string(), base64easy::EngineKind::Standard); self.server_outbuf .extend(format!("{}: Basic {}\r\n", PROXY_AUTHORIZATION, auth_b64).as_bytes()); }