jetty-9 more commit fixes

This commit is contained in:
Greg Wilkins 2012-08-16 15:25:08 +10:00
parent ff76201050
commit 6d2da78aac
4 changed files with 11 additions and 19 deletions

View File

@ -1132,7 +1132,6 @@ public class HttpParser
} }
LOG.debug("shutdownInput {}",this); LOG.debug("shutdownInput {}",this);
} }
/* ------------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------------- */

View File

@ -185,13 +185,6 @@ public class HttpConnection extends AbstractConnection
} }
} }
@Override
public void fillInterested()
{
// new Throwable().printStackTrace();
super.fillInterested();
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
/** Parse and handle HTTP messages. /** Parse and handle HTTP messages.
* <p> * <p>
@ -215,9 +208,6 @@ public class HttpConnection extends AbstractConnection
// TODO try to generalize this loop into AbstractConnection // TODO try to generalize this loop into AbstractConnection
while (true) while (true)
{ {
// synchronized (_lock)
{
// Fill the request buffer with data only if it is totally empty. // Fill the request buffer with data only if it is totally empty.
if (BufferUtil.isEmpty(_requestBuffer)) if (BufferUtil.isEmpty(_requestBuffer))
{ {
@ -289,7 +279,6 @@ public class HttpConnection extends AbstractConnection
_channel.getEventHandler().badMessage(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413,null); _channel.getEventHandler().badMessage(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413,null);
} }
} }
}
} }
catch(IOException e) catch(IOException e)
{ {
@ -414,9 +403,6 @@ public class HttpConnection extends AbstractConnection
BufferUtil.clear(_responseBuffer); BufferUtil.clear(_responseBuffer);
getEndPoint().shutdownOutput(); getEndPoint().shutdownOutput();
_generator.abort(); _generator.abort();
// set fill interested so we seek the real close
fillInterested();
return false; return false;
} }
return true; return true;
@ -434,7 +420,6 @@ public class HttpConnection extends AbstractConnection
LOG.debug("{} completed"); LOG.debug("{} completed");
// Handle connection upgrades // Handle connection upgrades
if (getResponse().getStatus()==HttpStatus.SWITCHING_PROTOCOLS_101) if (getResponse().getStatus()==HttpStatus.SWITCHING_PROTOCOLS_101)
{ {
@ -490,6 +475,12 @@ public class HttpConnection extends AbstractConnection
getEndPoint().shutdownOutput(); getEndPoint().shutdownOutput();
} }
} }
// make sure that an oshut connection is driven towards close
// TODO this is a little ugly
if (getEndPoint().isOpen() && getEndPoint().isOutputShutdown())
fillInterested();
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */

View File

@ -1037,8 +1037,9 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
assertTrue(in.indexOf("\r\n0\r\n")==-1); // chunking is interrupted by error close assertTrue(in.indexOf("\r\n0\r\n")==-1); // chunking is interrupted by error close
client.close(); client.close();
Thread.sleep(100); Thread.sleep(200);
System.err.println(handler._endp);
// TODO this sometimes fails for SSL ???
assertTrue(!handler._endp.isOpen()); assertTrue(!handler._endp.isOpen());
} }
finally finally

View File

@ -651,6 +651,7 @@ public class ResponseTest
private Response newResponse() private Response newResponse()
{ {
_channel.getOutputStream().reset();
Response response = new Response(_channel); Response response = new Response(_channel);
return response; return response;
} }