diff --git a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java index 4092f07fc2b..8b5682fd24e 100644 --- a/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java +++ b/jetty-http/src/main/java/org/eclipse/jetty/http/HttpParser.java @@ -173,7 +173,7 @@ public class HttpParser /* ------------------------------------------------------------ */ public boolean isComplete() { - return isState(State.END); + return isState(State.END)||isState(State.CLOSED); } /* ------------------------------------------------------------------------------- */ @@ -1084,7 +1084,7 @@ public class HttpParser } /* ------------------------------------------------------------------------------- */ - public boolean inputShutdown() throws IOException + public void inputShutdown() { _persistent=false; @@ -1108,10 +1108,6 @@ public class HttpParser LOG.debug("shutdownInput {}",this); - if (!isComplete() && !isStart()) - throw new EofException(); - - return true; } /* ------------------------------------------------------------------------------- */ diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java index ca239af2ef9..0f5a3f61bed 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java @@ -236,7 +236,14 @@ public class HttpConnection extends AbstractAsyncConnection if (filled==0) scheduleOnReadable(); else + { _parser.inputShutdown(); + // We were only filling if fully consumed, so if we have + // read -1 then we have nothing to parse and thus nothing that + // will generate a response. If we had a suspended request pending + // a response or a request waiting in the buffer, we would not be here. + getEndPoint().shutdownOutput(); + } // buffer must be empty and the channel must be idle, so we can release. releaseRequestBuffer(); @@ -283,10 +290,6 @@ public class HttpConnection extends AbstractAsyncConnection } finally { - // TODO this is wrong wrong wrong wrong! - if (_parser.isComplete()&&!_parser.isPersistent()&&getEndPoint().isOpen()) - getEndPoint().shutdownOutput(); - setCurrentConnection(null); } }