Skip to content

Commit 7c68096

Browse files
committed
multiverse: allow setting a proxy
This is handy when running mitmproxy on multiverse.
1 parent e12f917 commit 7c68096

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

labs/multiverse/src/main.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ async fn configure_client(server_name: String, config_path: String) -> anyhow::R
792792
let server_name = ServerName::parse(&server_name)?;
793793

794794
let config_path = PathBuf::from(config_path);
795-
let client = Client::builder()
795+
let mut client_builder = Client::builder()
796796
.store_config(
797797
StoreConfig::default()
798798
.crypto_store(
@@ -805,9 +805,13 @@ async fn configure_client(server_name: String, config_path: String) -> anyhow::R
805805
auto_enable_cross_signing: true,
806806
backup_download_strategy: BackupDownloadStrategy::AfterDecryptionFailure,
807807
auto_enable_backups: true,
808-
})
809-
.build()
810-
.await?;
808+
});
809+
810+
if let Ok(proxy_url) = std::env::var("PROXY") {
811+
client_builder = client_builder.proxy(proxy_url).disable_ssl_verification();
812+
}
813+
814+
let client = client_builder.build().await?;
811815

812816
// Try reading a session, otherwise create a new one.
813817
let session_path = config_path.join("session.json");

0 commit comments

Comments
 (0)