From 7546cb3cd6f2ee29bfbef809127c6ae1023187de Mon Sep 17 00:00:00 2001 From: Josh Watson Date: Fri, 31 May 2024 12:36:25 -0700 Subject: [PATCH] Add new setting to skip HEAD requests for localhost servers --- rust/examples/pdb-ng/src/lib.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/rust/examples/pdb-ng/src/lib.rs b/rust/examples/pdb-ng/src/lib.rs index 3fdea60fb..7e33737f1 100644 --- a/rust/examples/pdb-ng/src/lib.rs +++ b/rust/examples/pdb-ng/src/lib.rs @@ -252,6 +252,14 @@ fn sym_store_exists(path: &String) -> Result { if !Settings::new("").get_bool("network.pdbAutoDownload", None, None) { return Err(anyhow!("Auto download disabled")); } + + // If the user doesn't want to check the network path + // (in the case of using a symbol server proxy that doesn't accept HEAD requests), + // just assume the path exists and return true. + if path.contains("localhost:") && Settings::new("").get_bool("network.pdbSkipNetworkPathCheck", None, None) { + return Ok(true); + } + info!("HEAD: {}", path); // Download from remote @@ -756,6 +764,18 @@ fn init_plugin() -> bool { }"#, ); + settings.register_setting_json( + "network.pdbSkipNetworkPathCheck", + r#"{ + "title" : "Skip Network Path Check", + "type" : "boolean", + "default" : false, + "aliases" : ["pdb.SkipNetworkPathCheck", "pdb.skip-network-path-check"], + "description" : "Skip the HEAD http request that verifies if a PDB network path exists (only for localhost servers).", + "ignore" : [] + }"#, + ); + settings.register_setting_json( "pdb.files.symbolServerList", r#"{