Skip to content

Commit

Permalink
*) Bugfix for "download of non supported file content" via crawler
Browse files Browse the repository at this point in the history
  • Loading branch information
theli committed Oct 3, 2005
1 parent 2b3f964 commit 28c5687
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
8 changes: 5 additions & 3 deletions source/de/anomic/http/httpdProxyHandler.java
Expand Up @@ -541,9 +541,11 @@ private void fulfillRequestFromWeb(Properties conProp, URL url,String ext, httpH
);

// 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));
Expand Down
14 changes: 8 additions & 6 deletions source/de/anomic/plasma/plasmaCrawlWorker.java
Expand Up @@ -355,12 +355,10 @@ private static void load(
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);
}
Expand All @@ -376,6 +374,10 @@ private static void load(
} 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) {
Expand Down

0 comments on commit 28c5687

Please sign in to comment.