Skip to content

Commit

Permalink
Issue #10337 - fixes to SizeLimitHandler
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
  • Loading branch information
lachlan-roberts committed Aug 18, 2023
1 parent d4d8832 commit 0c4f879
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import org.eclipse.jetty.server.HttpOutput;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;

/**
* <p>A handler that can limit the size of message bodies in requests and responses.</p>
Expand All @@ -46,8 +44,6 @@
*/
public class SizeLimitHandler extends HandlerWrapper
{
private static final Logger LOG = Log.getLogger(SizeLimitHandler.class);

private final long _requestLimit;
private final long _responseLimit;

Expand Down Expand Up @@ -90,7 +86,7 @@ public void handle(String target, Request baseRequest, HttpServletRequest reques
baseRequest.getHttpInput().addInterceptor(limit);
}

if (_responseLimit > 0)
if (_responseLimit >= 0)
{
httpOutput.setInterceptor(limit);
response = new LimitResponse(response);
Expand Down Expand Up @@ -132,7 +128,7 @@ public HttpInput.Content readFrom(HttpInput.Content content)
if (content.hasContent())
{
_read += content.remaining();
checkResponseLimit(_read);
checkRequestLimit(_read);
}
return content;
}
Expand Down

0 comments on commit 0c4f879

Please sign in to comment.