The following reply was made to PR mod_jserv/5285; it has been noted by GNATS.
From: "Jon Smirl" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Subject: Re: mod_jserv/5285: no EOF from getInputStream when content-length passed Date: Wed, 10 Nov 1999 18:27:37 -0500 Here's a fix for JServInputStream. I've given it limited testing and it appears to correct the problem. The idea is pass the content-length in on the constructor or JServInputStream and then track the data as it is consumed. Whem it's all gone, start returning 0's. The unknown content-length of -1 also needs to be supported since most requests are in that mode. // Set up the servlet's I/O streams servlet_in = new JServInputStream(getContentLength(), in); /** * 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)) return in.read(); 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; length -= len; if (len > 0) return in.read(b, 0, len); 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; length -= len; if (len > 0) return in.read(b,off,len); 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) return in.skip(n); 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]