Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
SSI fix for http://forum.yacy-websuche.de/viewtopic.php?f=6&t=29
orbitere03fcf462792
diff --git a/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java b/source/de/anomic/htmlFilter/htmlFilterContentTransformer.javaindex 62481b54d..288c1b460 100644--- a/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java+++ b/source/de/anomic/htmlFilter/htmlFilterContentTransformer.java@@ -144,7 +144,7 @@ public class htmlFilterContentTransformer extends htmlFilterAbstractTransformer// this is a text fragment, generate gettext quotationint ws = sbbs[i].whitespaceStart(true);int we = sbbs[i].whitespaceEnd(true);- result.add(new String(sbbs[i].getBytes(ws, we)));+ result.add(new String(sbbs[i].getBytes(ws, we - ws)));}}return result;diff --git a/source/de/anomic/http/httpChunkedOutputStream.java b/source/de/anomic/http/httpChunkedOutputStream.javaindex dd5591b34..f5f7ab1dc 100644--- a/source/de/anomic/http/httpChunkedOutputStream.java+++ b/source/de/anomic/http/httpChunkedOutputStream.java@@ -102,7 +102,7 @@ public final class httpChunkedOutputStream extends FilterOutputStream {this.out.write(Integer.toHexString(len).getBytes());this.out.write(serverCore.crlf);- this.out.write(b.getBytes(off, off + len));+ this.out.write(b.getBytes(off, len));this.out.write(serverCore.crlf);this.out.flush();}diff --git a/source/de/anomic/http/httpSSI.java b/source/de/anomic/http/httpSSI.javaindex 6ad4778ec..265ae3e39 100644--- a/source/de/anomic/http/httpSSI.java+++ b/source/de/anomic/http/httpSSI.java@@ -48,7 +48,7 @@ public class httpSSI {parseSSI(referenceFile, in, start, q + 3 - start, out);writeSSI(referenceFile, in, start + q + 3, out);} else if (p > 0) {- int q = in.indexOf("-->".getBytes(), start + 10);+ int q = in.indexOf("-->".getBytes(), p + 10);out.write(in, start, p - start);parseSSI(referenceFile, in, start + p, q + 3 - start - p, out);writeSSI(referenceFile, in, start + q + 3, out);diff --git a/source/de/anomic/http/httpTemplate.java b/source/de/anomic/http/httpTemplate.javaindex 14626b516..fba1314df 100644--- a/source/de/anomic/http/httpTemplate.java+++ b/source/de/anomic/http/httpTemplate.java@@ -179,7 +179,7 @@ public final class httpTemplate {if (q >= 0) {// found a patternl.addAll(splitQuotation(new serverByteBuffer(text.getBytes(0, p)), qoff));- l.add(new serverByteBuffer(text.getBytes(p, q + right.length)));+ l.add(new serverByteBuffer(text.getBytes(p, q + right.length - p)));text = new serverByteBuffer(text.getBytes(q + right.length));} else {// found only pattern start, no closing parantesis (a syntax error that is silently accepted here)diff --git a/source/de/anomic/kelondro/kelondroBufferedRA.java b/source/de/anomic/kelondro/kelondroBufferedRA.javaindex 94feec9d3..27f44590d 100644--- a/source/de/anomic/kelondro/kelondroBufferedRA.java+++ b/source/de/anomic/kelondro/kelondroBufferedRA.java@@ -80,7 +80,7 @@ public class kelondroBufferedRA extends kelondroAbstractRA implements kelondroRA}public int read(byte[] b, int off, int len) throws IOException {- byte[] g = sbb.getBytes((int) pos, (int) pos + len);+ byte[] g = sbb.getBytes((int) pos, len);pos += g.length;System.arraycopy(g, 0, b, off, g.length);return g.length;diff --git a/source/de/anomic/server/serverByteBuffer.java b/source/de/anomic/server/serverByteBuffer.javaindex 04ecb4066..988c2a410 100644--- a/source/de/anomic/server/serverByteBuffer.java+++ b/source/de/anomic/server/serverByteBuffer.java@@ -295,13 +295,13 @@ public final class serverByteBuffer extends OutputStream {public byte[] getBytes(int start) {return getBytes(start, length);}-- public byte[] getBytes(int start, int end) {++ public byte[] getBytes(int start, int len) {// start is inclusive, end is exclusive- if (end > length) throw new IndexOutOfBoundsException("getBytes: end > length");+ if (len > length) throw new IndexOutOfBoundsException("getBytes: len > length");if (start > length) throw new IndexOutOfBoundsException("getBytes: start > length");- byte[] tmp = new byte[end - start];- System.arraycopy(buffer, offset + start, tmp, 0, end - start);+ byte[] tmp = new byte[len];+ System.arraycopy(buffer, offset + start, tmp, 0, len);return tmp;}@@ -313,13 +313,12 @@ public final class serverByteBuffer extends OutputStream {return this;}- public serverByteBuffer trim(int start, int end) {+ public serverByteBuffer trim(int start, int len) {// the end value is outside (+1) of the wanted target arrayif (start > length) throw new IndexOutOfBoundsException("trim: start > length");- if (end > length) throw new IndexOutOfBoundsException("trim: end > length");- if (start > end) throw new IndexOutOfBoundsException("trim: start > end");+ if (start + len > length) throw new IndexOutOfBoundsException("trim: start + len > length");offset = offset + start;- length = end - start;+ length = len;return this;}@@ -337,7 +336,7 @@ public final class serverByteBuffer extends OutputStream {r--;}if (l > r) r = l;- return trim(l, r);+ return trim(l, r - l);}public int isUTF8char(int start) {