From 4b88e9dbbd90b2819c508d47b88bfaf0f8fc2a6a Mon Sep 17 00:00:00 2001 From: sopguo Date: Wed, 25 Sep 2024 20:25:08 -0700 Subject: [PATCH] Fix a bug for 100-continue (#2902) Co-authored-by: Sophie Guo --- .../java/com/github/ambry/rest/NettyMessageProcessor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ambry-rest/src/main/java/com/github/ambry/rest/NettyMessageProcessor.java b/ambry-rest/src/main/java/com/github/ambry/rest/NettyMessageProcessor.java index dc71e12d3f..39cfb1a8b7 100644 --- a/ambry-rest/src/main/java/com/github/ambry/rest/NettyMessageProcessor.java +++ b/ambry-rest/src/main/java/com/github/ambry/rest/NettyMessageProcessor.java @@ -376,11 +376,13 @@ private boolean handleContent(HttpContent httpContent) throws RestServiceExcepti nettyMetrics.requestChunkProcessingTimeInMs.update(chunkProcessingTime); request.getMetricsTracker().nioMetricsTracker.addToRequestProcessingTime(chunkProcessingTime); } - boolean isPutOrPost = request.getRestMethod().equals(RestMethod.POST) || request.getRestMethod().equals(RestMethod.PUT); + boolean isPutOrPost = + request.getRestMethod().equals(RestMethod.POST) || request.getRestMethod().equals(RestMethod.PUT); boolean isMultipart = request.isMultipart() && requestContentFullyReceived; - boolean hasContinueAndIsPutOrPost = RestUtils.isPutOrPostS3RequestAndExpectContinue(request); + boolean hasContinueAndIsPutOrPost = + nettyConfig.nettyEnableOneHundredContinue && RestUtils.isPutOrPostS3RequestAndExpectContinue(request); if (success && (!isPutOrPost || isMultipart || hasContinueAndIsPutOrPost)) { - if (nettyConfig.nettyEnableOneHundredContinue && hasContinueAndIsPutOrPost) { + if (hasContinueAndIsPutOrPost) { request.setArg(EXPECT, ""); removeInternalKeyFromRequest(); responseChannel = new NettyResponseChannel(ctx, nettyMetrics, performanceConfig, nettyConfig);