Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
* skip style-tags in HTML-files
f1oric5691180cb19
diff --git a/source/de/anomic/htmlFilter/htmlFilterWriter.java b/source/de/anomic/htmlFilter/htmlFilterWriter.javaindex 059f0c151..be7a5e6a7 100644--- a/source/de/anomic/htmlFilter/htmlFilterWriter.java+++ b/source/de/anomic/htmlFilter/htmlFilterWriter.java@@ -68,6 +68,7 @@ public final class htmlFilterWriter extends Writer {private boolean inDoubleQuote;private boolean inComment;private boolean inScript;+ private boolean inStyle;private boolean binaryUnsuspect;private final boolean passbyIfBinarySuspect;@@ -89,6 +90,7 @@ public final class htmlFilterWriter extends Writer {this.inDoubleQuote = false;this.inComment = false;this.inScript = false;+ this.inStyle = false;this.binaryUnsuspect = true;this.passbyIfBinarySuspect = passbyIfBinarySuspect;@@ -411,6 +413,23 @@ public final class htmlFilterWriter extends Writer {// buffer = new serverByteBuffer();buffer.reset();}+ } else if (inStyle) {+ buffer.append(c);+ final int bufferLength = buffer.length();+ if ((c == rb) && (bufferLength > 13) &&+ (buffer.charAt(bufferLength - 8) == lb) &&+ (buffer.charAt(bufferLength - 7) == '/') &&+ (buffer.charAt(bufferLength - 6) == 's') &&+ (buffer.charAt(bufferLength - 5) == 't') &&+ (buffer.charAt(bufferLength - 4) == 'y') &&+ (buffer.charAt(bufferLength - 3) == 'l') &&+ (buffer.charAt(bufferLength - 2) == 'e')) {+ // style is at end+ inStyle = false;+ if (out != null) out.write(buffer.getChars());+ // buffer = new serverByteBuffer();+ buffer.reset();+ }} else {if (buffer.length() == 0) {if (c == rb) {@@ -435,9 +454,18 @@ public final class htmlFilterWriter extends Writer {(buffer.charAt(4) == 'i') &&(buffer.charAt(5) == 'p') &&(c == 't')) {- // this is the start of a comment+ // this is the start of a javascriptinScript = true;buffer.append(c);+ } else if ((buffer.length() >= 5) &&+ (buffer.charAt(1) == 's') &&+ (buffer.charAt(2) == 't') &&+ (buffer.charAt(3) == 'y') &&+ (buffer.charAt(4) == 'l') &&+ (c == 'e')) {+ // this is the start of a css-style+ inStyle = true;+ buffer.append(c);} else if (c == rb) {buffer.append(c);// the tag ends here. after filtering: pass on