fix(proxy): url decode password of http proxy

This commit is contained in:
Σrebe - Romain GERARD 2023-11-09 17:18:38 +01:00
parent b55ddd5947
commit 91d1215d5b
No known key found for this signature in database
GPG key ID: 7A42B4B97E0332F4
4 changed files with 13 additions and 1 deletions

View file

@ -112,6 +112,8 @@ pub async fn connect_with_http_proxy(
info!("Connected to http proxy {}:{}", proxy_host, proxy_port);
let authorization = if let Some((user, password)) = proxy.password().map(|p| (proxy.username(), p)) {
let password =
urlencoding::decode(password).with_context(|| format!("Cannot urldecode proxy password: {}", password))?;
let creds = base64::engine::general_purpose::STANDARD.encode(format!("{}:{}", user, password));
format!("Proxy-Authorization: Basic {}\r\n", creds)
} else {

View file

@ -102,7 +102,9 @@ where
// Forward local tx to websocket tx
let ping_frequency = client_cfg.websocket_ping_frequency;
tokio::spawn(super::io::propagate_read(local_rx, ws_tx, close_tx, Some(ping_frequency)).instrument(Span::current()));
tokio::spawn(
super::io::propagate_read(local_rx, ws_tx, close_tx, Some(ping_frequency)).instrument(Span::current()),
);
// Forward websocket rx to local rx
let _ = super::io::propagate_write(local_tx, ws_rx, close_rx).await;