You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2011/11/11 00:30:19 UTC
svn commit: r1200620 - in /tomcat/tc6.0.x/trunk: STATUS.txt
java/org/apache/coyote/http11/filters/FlushableGZIPOutputStream.java
webapps/docs/changelog.xml
Author: kkolinko
Date: Thu Nov 10 23:30:18 2011
New Revision: 1200620
URL: http://svn.apache.org/viewvc?rev=1200620&view=rev
Log:
Revert r1200603
Something is broken.
Modified:
tomcat/tc6.0.x/trunk/STATUS.txt
tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/FlushableGZIPOutputStream.java
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1200620&r1=1200619&r2=1200620&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu Nov 10 23:30:18 2011
@@ -64,6 +64,16 @@ PATCHES PROPOSED TO BACKPORT:
- getStuckThreadIds() returns a list of ids. It might be useful to
have a similar method that returns Thread.getName() names.
+* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52121
+ Fix possible output corruption when compression is
+ enabled for a connector and the response is flushed.
+ https://issues.apache.org/bugzilla/attachment.cgi?id=27905
+ +1: kkolinko, markt, rjung
+ -1: kkolinko: Reverted. Something is wrong. With compression=on and this patch browsers display blank page.
+ wget --tries=1 --save-headers "--header=Accept-Encoding:gzip,deflate" http://localhost:8080/
+ results in "No data received".
+
+
* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=50570
Apply FIPS mode patch from TC7:
http://svn.apache.org/viewvc?rev=1199985&view=rev
Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/FlushableGZIPOutputStream.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/FlushableGZIPOutputStream.java?rev=1200620&r1=1200619&r2=1200620&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/FlushableGZIPOutputStream.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/http11/filters/FlushableGZIPOutputStream.java Thu Nov 10 23:30:18 2011
@@ -35,74 +35,58 @@ public class FlushableGZIPOutputStream e
super(os);
}
+ private static final byte[] EMPTYBYTEARRAY = new byte[0];
+ private boolean hasData = false;
+
/**
- * It is used to reserve one byte of real data so that it can be used when
- * flushing the stream.
+ * Here we make sure we have received data, so that the header has been for
+ * sure written to the output stream already.
*/
- private byte[] lastByte = new byte[1];
- private boolean hasLastByte = false;
-
- @Override
- public void write(byte[] bytes) throws IOException {
- write(bytes, 0, bytes.length);
- }
-
@Override
- public synchronized void write(byte[] bytes, int offset, int length)
+ public synchronized void write(byte[] bytes, int i, int i1)
throws IOException {
- if (length > 0) {
- flushLastByte();
- if (length > 1) {
- super.write(bytes, offset, length - 1);
- }
- rememberLastByte(bytes[offset + length - 1]);
- }
+ super.write(bytes, i, i1);
+ hasData = true;
}
@Override
public synchronized void write(int i) throws IOException {
- flushLastByte();
- rememberLastByte((byte) i);
+ super.write(i);
+ hasData = true;
}
@Override
- public synchronized void close() throws IOException {
- flushLastByte();
- super.close();
- }
-
- private void rememberLastByte(byte b) {
- lastByte[0] = b;
- hasLastByte = true;
- }
-
- private void flushLastByte() throws IOException {
- if (hasLastByte) {
- super.write(lastByte, 0, 1);
- hasLastByte = false;
- }
+ public synchronized void write(byte[] bytes) throws IOException {
+ super.write(bytes);
+ hasData = true;
}
@Override
public synchronized void flush() throws IOException {
- if (hasLastByte) {
- // - do not allow the gzip header to be flushed on its own
- // - do not do anything if there is no data to send
-
- // trick the deflater to flush
- /**
- * Now this is tricky: We force the Deflater to flush its data by
- * switching compression level. As yet, a perplexingly simple workaround
- * for
- * http://developer.java.sun.com/developer/bugParade/bugs/4255743.html
- */
- if (!def.finished()) {
- def.setLevel(Deflater.NO_COMPRESSION);
- flushLastByte();
- def.setLevel(Deflater.DEFAULT_COMPRESSION);
- }
+ if (!hasData) {
+ return; // do not allow the gzip header to be flushed on its own
}
- out.flush();
+
+ // trick the deflater to flush
+ /**
+ * Now this is tricky: We force the Deflater to flush its data by
+ * switching compression level. As yet, a perplexingly simple workaround
+ * for
+ * http://developer.java.sun.com/developer/bugParade/bugs/4255743.html
+ */
+ if (!def.finished()) {
+ def.setInput(EMPTYBYTEARRAY, 0, 0);
+
+ def.setLevel(Deflater.NO_COMPRESSION);
+ deflate();
+
+ def.setLevel(Deflater.DEFAULT_COMPRESSION);
+ deflate();
+
+ out.flush();
+ }
+
+ hasData = false; // no more data to flush
}
/*
Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=1200620&r1=1200619&r2=1200620&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Thu Nov 10 23:30:18 2011
@@ -160,11 +160,6 @@
the socket from 30s to 10s. (kkolinko)
</fix>
<fix>
- <bug>52121</bug>: Fix possible output corruption when compression is
- enabled for a connector and the response is flushed. Test
- case provided by David Marcks. (kkolinko)
- </fix>
- <fix>
Replace unneeded call that iterated events queue in NioEndpoint.Poller.
(kkolinko)
</fix>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org