Author: markt Date: Mon Jun 2 12:23:49 2014 New Revision: 1599184 URL: http://svn.apache.org/r1599184 Log: Revert fix for https://issues.apache.org/bugzilla/show_bug.cgi?id=56555 which, after further discussion, was classed as INVALID.
Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ ------------------------------------------------------------------------------ Reverse-merged /tomcat/trunk:r1597987 Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java?rev=1599184&r1=1599183&r2=1599184&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/AbstractHttp11Processor.java Mon Jun 2 12:23:49 2014 @@ -1514,8 +1514,11 @@ public abstract class AbstractHttp11Proc // Connection: close header. keepAlive = keepAlive && !statusDropsConnection(statusCode); if (!keepAlive) { - headers.setValue(Constants.CONNECTION).setString( - Constants.CLOSE); + // Avoid adding the close header twice + if (!connectionClosePresent) { + headers.addValue(Constants.CONNECTION).setString( + Constants.CLOSE); + } } else if (!http11 && !error) { headers.addValue(Constants.CONNECTION).setString(Constants.KEEPALIVE); } Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java?rev=1599184&r1=1599183&r2=1599184&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java Mon Jun 2 12:23:49 2014 @@ -25,7 +25,6 @@ import java.net.Socket; import java.nio.CharBuffer; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.concurrent.CountDownLatch; @@ -54,45 +53,6 @@ import org.apache.tomcat.util.buf.ByteCh public class TestAbstractHttp11Processor extends TomcatBaseTest { @Test - public void testStatusForcesClose() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - // Must have a real docBase - just use temp - Context ctxt = tomcat.addContext("", System.getProperty("java.io.tmpdir")); - - // Add protected servlet - Tomcat.addServlet(ctxt, "StatusForcesCloseServlet", new StatusForcesCloseServlet()); - ctxt.addServletMapping("/*", "StatusForcesCloseServlet"); - - tomcat.start(); - - ByteChunk bc = new ByteChunk(); - Map<String,List<String>> responseHeaders = new HashMap<String,List<String>>(); - getUrl("http://localhost:" + getPort() + "/anything", bc, responseHeaders); - - // Assumes header name uses standard case - List<String> values = responseHeaders.get("Connection"); - Assert.assertEquals(1, values.size()); - Assert.assertEquals("close", values.get(0).toLowerCase(Locale.ENGLISH)); - } - - private static class StatusForcesCloseServlet extends HttpServlet { - - private static final long serialVersionUID = 1L; - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) - throws ServletException, IOException { - - // Set the Connection header - resp.setHeader("Connection", "keep-alive"); - - // Set a status code that should force the connection to close - resp.setStatus(HttpServletResponse.SC_BAD_REQUEST); - } - } - - @Test public void testWithTEVoid() throws Exception { Tomcat tomcat = getTomcatInstance(); Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1599184&r1=1599183&r2=1599184&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Jun 2 12:23:49 2014 @@ -88,11 +88,6 @@ buffer when the buffer is only partially written on a subsequent write. (markt) </fix> - <fix> - <bug>56555</bug>: When Tomcat closes the connection based on the HTTP - status code of the response, ensure that only one connection header is - sent to the client. (markt) - </fix> </changelog> </subsection> <subsection name="Jasper"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org