Removed reliance on exception to shutdown non persistent connections (#12213)
Moved the shutdownOutput in HttpStreamOverHttp1 to before the continuation of handling
This commit is contained in:
parent
1726c8778c
commit
ebc5e559f8
|
@ -371,11 +371,11 @@ public class HttpConnection extends AbstractMetaDataConnection implements Runnab
|
|||
{
|
||||
while (getEndPoint().isOpen())
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onFillable fill and parse {} {} {}", this, _httpChannel, _retainableByteBuffer);
|
||||
|
||||
// Fill the request buffer (if needed).
|
||||
int filled = fillRequestBuffer();
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("onFillable filled {} {} {} {}", filled, this, _httpChannel, _retainableByteBuffer);
|
||||
|
||||
if (filled < 0 && getEndPoint().isOutputShutdown())
|
||||
close();
|
||||
|
||||
|
@ -1523,12 +1523,17 @@ public class HttpConnection extends AbstractMetaDataConnection implements Runnab
|
|||
return;
|
||||
}
|
||||
|
||||
// As this is not an upgrade, we can shutdown the output if we know we are not persistent
|
||||
if (_sendCallback._shutdownOut)
|
||||
getEndPoint().shutdownOutput();
|
||||
|
||||
_httpChannel.recycle();
|
||||
|
||||
|
||||
// If a 100 Continue is still expected to be sent, but no content was read, then
|
||||
// close the parser so that seeks EOF below, not the next request.
|
||||
if (_expects100Continue)
|
||||
{
|
||||
// No content was read, and no 100 Continue response was sent.
|
||||
// Close the parser so that below it seeks EOF, not the next request.
|
||||
_expects100Continue = false;
|
||||
_parser.close();
|
||||
}
|
||||
|
@ -1541,7 +1546,6 @@ public class HttpConnection extends AbstractMetaDataConnection implements Runnab
|
|||
else
|
||||
_parser.close();
|
||||
}
|
||||
|
||||
_generator.reset();
|
||||
|
||||
// Can the onFillable thread continue processing
|
||||
|
@ -1552,9 +1556,6 @@ public class HttpConnection extends AbstractMetaDataConnection implements Runnab
|
|||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("non-current completion {}", this);
|
||||
|
||||
if (_sendCallback._shutdownOut)
|
||||
getEndPoint().shutdownOutput();
|
||||
|
||||
// If we are looking for the next request
|
||||
if (_parser.isStart())
|
||||
{
|
||||
|
|
|
@ -200,7 +200,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
}
|
||||
});
|
||||
|
||||
try (Socket client = newSocket(_serverURI.getHost(), _serverURI.getPort()))
|
||||
try (StacklessLogging ignored = new StacklessLogging(Response.class); Socket client = newSocket(_serverURI.getHost(), _serverURI.getPort()))
|
||||
{
|
||||
OutputStream os = client.getOutputStream();
|
||||
|
||||
|
@ -233,7 +233,7 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
}
|
||||
});
|
||||
|
||||
try (Socket client = newSocket(_serverURI.getHost(), _serverURI.getPort()))
|
||||
try (StacklessLogging ignored = new StacklessLogging(Response.class); Socket client = newSocket(_serverURI.getHost(), _serverURI.getPort()))
|
||||
{
|
||||
OutputStream os = client.getOutputStream();
|
||||
|
||||
|
@ -1669,12 +1669,10 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
|
||||
|
||||
String line = in.readLine();
|
||||
System.err.println(line);
|
||||
assertThat(line, containsString(" 304 "));
|
||||
while (true)
|
||||
{
|
||||
line = in.readLine();
|
||||
System.err.println(line);
|
||||
if (line == null)
|
||||
throw new EOFException();
|
||||
if (line.length() == 0)
|
||||
|
@ -1685,7 +1683,6 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture
|
|||
assertThat(line, not(containsString("Transfer-Encoding")));
|
||||
}
|
||||
|
||||
System.err.println("---");
|
||||
line = in.readLine();
|
||||
assertThat(line, containsString(" 304 "));
|
||||
while (true)
|
||||
|
|
Loading…
Reference in New Issue