diff --git a/VERSION.txt b/VERSION.txt index 3466aebd0ff..69fcb44d8ec 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1,6 +1,7 @@ + 331567 IPAccessHandlerTest failed on MacOS fix + 328789 Clean up tmp files from test harnesses + 331230 Fixed low thread warnings when acceptors>threadpool + + 331461 Fixed idle timeout for unflushed HTTP/1.0 jetty-7.2.2.v20101201 1 December 2010 + 330210 Improve performance of writing large bytes arrays diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java index 14e2ffd5372..ced46568bb8 100644 --- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java +++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java @@ -232,9 +232,7 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo public void checkIdleTimestamp(long now) { if (_idleTimestamp!=0 && _maxIdleTime!=0 && now>(_idleTimestamp+_maxIdleTime)) - { idleExpired(); - } } /* ------------------------------------------------------------ */ diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java index 98ffca67e09..f659d0258e0 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java @@ -665,9 +665,6 @@ public class HttpConnection implements Connection if(_endp.isOpen()) { - if (_generator.isPersistent()) - _connector.persist(_endp); - if (error) _endp.close(); else @@ -675,6 +672,8 @@ public class HttpConnection implements Connection if (!_response.isCommitted() && !_request.isHandled()) _response.sendError(HttpServletResponse.SC_NOT_FOUND); _response.complete(); + if (_generator.isPersistent()) + _connector.persist(_endp); } } else diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java index ba0e3e99c2e..173b7bef905 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java @@ -112,6 +112,7 @@ public class SelectChannelConnector extends AbstractNIOConnector */ public SelectChannelConnector() { + _manager.setMaxIdleTime(getMaxIdleTime()); } /* ------------------------------------------------------------ */ diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java index e5bb109b8f9..61d045acf73 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorTimeoutTest.java @@ -37,7 +37,38 @@ public abstract class ConnectorTimeoutTest extends HttpServerTestFixture @Test - public void testSelectConnectorMaxIdleWithRequest() throws Exception + public void testSelectConnectorMaxIdleWithRequest10() throws Exception + { + configureServer(new HelloWorldHandler()); + Socket client=newSocket(HOST,_connector.getLocalPort()); + client.setSoTimeout(10000); + + assertFalse(client.isClosed()); + + OutputStream os=client.getOutputStream(); + InputStream is=client.getInputStream(); + + String content="Wibble"; + byte[] contentB=content.getBytes("utf-8"); + os.write(( + "GET / HTTP/1.0\r\n"+ + "host: "+HOST+":"+_connector.getLocalPort()+"\r\n"+ + "connection: keep-alive\r\n"+ + "\r\n").getBytes("utf-8")); + os.flush(); + + long start = System.currentTimeMillis(); + String in = IO.toString(is); + + Thread.sleep(300); + assertEquals(-1, is.read()); + + Assert.assertTrue(System.currentTimeMillis()-start>200); + Assert.assertTrue(System.currentTimeMillis()-start<5000); + } + + @Test + public void testSelectConnectorMaxIdleWithRequest11() throws Exception { configureServer(new EchoHandler()); Socket client=newSocket(HOST,_connector.getLocalPort());