Aborting the response if the content length limit is reached.
This commit is contained in:
parent
97a2f3328f
commit
d6bd9df93a
|
@ -88,7 +88,7 @@ public abstract class BufferingResponseListener extends Response.Listener.Empty
|
||||||
{
|
{
|
||||||
long newLength = buffer.length + content.remaining();
|
long newLength = buffer.length + content.remaining();
|
||||||
if (newLength > maxLength)
|
if (newLength > maxLength)
|
||||||
throw new IllegalStateException("Buffering capacity exceeded");
|
response.abort(new IllegalArgumentException("Buffering capacity exceeded"));
|
||||||
|
|
||||||
byte[] newBuffer = new byte[(int)newLength];
|
byte[] newBuffer = new byte[(int)newLength];
|
||||||
System.arraycopy(buffer, 0, newBuffer, 0, buffer.length);
|
System.arraycopy(buffer, 0, newBuffer, 0, buffer.length);
|
||||||
|
|
Loading…
Reference in New Issue