tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Ratica" <ad...@cardinalcommerce.com>
Subject inputstream, and do a read will block forever.
Date Mon, 09 Apr 2001 16:14:29 GMT
If I send an empty get request to my servlet, get the inputstream, and do a
read will block forever.
(eg: just call the servlet from IE or Netscape it just hangs).

InputStream in = servletRequest.getInputStream();
byte[] buffer = new byte[bufferSize];
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
int read = 0;
do {
	System.out.println("getBody1");
      read = in.read(buffer);
      System.out.println("getBody2");
      if(read>=0) { byteStream.write(buffer, 0, read); }
} while (read >= 0);

"getBody2" is never printed.
In Tomcat 3.2 I had the same problem
In Tomcat 3.3 the read would return, but -1 would never be returned, so it
would loop forever.


This servlet works fine on iplanet, and vqserver.

Also the content size returned is -1, so I can't just slurp it into an
array.

This is a security issue with us, because an outsider can send our server
into
infinite loops.


Thank you,
Adam Ratica
Software Architect
CardinalCommerce, Inc.
6119 Heisley Road    Mentor, OH 44060
440-352-8444 x138    440-352-1646 Fax
adamr@cardinalcommerce.com



Mime
View raw message