You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2002/01/06 09:46:10 UTC
cvs commit: jakarta-tomcat-connectors/jk/java/org/apache/jk/common MsgAjp.java
costin 02/01/06 00:46:10
Modified: jk/java/org/apache/jk/common MsgAjp.java
Log:
Added support for ByteChunk. Few fixes.
Revision Changes Path
1.2 +29 -5 jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java
Index: MsgAjp.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/jk/common/MsgAjp.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MsgAjp.java 31 Dec 2001 19:02:01 -0000 1.1
+++ MsgAjp.java 6 Jan 2002 08:46:10 -0000 1.2
@@ -67,7 +67,7 @@
import java.security.*;
import org.apache.tomcat.util.http.MimeHeaders;
-import org.apache.tomcat.util.buf.MessageBytes;
+import org.apache.tomcat.util.buf.*;
import org.apache.tomcat.util.http.HttpMessages;
import org.apache.tomcat.util.buf.HexUtils;
@@ -167,10 +167,24 @@
return;
}
- byte[] bytes = mb.getByteChunk().getBytes();
- int start=mb.getByteChunk().getStart();
- appendInt( mb.getLength() );
- appendBytes(bytes, start, mb.getLength());
+ // XXX Convert !!
+ ByteChunk bc= mb.getByteChunk();
+ appendByteChunk(bc);
+ }
+
+ public void appendByteChunk(ByteChunk bc) throws IOException {
+ if(bc==null || bc.isNull() ) {
+ appendInt( 0);
+ appendByte(0);
+ return;
+ }
+
+ byte[] bytes = bc.getBytes();
+ int start=bc.getStart();
+ appendInt( bc.getLength() );
+ System.out.println("XXX appending" + bytes + " " + bc.getLength() +
+ " " + new String( bytes, 0, bc.getLength()));
+ cpBytes(bytes, start, bc.getLength());
appendByte(0);
}
@@ -186,6 +200,16 @@
* @param len The number of bytes to copy.
*/
public void appendBytes( byte b[], int off, int numBytes ) {
+ if( pos + numBytes >= buf.length ) {
+ System.out.println("Buffer overflow " + buf.length + " " + pos + " " + numBytes );
+ return;
+ }
+ appendInt( numBytes );
+ cpBytes( b, off, numBytes );
+ appendByte(0);
+ }
+
+ private void cpBytes( byte b[], int off, int numBytes ) {
if( pos + numBytes >= buf.length ) {
System.out.println("Buffer overflow " + buf.length + " " + pos + " " + numBytes );
return;
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>