Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- "javascript:"-URLs are recognized as well (as intended formerly I assume)

karlchenofhellbe941c4475d9
diff --git a/source/de/anomic/net/URL.java b/source/de/anomic/net/URL.java
index e66778418..943e8cca5 100644
--- a/source/de/anomic/net/URL.java
+++ b/source/de/anomic/net/URL.java
@@ -109,13 +109,9 @@ public class URL {
if (relPath == null) throw new MalformedURLException("relPath is null");
int p = relPath.indexOf(':');
String relprotocol = (p < 0) ? null : relPath.substring(0, p).toLowerCase();
- if (relprotocol != null) {
- if ("http.https.ftp.mailto".indexOf(relprotocol) >= 0) {
- parseURLString(relPath);
- } else {
- throw new MalformedURLException("unknown protocol: " + relprotocol);
- }
- } else {
+ if (relprotocol != null && "http.https.ftp.mailto".indexOf(relprotocol) >= 0) {
+ parseURLString(relPath);
+ } else if (relprotocol == null || relprotocol.equals("javascript")) {
this.protocol = baseURL.protocol;
this.host = baseURL.host;
this.port = baseURL.port;
@@ -149,6 +145,8 @@ public class URL {
identRef();
identQuest();
escape();
+ } else {
+ throw new MalformedURLException("unknown protocol: " + relprotocol);
}
}
@@ -525,7 +523,9 @@ public class URL {
new String[]{"http://www.anomic.de/home", "news:de.test"},
new String[]{"http://www.anomic.de/home", "ftp://ftp.anomic.de/src"},
new String[]{null, "ftp://ftp.delegate.org/"},
- new String[]{"http://www.anomic.de/home", "ftp://ftp.delegate.org/"}
+ new String[]{"http://www.anomic.de/home", "ftp://ftp.delegate.org/"},
+ new String[]{"http://www.anomic.de","mailto:[email protected]"},
+ new String[]{"http://www.anomic.de","javascipt:temp"}
};
String environment, url;
de.anomic.net.URL aURL = null;