Author: rjung Date: Tue Mar 17 13:29:17 2009 New Revision: 755236 URL: http://svn.apache.org/viewvc?rev=755236&view=rev Log: Fix BZ 46770: Don't send duplicate headers when using flushBuffer().
Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/OutputBuffer.java tomcat/container/tc5.5.x/webapps/docs/changelog.xml tomcat/current/tc5.5.x/STATUS.txt Modified: tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/OutputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/OutputBuffer.java?rev=755236&r1=755235&r2=755236&view=diff ============================================================================== --- tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/OutputBuffer.java (original) +++ tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/connector/OutputBuffer.java Tue Mar 17 13:29:17 2009 @@ -79,6 +79,7 @@ * State of the output buffer. */ private int state = 0; + private boolean initial = true; /** @@ -229,6 +230,7 @@ public void recycle() { state = INITIAL_STATE; + initial = true; bytesWritten = 0; charsWritten = 0; @@ -306,15 +308,17 @@ return; doFlush = true; + if (initial) { + // If the buffers are empty, commit the response header + coyoteResponse.sendHeaders(); + initial = false; + } if (state == CHAR_STATE) { cb.flushBuffer(); bb.flushBuffer(); state = BYTE_STATE; } else if (state == BYTE_STATE) { bb.flushBuffer(); - } else if (state == INITIAL_STATE) { - // If the buffers are empty, commit the response header - coyoteResponse.sendHeaders(); } doFlush = false; @@ -650,6 +654,7 @@ gotEnc = false; enc = null; state = INITIAL_STATE; + initial = true; } 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=755236&r1=755235&r2=755236&view=diff ============================================================================== --- tomcat/container/tc5.5.x/webapps/docs/changelog.xml (original) +++ tomcat/container/tc5.5.x/webapps/docs/changelog.xml Tue Mar 17 13:29:17 2009 @@ -52,6 +52,9 @@ <subsection name="Catalina"> <changelog> <fix> + <bug>46770</bug>: Don't send duplicate headers when using flushBuffer(). (rjung) + </fix> + <fix> <bug>44021</bug>, <bug>43013</bug>: Add support for # to signify multi-level contexts for directories and wars. </fix> <fix> Modified: tomcat/current/tc5.5.x/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/current/tc5.5.x/STATUS.txt?rev=755236&r1=755235&r2=755236&view=diff ============================================================================== --- tomcat/current/tc5.5.x/STATUS.txt (original) +++ tomcat/current/tc5.5.x/STATUS.txt Tue Mar 17 13:29:17 2009 @@ -230,12 +230,3 @@ http://svn.apache.org/viewvc?rev=708273&view=rev +1: markt -1: - -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46770 - Headers send duplicate when using AJP and flush. - mod_jk doesn't accept such a response (starting with version 1.2.27). - Only a problem before 6.0. - Patch backported from http://svn.eu.apache.org/viewvc?view=rev&revision=411577 - Patch available at https://issues.apache.org/bugzilla/attachment.cgi?id=23316 - +1: rjung, billbarker, mturk - -1: --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org