Hi, please find attached a fix for an bug in the WarpConnector of Tomcat4. I had the problem that when uploading a picture (JPG) using a HTML form (with <input type="file"> tag) I got broken pictures on the server. After comparing the two files (locally and on the server) I realized the version on the server lost all 0xff bytes. They were simply stripped off, all other content was correctly transfered. After investigating in the C code of mod_webapp I had to move over to the JAVA code of the WarpConnector. There I found a code part which simply coerced the received byte to an int. Both are signed numeric values so the ASCII character 255 is converted to the integer -1. This -1 is a special value meaning end of stream. The attached code changes this behaviour.
Hope you can integrate this in the main distribution. Philipp
diff -r -u -N webapp-module-1.0-tc40.orig/java/WarpRequest.java webapp-module-1.0-tc40/java/WarpRequest.java --- webapp-module-1.0-tc40.orig/java/WarpRequest.java Mon Sep 17 05:41:39 2001 +++ webapp-module-1.0-tc40/java/WarpRequest.java Fri Oct 19 17:53:46 2001 @@ -138,8 +138,13 @@ if (packet.getType()!=Constants.TYPE_CBK_DATA) throw new IOException("Invalid WARP packet type for body"); - if (this.packet.pointer<this.packet.size) - return((int)this.packet.buffer[this.packet.pointer++]); + if (this.packet.pointer<this.packet.size) { + int b = (int)this.packet.buffer[this.packet.pointer++]; + if (b == -1) { + b = 255; + } + return(b); + } this.packet.reset(); this.packet.setType(Constants.TYPE_CBK_READ);