adopted MAXPATHLENGTH to host system capabilities

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1930 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent d808765087
commit 30e3e3a0fd

@ -58,7 +58,7 @@ import de.anomic.http.httpHeader;
import de.anomic.http.httpRemoteProxyConfig; import de.anomic.http.httpRemoteProxyConfig;
import de.anomic.http.httpc; import de.anomic.http.httpc;
import de.anomic.http.httpdProxyHandler; 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.server.logging.serverLog;
import de.anomic.tools.bitfield; import de.anomic.tools.bitfield;
import de.anomic.yacy.yacyCore; import de.anomic.yacy.yacyCore;
@ -358,7 +358,7 @@ public final class plasmaCrawlWorker extends Thread {
//long contentLength = res.responseHeader.contentLength(); //long contentLength = res.responseHeader.contentLength();
htCache = cacheManager.newEntry(requestDate, depth, url, name, requestHeader, res.status, res.responseHeader, initiator, profile); 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(); remote.close();
log.logInfo("REJECTED URL " + url.toString() + " because path too long '" + log.logInfo("REJECTED URL " + url.toString() + " because path too long '" +
cacheManager.cachePath.getAbsolutePath() + "'"); cacheManager.cachePath.getAbsolutePath() + "'");

@ -76,6 +76,7 @@ import de.anomic.kelondro.kelondroMScoreCluster;
import de.anomic.kelondro.kelondroMap; import de.anomic.kelondro.kelondroMap;
import de.anomic.server.serverFileUtils; import de.anomic.server.serverFileUtils;
import de.anomic.server.serverInstantThread; import de.anomic.server.serverInstantThread;
import de.anomic.server.serverSystem;
import de.anomic.server.logging.serverLog; import de.anomic.server.logging.serverLog;
import de.anomic.server.serverDate; import de.anomic.server.serverDate;
import de.anomic.tools.enumerateFiles; import de.anomic.tools.enumerateFiles;
@ -604,8 +605,6 @@ public final class plasmaHTCache {
public final class Entry { public final class Entry {
public static final int MAXPATHLENGTH = 255;
// the class objects // the class objects
public Date initDate; // the date when the request happened; will be used as a key public Date initDate; // the date when the request happened; will be used as a key
public int depth; // the depth of prefetching 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 // 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.getParentFile().isFile() || this.cacheFile.isDirectory()) { return "path_ambiguous"; }
if (this.cacheFile.toString().indexOf("..") >= 0) { return "path_dangerous"; } 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 in request
// CGI access makes the page very individual, and therefore not usable in caches // CGI access makes the page very individual, and therefore not usable in caches

@ -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) { public static Object getMacOSTS(String s) {
if ((isMacArchitecture) && (macMRJFileUtils != null)) try { if ((isMacArchitecture) && (macMRJFileUtils != null)) try {
if ((s == null) || (s.equals(blankTypeString))) return macMRJOSNullObj; if ((s == null) || (s.equals(blankTypeString))) return macMRJOSNullObj;

Loading…
Cancel
Save