* maxfilesize -1 for infinite filesize

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6208 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
lotus 16 years ago
parent 7d493cf8cc
commit aa38eb5a20

@ -174,7 +174,7 @@ public final class HTTPLoader {
/* /*
// check if the content length is allowed // check if the content length is allowed
long contentLength = res.getResponseHeader().getContentLength(); long contentLength = res.getResponseHeader().getContentLength();
if (maxFileSize >= 0 && contentLength > maxFileSize) { if (maxFileSize > 0 && contentLength > maxFileSize) {
sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "file size limit exceeded"); sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "file size limit exceeded");
throw new IOException("REJECTED URL " + entry.url() + " because file size '" + contentLength + "' exceeds max filesize limit of " + maxFileSize + " bytes. (HEAD)"); throw new IOException("REJECTED URL " + entry.url() + " because file size '" + contentLength + "' exceeds max filesize limit of " + maxFileSize + " bytes. (HEAD)");
} }
@ -186,7 +186,7 @@ public final class HTTPLoader {
long contentLength = responseBody.length; long contentLength = responseBody.length;
// check length again in case it was not possible to get the length before loading // check length again in case it was not possible to get the length before loading
if (maxFileSize >= 0 && contentLength > maxFileSize) { if (maxFileSize > 0 && contentLength > maxFileSize) {
sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "file size limit exceeded"); sb.crawlQueues.errorURL.newEntry(entry, sb.peers.mySeed().hash, new Date(), 1, "file size limit exceeded");
throw new IOException("REJECTED URL " + entry.url() + " because file size '" + contentLength + "' exceeds max filesize limit of " + maxFileSize + " bytes. (GET)"); throw new IOException("REJECTED URL " + entry.url() + " because file size '" + contentLength + "' exceeds max filesize limit of " + maxFileSize + " bytes. (GET)");
} }

@ -45,7 +45,7 @@ public class httpClientGetMethod extends GetMethod {
public httpClientGetMethod(String uri, long maxfilesize) { public httpClientGetMethod(String uri, long maxfilesize) {
super(uri); super(uri);
this.maxfilesize = maxfilesize; if (maxfilesize > 0) this.maxfilesize = maxfilesize;
} }
@Override @Override

Loading…
Cancel
Save