From 69f65210e220a5f95d10b8b776ce48cd6e51f4ea Mon Sep 17 00:00:00 2001 From: borg-0300 Date: Sun, 1 Jan 2006 13:07:57 +0000 Subject: [PATCH] ".yacy" has its own directory; glad new year :) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1275 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- source/de/anomic/plasma/plasmaHTCache.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java index f8807ba06..b48a6b5e9 100644 --- a/source/de/anomic/plasma/plasmaHTCache.java +++ b/source/de/anomic/plasma/plasmaHTCache.java @@ -498,21 +498,25 @@ public final class plasmaHTCache { 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) { @@ -550,6 +554,9 @@ public final class plasmaHTCache { } 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; } @@ -728,7 +735,7 @@ public final class plasmaHTCache { // 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;