Skip to content

Commit

Permalink
[BugFix] Fix http server direct buffer leak for request body (backport
Browse files Browse the repository at this point in the history
…#49395) (#49628)

Signed-off-by: gengjun-git <[email protected]>
Co-authored-by: gengjun-git <[email protected]>
  • Loading branch information
mergify[bot] and gengjun-git authored Aug 9, 2024
1 parent 0207e3c commit 6d1e2a5
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ public void channelReadComplete(ChannelHandlerContext ctx) {

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
if (msg instanceof HttpRequest) {
try {
if (!(msg instanceof HttpRequest)) {
return;
}

this.request = (HttpRequest) msg;
if (LOG.isDebugEnabled()) {
LOG.debug("request: url:[{}]", request.uri());
Expand Down Expand Up @@ -91,7 +95,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
req.getRequest().uri(), Thread.currentThread().getId(), startTime, latency);
}
}
} else {
} finally {
ReferenceCountUtil.release(msg);
}
}
Expand Down

0 comments on commit 6d1e2a5

Please sign in to comment.