Skip to content

Commit

Permalink
".yacy" has its own directory;
Browse files Browse the repository at this point in the history
glad new year :)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1275 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
borg-0300 committed Jan 1, 2006
1 parent 351fffc commit 69f6521
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions source/de/anomic/plasma/plasmaHTCache.java
Expand Up @@ -498,21 +498,25 @@ public File getCachePath(URL url) {
matcher.reset(remotePath);
}

remotePath = remotePath.replaceAll("[?&:]", "_"); // yes this is not reversible, but that is not needed
remotePath = remotePath.replaceAll("[?&:!]", "_"); // yes this is not reversible, but that is not needed

// only set NO default ports
int port = url.getPort();
String protocol = url.getProtocol();
if (port >= 0) {
if ((port == 80 && url.getProtocol().equalsIgnoreCase("http" )) ||
(port == 443 && url.getProtocol().equalsIgnoreCase("https")) ||
(port == 21 && url.getProtocol().equalsIgnoreCase("ftp" ))) {
if ((port == 80 && protocol.equalsIgnoreCase("http" )) ||
(port == 443 && protocol.equalsIgnoreCase("https")) ||
(port == 21 && protocol.equalsIgnoreCase("ftp" ))) {
port = -1;
}
}
if (url.getHost().toLowerCase().endsWith(".yacy")) {
protocol = "yacy";
}
if (port < 0) {
return new File(this.cachePath, url.getProtocol() + "/" + url.getHost() + remotePath);
return new File(this.cachePath, protocol + "/" + url.getHost() + remotePath);
} else {
return new File(this.cachePath, url.getProtocol() + "/" + url.getHost() + "!" + port + remotePath);
return new File(this.cachePath, protocol + "/" + url.getHost() + "!" + port + remotePath);
}
/* File path;
if (port < 0) {
Expand Down Expand Up @@ -550,6 +554,9 @@ public static URL getURL(File cachePath, File f) {
} else if (s.startsWith("ftp/")) {
protocol = "ftp://";
s = s.substring(4);
} else if (s.startsWith("yacy/")) {
protocol = "http://";
s = s.substring(5);
} else {
return null;
}
Expand Down Expand Up @@ -728,7 +735,7 @@ public String shallStoreCacheForProxy() {

// check status code
if (!(this.responseStatus.startsWith("200") ||
this.responseStatus.startsWith("203"))) { return "bad_status_" + this.responseStatus.substring(0,3); }
this.responseStatus.startsWith("203"))) { return "bad_status_" + this.responseStatus.substring(0,3); }

// check storage location
// sometimes a file name is equal to a path name in the same directory;
Expand Down

0 comments on commit 69f6521

Please sign in to comment.