GP-7269 Changed ProgramLocator to preserve original URL and disabled

Felix URL proxy handler mechanism.
This commit is contained in:
ghidra1
2026-09-11 15:51:41 -04:00
parent a9cfc37b4c
commit e5c87cc09f
6 changed files with 43 additions and 13 deletions

View File

@@ -417,6 +417,10 @@ public class BundleHost {
// setup the cache path
config.setProperty(Constants.FRAMEWORK_STORAGE, makeCacheDir());
// prevent the use of Felix URL handlers which can interfere with URL.openConnection
// exception handling
config.put(FelixConstants.SERVICE_URLHANDLERS_PROP, "false");
config.put(FelixConstants.LOG_LEVEL_PROP, "1");
if (STDERR_DEBUGGING) {
config.put(FelixConstants.LOG_LEVEL_PROP, "999");

View File

@@ -36,7 +36,14 @@ import ghidra.util.Msg;
*/
public class ProgramLocator {
private final DomainFile domainFile;
// Connections and any saved state should be based upon a non-normalized URL
// as it was originally specified. This is necessary to ensure that server
// certificate validation is based upon the original server hostname as
// specified by the user.
private final URL ghidraURL;
private final URL normalizedGhidraURL;
private final int version;
private final boolean invalidContent;
@@ -49,7 +56,8 @@ public class ProgramLocator {
if (!GhidraURL.isGhidraURL(url)) {
throw new IllegalArgumentException("unsupported protocol: " + url.getProtocol());
}
this.ghidraURL = GhidraURL.getNormalizedURL(url);
this.ghidraURL = url;
this.normalizedGhidraURL = GhidraURL.getNormalizedURL(url);
this.domainFile = null;
this.version = DomainFile.DEFAULT_VERSION;
this.invalidContent = false; // unable to validate
@@ -98,6 +106,7 @@ public class ProgramLocator {
}
this.domainFile = file;
this.ghidraURL = url;
this.normalizedGhidraURL = url != null ? GhidraURL.getNormalizedURL(url) : null;
}
/**
@@ -109,13 +118,22 @@ public class ProgramLocator {
}
/**
* Returns the URL for this locator or null if this is a DomainFile based locator
* @return the URL for this locator or null if this is a DomainFile based locator
* Returns the Ghidra URL for this locator or null if this is a DomainFile based locator.
* This URL represents the original URL form when locator was first instantiated.
* @return the Ghidra URL for this locator or null if this is a DomainFile based locator.
*/
public URL getURL() {
return ghidraURL;
}
/**
* Returns the normalized Ghidra URL for this locator or null if this is a DomainFile based locator.
* @return the Ghidra URL for this locator or null if this is a DomainFile based locator.
*/
public URL getNormalizedURL() {
return normalizedGhidraURL;
}
/**
* Returns the version of the program that this locator represents
* @return the version of the program that this locator represents
@@ -166,7 +184,7 @@ public class ProgramLocator {
@Override
public int hashCode() {
return Objects.hash(domainFile, ghidraURL, version);
return Objects.hash(domainFile, normalizedGhidraURL, version);
}
@Override
@@ -182,7 +200,8 @@ public class ProgramLocator {
}
ProgramLocator other = (ProgramLocator) obj;
return Objects.equals(domainFile, other.domainFile) &&
Objects.equals(ghidraURL, other.ghidraURL) && version == other.version;
Objects.equals(normalizedGhidraURL, other.normalizedGhidraURL) &&
version == other.version;
}
}