----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Sean, give this a try and see if it fixes your problem.....

I think I've figured out the root of the problem.  A fix I submitted about
two months ago is not exactly right. It is revision 1.68
JServeConnection.java. In the original fix I had not allowed for a partial
read fill from the socket. A partial read fill may occur on some OS's if
there is over 1K of post data.

Here's another try at fixing the original problem.....

    /**
     * ServletInputStream implementation as inner class
     */
    protected class JServInputStream extends ServletInputStream {

        protected InputStream in;
 protected int length;

        public JServInputStream(int length, InputStream in) {
     this.length = length;
            this.in = in;
        }

        public int read() throws IOException

   if ((length > 0) || (length == -1)) {
     int i = in.read();
     length -= i;
     return i;
   }
   return -1;
        }

        public int read(byte b[]) throws IOException {
     if (length == -1)
       return in.read(b, 0, b.length);

     int len = b.length;
     if (len > length)
       len = length;
     if (len > 0) {
       int i = in.read(b, 0, len);
       length -= i;
       return i;
     }
     return 0;
        }

        public int read(byte b[], int off, int len) throws IOException {
     if (length == -1)
              return in.read(b, off, len);

     if (len > length)
       len = length;
     if (len > 0) {
       int i = in.read(b,off,len);
       length -= i;
       return i;
     }
     return 0;
        }

        public long skip(long n) throws IOException {
     if (length == -1)
              return in.skip(n);

     if (n > length)
       n = length;
     length -= n;
     if (n > 0) {
       long i = in.skip(n);
              length -= i;
       return i;
     }
     return 0;
        }

        public void close() throws IOException {
            // Ignore closing of the input stream since it also
            // close the output stream.
            // conn.in.close();
        }

        /**
            We must implement this method because java.io.InputStream
            javadocs says that this will return 0. Since we use a long
            internally, it must be cast to an int. ugly. -JSS
        */
        public int available() throws IOException {
     if (length == -1)
       return in.available();
            return length;
        }

    }




Jon Smirl
[EMAIL PROTECTED]




--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to