331461 Fixed idle timeout for unflushed HTTP/1.0

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2574 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2010-12-02 14:36:13 +00:00
parent e4f078cec6
commit 793a646e91
5 changed files with 36 additions and 6 deletions

View File

@ -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

View File

@ -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();
}
}
/* ------------------------------------------------------------ */

View File

@ -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

View File

@ -112,6 +112,7 @@ public class SelectChannelConnector extends AbstractNIOConnector
*/
public SelectChannelConnector()
{
_manager.setMaxIdleTime(getMaxIdleTime());
}
/* ------------------------------------------------------------ */

View File

@ -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());