388502 handle earlyEOF with 500
This commit is contained in:
parent
da82238d6b
commit
c3844a43c9
|
@ -497,6 +497,8 @@ public abstract class AbstractHttpConnection extends AbstractConnection
|
|||
LOG.debug(e);
|
||||
error=true;
|
||||
_request.setHandled(true);
|
||||
if (!_response.isCommitted())
|
||||
_generator.sendError(500, null, null, true);
|
||||
}
|
||||
catch (RuntimeIOException e)
|
||||
{
|
||||
|
@ -549,9 +551,8 @@ public abstract class AbstractHttpConnection extends AbstractConnection
|
|||
{
|
||||
if (error)
|
||||
{
|
||||
_generator.setPersistent(false);
|
||||
_generator.flushBuffer();
|
||||
_endp.shutdownOutput();
|
||||
_generator.setPersistent(false);
|
||||
if (!_generator.isComplete())
|
||||
_response.complete();
|
||||
}
|
||||
|
|
|
@ -226,7 +226,12 @@ public class SocketConnector extends AbstractConnector
|
|||
{
|
||||
int l = super.fill(buffer);
|
||||
if (l<0)
|
||||
close();
|
||||
{
|
||||
if (!isInputShutdown())
|
||||
shutdownInput();
|
||||
if (isOutputShutdown())
|
||||
close();
|
||||
}
|
||||
return l;
|
||||
}
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
String response = readResponse(client);
|
||||
client.close();
|
||||
|
||||
// assertThat("response contains 500", response.contains(" 500 "), is(true)); //TODO: check with gregw,
|
||||
assertThat("response contains 500", response, Matchers.containsString(" 500 "));
|
||||
assertThat("The 4th byte (-1) has not been passed to the handler", fourBytesRead.get(), is(false));
|
||||
assertThat("EofException has been caught", earlyEOFException.get(), is(true));
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
package org.eclipse.jetty.server;
|
||||
import org.eclipse.jetty.server.bio.SocketConnector;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* HttpServer Tester.
|
||||
|
@ -30,4 +32,5 @@ public class SocketServerTest extends HttpServerTestBase
|
|||
{
|
||||
startServer(new SocketConnector());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue