tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ricardo de Souza Moura" <ricsouzamo...@hotmail.com>
Subject come back !!! Is this a bug of mod JK ?
Date Thu, 17 Oct 2002 21:21:11 GMT
this is a piece of code of the src HttpRequestBase of the Tomcat4.1.12
It comment about the possible bug of mod_JK, but put some lines to avoid a 
infinite loop... So this piece of code use a resource of jdk1.4 that is a 
method of StringBuffer(add(StringBuffer)). This signify that the 
Tomcat4.1.12 get a mistake if this condition happen and the jdk is not 
1.4...

My question: THere are in the Tomcat4.1.10 this line to avoid the infinite 
loop?
My app is get a infinite loop !!!! I don't get the source of Tomcat4.1.10...
Thanks

try {
                int max = getContentLength();
                int len = 0;
                byte buf[] = new byte[getContentLength()];
                ServletInputStream is = getInputStream();
                while (len < max) {
                    int next = is.read(buf, len, max - len);
                    if (next < 0 ) {
                        break;
                    }
                    len += next;
                }
                is.close();
                if (len < max) {
                    // FIX ME, mod_jk when sending an HTTP POST will 
sometimes
                    // have an actual content length received < content 
length.
                    // Checking for a read of -1 above prevents this code 
from
                    // going into an infinite loop.  But the bug must be in 
mod_jk.
                    // Log additional data when this occurs to help debug 
mod_jk
                    StringBuffer msg = new StringBuffer();
                    msg.append("HttpRequestBase.parseParameters content 
length mismatch\n");
                    msg.append("  URL: ");
                    msg.append(getRequestURL());
                    msg.append(" Content Length: ");
                    msg.append(max);
                    msg.append(" Read: ");
                    msg.append(len);
                    msg.append("\n  Bytes Read: ");
                    if ( len > 0 ) {
                        msg.append(new String(buf,0,len));
                    }
                    log(msg.toString());
                    throw new RuntimeException
                        
(sm.getString("httpRequestBase.contentLengthMismatch"));
                }
                RequestUtil.parseParameters(results, buf, encoding);
            } catch (UnsupportedEncodingException ue) {
                ;
            } catch (IOException e) {
                throw new RuntimeException
                        (sm.getString("httpRequestBase.contentReadFail") +
                         e.getMessage());
            }


_________________________________________________________________
MSN Messenger: converse com os seus amigos online. 
http://messenger.msn.com.br


--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message