From 3f4a069c0e60aacbe61dc7e4fc8a503479a5fec7 Mon Sep 17 00:00:00 2001 From: markt Date: Tue, 23 Aug 2011 16:22:03 +0000 Subject: [PATCH] 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 --- java/org/apache/coyote/ajp/AbstractAjpProcessor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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(); } -- 2.11.0