Author: fhanik Date: Wed Aug 13 19:54:59 2008 New Revision: 685752 URL: http://svn.apache.org/viewvc?rev=685752&view=rev Log: fix 44494
Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/InputBuffer.java tomcat/container/tc5.5.x/webapps/docs/changelog.xml tomcat/current/tc5.5.x/STATUS.txt Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java?rev=685752&r1=685751&r2=685752&view=diff ============================================================================== --- tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java (original) +++ tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/B2CConverter.java Wed Aug 13 19:54:59 2008 @@ -82,17 +82,12 @@ { // Set the ByteChunk as input to the Intermediate reader iis.setByteChunk( bb ); - convert(cb, limit); - } - - private void convert(CharChunk cb, int limit) - throws IOException - { try { // read from the reader - int count = 0; + int bbLengthBeforeRead = 0; while( limit > 0 ) { int size = limit < BUFFER_SIZE ? limit : BUFFER_SIZE; + bbLengthBeforeRead = bb.getLength(); int cnt=conv.read( result, 0, size ); if( cnt <= 0 ) { // End of stream ! - we may be in a bad state @@ -106,7 +101,7 @@ // XXX go directly cb.append( result, 0, cnt ); - limit -= cnt; + limit = limit - (bbLengthBeforeRead - bb.getLength()); } } catch( IOException ex) { if( debug>0) @@ -222,6 +217,14 @@ /** Reset the buffer */ public final void recycle() { + try { + // Must clear super's buffer. + while (ready()) { + // InputStreamReader#skip(long) will allocate buffer to skip. + read(); + } + } catch(IOException ioe){ + } } } Modified: tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java?rev=685752&r1=685751&r2=685752&view=diff ============================================================================== --- tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java (original) +++ tomcat/connectors/trunk/util/java/org/apache/tomcat/util/buf/CharChunk.java Wed Aug 13 19:54:59 2008 @@ -478,7 +478,7 @@ tmp=new char[newSize]; } - System.arraycopy(buff, start, tmp, start, end-start); + System.arraycopy(buff, 0, tmp, 0, end); buff = tmp; tmp = null; } Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/InputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/InputBuffer.java?rev=685752&r1=685751&r2=685752&view=diff ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/InputBuffer.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/InputBuffer.java Wed Aug 13 19:54:59 2008 @@ -333,8 +333,11 @@ cb.setOffset(0); cb.setEnd(0); } + int limit = bb.getLength()+cb.getStart(); + if ( cb.getLimit() < limit ) + cb.setLimit(limit); state = CHAR_STATE; - conv.convert(bb, cb, len); + conv.convert(bb, cb, bb.getLength()); bb.setOffset(bb.getEnd()); return cb.getLength(); @@ -441,11 +444,7 @@ cb.setOffset(0); } } - int offset = readAheadLimit; - if (offset < size) { - offset = size; - } - cb.setLimit(cb.getStart() + offset); + cb.setLimit(cb.getStart() + readAheadLimit + size); markPos = cb.getStart(); } Modified: tomcat/container/tc5.5.x/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/webapps/docs/changelog.xml?rev=685752&r1=685751&r2=685752&view=diff ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Wed Aug 13 19:54:59 2008 @@ -43,6 +43,9 @@ <subsection name="Catalina"> <changelog> <fix> + <bug>44494</bug>: Backport from 6.0 (rjung) + </fix> + <fix> Add additional checks for URI normalization. (remm) </fix> <fix> Modified: tomcat/current/tc5.5.x/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/current/tc5.5.x/STATUS.txt?rev=685752&r1=685751&r2=685752&view=diff ============================================================================== --- tomcat/current/tc5.5.x/STATUS.txt (original) +++ tomcat/current/tc5.5.x/STATUS.txt Wed Aug 13 19:54:59 2008 @@ -98,14 +98,6 @@ +1: markt, yoavs -1: -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=44494 - >8k request truncation and various multi-byte issues - These patches are Rainer's port - https://issues.apache.org/bugzilla/attachment.cgi?id=21872 - https://issues.apache.org/bugzilla/attachment.cgi?id=21873 - +1: rjung, markt, fhanik - -1: - * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=45591 NPE on start-up failure in some cases. Based on a patch by Matt Passell http://svn.apache.org/viewvc?rev=683982&view=rev --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]