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 4f2c5e8f6ee..af2091f98c3 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 @@ -938,7 +938,7 @@ public class HttpParser Thread.sleep(100); String chars = BufferUtil.toDetailString(buffer); BufferUtil.clear(buffer); - throw new IllegalStateException(String.format("%s %d/%d data when CLOSED:%s",this,len,_headerBytes,chars)); + throw new IllegalStateException(String.format("%s %d/%d>%d data when CLOSED:%s",this,len,_headerBytes,_maxHeaderBytes,chars)); } BufferUtil.clear(buffer); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java index 24536935237..fb39ff107c9 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java @@ -577,6 +577,14 @@ public class HttpChannel implements HttpParser.RequestHandler, Runnable if (info.getStatus() < 200) _committed.set(false); } + catch (EofException e) + { + LOG.debug(e); + // TODO is it worthwhile sending if we are at EoF? + // "application" info failed to commit, commit with a failsafe 500 info + _transport.send(HttpGenerator.RESPONSE_500_INFO,null,true); + throw e; + } catch (Exception e) { LOG.warn(e); diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java index 631a09ddbd5..c7d41524505 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java @@ -114,7 +114,7 @@ public class HttpOutput extends ServletOutputStream _channel.write(BufferUtil.EMPTY_BUFFER, false); } - public boolean checkAllWritten() + public boolean checkAllWritten() throws IOException { return _channel.getResponse().checkAllContentWritten(_written); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java index ee666387f80..b356a80c0bf 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Response.java @@ -702,28 +702,30 @@ public class Response implements HttpServletResponse _fields.putLongField(HttpHeader.CONTENT_LENGTH.toString(), len); if (_contentLength > 0) - checkAllContentWritten(written); - } - - public boolean checkAllContentWritten(long written) - { - if (_contentLength >= 0 && written >= _contentLength) { try { - switch (_outputType) - { - case WRITER: - _writer.close(); - break; - case STREAM: - getOutputStream().close(); - } + checkAllContentWritten(written); } - catch (IOException e) + catch(IOException e) { throw new RuntimeIOException(e); } + } + } + + public boolean checkAllContentWritten(long written) throws IOException + { + if (_contentLength >= 0 && written >= _contentLength) + { + switch (_outputType) + { + case WRITER: + _writer.close(); + break; + case STREAM: + getOutputStream().close(); + } return true; } return false;