----------------------------------------------------------------
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!!!
----------------------------------------------------------------

I'm using this code to process a post in XML encoding with 1.1b3:

    if ("POST".equals(request.getMethod())) {
      if ("text/xml".equals(request.getContentType())) {
         Parser p = new com.sun.xml.parser.Parser();
         p.setDocumentHandler(page);
         InputSource source = new InputSource(request.getInputStream());
         p.parse(source);
      }
    }

The problem is with sun's xml parser. The parser reads until EOF and does
not have anyway to specify a content-length.

Jserv's implementation does not detect a read past the length specified in
content-length and indicate EOF. Instead the read routine in
JServInputStream will hang trying to read more data from the browser that
isn't coming until it times out.

I made a simple patch for this problem by changing read to:

public int read(byte b[], int off, int len) throws IOException {
    if (in.available() == 0)
        return 0;
    return in.read(b,off,len);
}

This patch is not correct but it fixes the issue in my case.  This patch
will incorrectly terminate a large RFC1867 post. The correct patch needs to
track how many bytes have been read.  It also needs to compute the return
value from read() and available() based on bytes read vs content-length if
content-length has been specified.

Can a Jserv expert help me with the correct patch?

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