Guarded completion of the AsyncContext to avoid IllegalStateExceptions.

This commit is contained in:
Simone Bordet 2017-01-03 10:58:50 +01:00
parent bf80d822c0
commit 058e4658e4
1 changed files with 6 additions and 4 deletions

View File

@ -18,7 +18,6 @@
package org.eclipse.jetty.proxy;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URI;
import java.net.UnknownHostException;
@ -633,10 +632,13 @@ public abstract class AbstractProxyServlet extends HttpServlet
{
// Use Jetty specific behavior to close connection.
proxyResponse.sendError(-1);
AsyncContext asyncContext = clientRequest.getAsyncContext();
asyncContext.complete();
if (clientRequest.isAsyncStarted())
{
AsyncContext asyncContext = clientRequest.getAsyncContext();
asyncContext.complete();
}
}
catch (IOException x)
catch (Throwable x)
{
if (_log.isDebugEnabled())
_log.debug(getRequestId(clientRequest) + " could not close the connection", failure);