jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 30427] New: - Response contents can be truncated prematurely
Date Sun, 01 Aug 2004 14:57:49 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30427>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30427

Response contents can be truncated prematurely

           Summary: Response contents can be truncated prematurely
           Product: Taglibs
           Version: 1.0
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: IO Taglib
        AssignedTo: taglibs-dev@jakarta.apache.org
        ReportedBy: david.goodenough@btconnect.com


I think I have found a problem in the IO taglib.   
 
I have a site where I use JSP with JSTL and the IO taglibs to provide a 
web frount end to a servlet which takes XML requests and delivers 
XML responses (this is used by some embedded systems as well as 
the web UI). 
 
Every now and then I get a null response back from the servlet when 
using the IO taglib.  The embedded systems never hit this problem. 
The log at the Servlet indicates that a response was sent, and ethereal 
concures. 
 
Originally the servlet only accepted https requests, even from the 
web UI, and this is where I hit this problem first.   I changed the 
servlet so that it would accept http requests from localhost and  
the problem diminished but did not go away. 
 
The problem - I think - is in the org.apache.taglibs.io.PipiHelper 
class, in the pipe routine.  It currently reads:- 
 
            while (true) { 
                int size = input.read( buffer ); 
                if ( size <= 0 ) { 
                    return; 
                } 
                output.write( buffer, 0, size ); 
 
The problem is that size can be zero, especially for https 
sessions when the stream is not at end of file.  The only 
real end of file is when size == -1. 
 
The code should read:- 
 
            while (true) {  
                int size = input.read( buffer );  
                if ( size < 0 ) {  
                    return;  
                }  
                else if( size == 0)  { 
                        Thread.sleep( 1); 
                } 
                else { 
                         output.write( buffer, 0, size );  
                } 
 
I am not sure whether the Thread sleep is necessary, but it does 
give the scheduler a chance when the request is to a local source 
in the same process (i.e. to a Tomcat servlet).

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org


Mime
View raw message