diff --git a/source/de/anomic/plasma/plasmaCrawlWorker.java b/source/de/anomic/plasma/plasmaCrawlWorker.java index cb8952e85..b70ab629f 100644 --- a/source/de/anomic/plasma/plasmaCrawlWorker.java +++ b/source/de/anomic/plasma/plasmaCrawlWorker.java @@ -58,7 +58,7 @@ import de.anomic.http.httpHeader; import de.anomic.http.httpRemoteProxyConfig; import de.anomic.http.httpc; import de.anomic.http.httpdProxyHandler; -import de.anomic.plasma.plasmaHTCache.Entry; +import de.anomic.server.serverSystem; import de.anomic.server.logging.serverLog; import de.anomic.tools.bitfield; import de.anomic.yacy.yacyCore; @@ -358,7 +358,7 @@ public final class plasmaCrawlWorker extends Thread { //long contentLength = res.responseHeader.contentLength(); htCache = cacheManager.newEntry(requestDate, depth, url, name, requestHeader, res.status, res.responseHeader, initiator, profile); - if (htCache.cacheFile.getAbsolutePath().length() > Entry.MAXPATHLENGTH) { + if (htCache.cacheFile.getAbsolutePath().length() > serverSystem.maxPathLength()) { remote.close(); log.logInfo("REJECTED URL " + url.toString() + " because path too long '" + cacheManager.cachePath.getAbsolutePath() + "'"); diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java index 038a58649..200d31a42 100644 --- a/source/de/anomic/plasma/plasmaHTCache.java +++ b/source/de/anomic/plasma/plasmaHTCache.java @@ -76,6 +76,7 @@ import de.anomic.kelondro.kelondroMScoreCluster; import de.anomic.kelondro.kelondroMap; import de.anomic.server.serverFileUtils; import de.anomic.server.serverInstantThread; +import de.anomic.server.serverSystem; import de.anomic.server.logging.serverLog; import de.anomic.server.serverDate; import de.anomic.tools.enumerateFiles; @@ -604,8 +605,6 @@ public final class plasmaHTCache { public final class Entry { - public static final int MAXPATHLENGTH = 255; - // the class objects public Date initDate; // the date when the request happened; will be used as a key public int depth; // the depth of prefetching @@ -743,7 +742,7 @@ public final class plasmaHTCache { // we cannot match that here in the cache file path and therefore omit writing into the cache if (this.cacheFile.getParentFile().isFile() || this.cacheFile.isDirectory()) { return "path_ambiguous"; } if (this.cacheFile.toString().indexOf("..") >= 0) { return "path_dangerous"; } - if (this.cacheFile.getAbsolutePath().length() > MAXPATHLENGTH) { return "path too long"; } + if (this.cacheFile.getAbsolutePath().length() > serverSystem.maxPathLength()) { return "path too long"; } // -CGI access in request // CGI access makes the page very individual, and therefore not usable in caches diff --git a/source/de/anomic/server/serverSystem.java b/source/de/anomic/server/serverSystem.java index 0eb680d0f..6bc002512 100644 --- a/source/de/anomic/server/serverSystem.java +++ b/source/de/anomic/server/serverSystem.java @@ -118,6 +118,15 @@ public final class serverSystem { } } + public static boolean isWindows() { + return systemOS == systemWindows; + } + + public static int maxPathLength() { + if (systemOS == systemWindows) return 255; + return 65535; + } + public static Object getMacOSTS(String s) { if ((isMacArchitecture) && (macMRJFileUtils != null)) try { if ((s == null) || (s.equals(blankTypeString))) return macMRJOSNullObj;