Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) Bugfix for "download of non supported file content" via crawler See: http://www.yacy-forum.de/viewtopic.php?p=10724#10724

theli28c5687ff9bf
diff --git a/source/de/anomic/http/httpdProxyHandler.java b/source/de/anomic/http/httpdProxyHandler.java
index 9992e521f..603ff2b14 100644
--- a/source/de/anomic/http/httpdProxyHandler.java
+++ b/source/de/anomic/http/httpdProxyHandler.java
@@ -541,9 +541,11 @@ public final class httpdProxyHandler extends httpdAbstractHandler implements htt
);
// handle file types and make (possibly transforming) output stream
- if ((!(transformer.isIdentityTransformer())) &&
- ((ext == null) || (!(plasmaParser.mediaExtContains(ext)))) &&
- (plasmaParser.realtimeParsableMimeTypesContains(res.responseHeader.mime()))) {
+ if (
+ (!transformer.isIdentityTransformer()) &&
+ (plasmaParser.supportedFileExt(url)) &&
+ (plasmaParser.realtimeParsableMimeTypesContains(res.responseHeader.mime()))
+ ) {
// make a transformer
this.theLogger.logFine("create transformer for URL " + url);
hfos = new htmlFilterOutputStream((gzippedOut != null) ? gzippedOut : ((chunkedOut != null)? chunkedOut : respond), null, transformer, (ext.length() == 0));
diff --git a/source/de/anomic/plasma/plasmaCrawlWorker.java b/source/de/anomic/plasma/plasmaCrawlWorker.java
index 3efe0ad8c..1e83df8ca 100644
--- a/source/de/anomic/plasma/plasmaCrawlWorker.java
+++ b/source/de/anomic/plasma/plasmaCrawlWorker.java
@@ -355,12 +355,10 @@ public final class plasmaCrawlWorker extends Thread {
File cacheFile = cacheManager.getCachePath(url);
try {
String error = null;
- if ((!(plasmaParser.supportedMimeTypesContains(res.responseHeader.mime()))) &&
- (!(plasmaParser.supportedFileExt(url)))) {
- // if the response has not the right file type then reject file
- remote.close();
- log.logInfo("REJECTED WRONG MIME/EXT TYPE " + res.responseHeader.mime() + " for URL " + url.toString());
- } else {
+ if (
+ (plasmaParser.supportedMimeTypesContains(res.responseHeader.mime())) &&
+ (plasmaParser.supportedFileExt(url))
+ ) {
if (cacheFile.isFile()) {
cacheManager.deleteFile(url);
}
@@ -376,6 +374,10 @@ public final class plasmaCrawlWorker extends Thread {
} finally {
if (fos!=null)try{fos.close();}catch(Exception e){}
}
+ } else {
+ // if the response has not the right file type then reject file
+ remote.close();
+ log.logInfo("REJECTED WRONG MIME/EXT TYPE " + res.responseHeader.mime() + " for URL " + url.toString());
}
// enQueue new entry with response header
if (profile != null) {