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 0b4053c15e3..f9c2ba9099d 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 @@ -1020,7 +1020,8 @@ public class HttpParser implements Parser // Are we full? if (_buffer.space() == 0) { - LOG.warn("Full {}",_buffer.toDetailString()); + LOG.warn("HttpParser Full for {} ",_endp); + _buffer.clear(); throw new HttpException(HttpStatus.REQUEST_ENTITY_TOO_LARGE_413, "FULL "+(_buffer==_body?"body":"head")); } diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java index 6a872a86f3e..c565ae4035e 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java @@ -107,6 +107,36 @@ public abstract class HttpServerTestBase extends HttpServerTestFixture + /* + * Feed a full header method + */ + @Test + public void testFull() throws Exception + { + configureServer(new HelloWorldHandler()); + + Socket client=newSocket(HOST,_connector.getLocalPort()); + try + { + OutputStream os=client.getOutputStream(); + + byte[] buffer = new byte[64*1024]; + Arrays.fill(buffer,(byte)'A'); + + os.write(buffer); + os.flush(); + + // Read the response. + String response=readResponse(client); + + Assert.assertTrue(response.contains("HTTP/1.1 413 FULL head")); + } + finally + { + client.close(); + } + } + /* diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSocketServerTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSocketServerTest.java index 4e9a717a3b4..313da1e3568 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSocketServerTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSocketServerTest.java @@ -14,6 +14,7 @@ package org.eclipse.jetty.server.ssl; import java.io.FileInputStream; import java.net.Socket; +import java.net.SocketException; import java.security.KeyStore; import javax.net.ssl.SSLContext; @@ -82,4 +83,17 @@ public class SslSocketServerTest extends HttpServerTestBase public void testAvailable() throws Exception { } + + @Override + public void testFull() throws Exception + { + try + { + super.testFull(); + } + catch(SocketException e) + { + // For SSL Sockets, the response is closed before the 400 is sent??? + } + } }