From: markt Date: Tue, 23 Aug 2011 16:22:03 +0000 (+0000) Subject: Add the ability to swallow input by specifying a null chunk X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3f4a069c0e60aacbe61dc7e4fc8a503479a5fec7;p=tomcat7.0 Add the ability to swallow input by specifying a null chunk git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1160776 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/coyote/ajp/AbstractAjpProcessor.java b/java/org/apache/coyote/ajp/AbstractAjpProcessor.java index 799509e4a..bc2e58a0e 100644 --- a/java/org/apache/coyote/ajp/AbstractAjpProcessor.java +++ b/java/org/apache/coyote/ajp/AbstractAjpProcessor.java @@ -1010,9 +1010,9 @@ public abstract class AbstractAjpProcessor extends AbstractProcessor { */ protected class SocketInputBuffer implements InputBuffer { - /** - * Read bytes into the specified chunk. + * Read bytes into the specified chunk. If no chunk is specified, the + * bytes are swallowed. */ @Override public int doRead(ByteChunk chunk, Request req) @@ -1033,7 +1033,9 @@ public abstract class AbstractAjpProcessor extends AbstractProcessor { } ByteChunk bc = bodyBytes.getByteChunk(); bodyBytesRead += bc.getLength(); - chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength()); + if (chunk != null) { + chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength()); + } empty = true; return bc.getLength(); }