From: remm Date: Fri, 13 Oct 2006 11:39:30 +0000 (+0000) Subject: - Packet must be ended before sending. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=2fcbf97fa3c95f66453399a401711ccb2f3ba9bf;p=tomcat7.0 - Packet must be ended before sending. - Fix off by one check bug in AjpMessage. - Fix recycling bug (setting streams to null when doing keepalive is not a good idea). git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@463652 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/ajp/AjpMessage.java b/java/org/apache/coyote/ajp/AjpMessage.java index ec5e69ea0..7b3bfd22b 100644 --- a/java/org/apache/coyote/ajp/AjpMessage.java +++ b/java/org/apache/coyote/ajp/AjpMessage.java @@ -275,7 +275,7 @@ public class AjpMessage { * @param numBytes The number of bytes to copy. */ public void appendBytes(byte[] b, int off, int numBytes) { - if (pos + numBytes + 3 >= buf.length) { + if (pos + numBytes + 3 > buf.length) { log.error(sm.getString("ajpmessage.overflow", "" + numBytes, "" + pos), new ArrayIndexOutOfBoundsException()); if (log.isDebugEnabled()) { @@ -382,6 +382,11 @@ public class AjpMessage { } + public int getPacketSize() { + return buf.length; + } + + public int processHeader() { pos = 0; int mark = getInt(); diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java b/java/org/apache/coyote/ajp/AjpProcessor.java index 8c224d8c3..5d2a67274 100644 --- a/java/org/apache/coyote/ajp/AjpProcessor.java +++ b/java/org/apache/coyote/ajp/AjpProcessor.java @@ -428,7 +428,9 @@ public class AjpProcessor implements ActionHook { rp.setStage(org.apache.coyote.Constants.STAGE_ENDED); recycle(); - + input = null; + output = null; + return true; } @@ -1062,9 +1064,6 @@ public class AjpProcessor implements ActionHook { response.recycle(); certificates.recycle(); - input = null; - output = null; - } @@ -1157,7 +1156,9 @@ public class AjpProcessor implements ActionHook { responseHeaderMessage.reset(); responseHeaderMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK); responseHeaderMessage.appendBytes(chunk.getBytes(), chunk.getOffset() + off, thisTime); + responseHeaderMessage.end(); output.write(responseHeaderMessage.getBuffer(), 0, responseHeaderMessage.getLen()); + off += thisTime; }