From 5bde7f34ea4c538d12adc6c19794b089c768101e Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 22 May 2015 09:54:27 +1000 Subject: [PATCH] 467936 -w Check HttpOutput aggregateSize is < bufferSize --- .../src/main/java/org/eclipse/jetty/server/HttpOutput.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 c148cdf29c9..ddae39cbf74 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 @@ -90,6 +90,11 @@ public class HttpOutput extends ServletOutputStream implements Runnable HttpConfiguration config = channel.getHttpConfiguration(); _bufferSize = config.getOutputBufferSize(); _commitSize = config.getOutputAggregationSize(); + if (_commitSize>_bufferSize) + { + LOG.warn("OutputAggregationSize {} exceeds bufferSize {}",_commitSize,_bufferSize); + _commitSize=_bufferSize; + } } public HttpChannel getHttpChannel() @@ -350,7 +355,7 @@ public class HttpOutput extends ServletOutputStream implements Runnable write(_aggregate, complete && len==0); // should we fill aggregate again from the buffer? - if (len>0 && !complete && len<=_commitSize) + if (len>0 && !complete && len<=_commitSize && len<=BufferUtil.space(_aggregate)) { BufferUtil.append(_aggregate, b, off, len); return;