Skip to content

Commit

Permalink
Merge pull request #622 from AndreKurait/IncreaseMaxRequestSize
Browse files Browse the repository at this point in the history
Increase default MAX_PAYLOAD_BYTES_TO_PRINT to 100MiB
  • Loading branch information
AndreKurait committed May 2, 2024
2 parents 4bfdb0f + cf3f0af commit 3e6b6c5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void addingCompressionRequestHeaderCompressesPayload() throws ExecutionEx

EmbeddedChannel channel = new EmbeddedChannel(
new HttpServerCodec(),
new HttpObjectAggregator(Utils.MAX_PAYLOAD_SIZE_TO_PRINT) // Set max content length if needed
new HttpObjectAggregator(Utils.MAX_PAYLOAD_BYTES_TO_PRINT) // Set max content length if needed
);

channel.writeInbound(Unpooled.wrappedBuffer(testPacketCapture.getBytesCaptured()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public static HttpMessage parseHttpMessageFromBufs(HttpMessageType msgType, Stre
EmbeddedChannel channel = new EmbeddedChannel(
msgType == HttpMessageType.REQUEST ? new HttpServerCodec() : new HttpClientCodec(),
new HttpContentDecompressor(),
new HttpObjectAggregator(Utils.MAX_PAYLOAD_SIZE_TO_PRINT) // Set max content length if needed
new HttpObjectAggregator(Utils.MAX_PAYLOAD_BYTES_TO_PRINT) // Set max content length if needed
);
try {
byteBufStream.forEachOrdered(b -> channel.writeInbound(b.retainedDuplicate()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public String format(Optional<HttpByteBufFormatter.HttpMessageType> messageTypeO
try (var bufStream = NettyUtils.createRefCntNeutralCloseableByteBufStream(packetBytes)) {
var packetBytesAsStr = messageTypeOp.map(mt-> HttpByteBufFormatter.httpPacketBytesToString(mt, packetBytes,
HttpByteBufFormatter.LF_LINE_DELIMITER))
.orElseGet(()-> HttpByteBufFormatter.httpPacketBufsToString(bufStream, Utils.MAX_PAYLOAD_SIZE_TO_PRINT));
.orElseGet(()-> HttpByteBufFormatter.httpPacketBufsToString(bufStream, Utils.MAX_PAYLOAD_BYTES_TO_PRINT));
final StringBuilder sb = new StringBuilder("HttpMessageAndTimestamp{");
sb.append("firstPacketTimestamp=").append(firstPacketTimestamp);
sb.append(", lastPacketTimestamp=").append(lastPacketTimestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@Slf4j
public class Utils {
public static final int MAX_BYTES_SHOWN_FOR_TO_STRING = 128;
public static final int MAX_PAYLOAD_SIZE_TO_PRINT = 1024 * 1024; // 1MB
public static final int MAX_PAYLOAD_BYTES_TO_PRINT = 100 * 1024 * 1024; // 100MiB based on https://docs.aws.amazon.com/opensearch-service/latest/developerguide/limits.html#network-limits

public static Instant setIfLater(AtomicReference<Instant> referenceValue, Instant pointInTime) {
return referenceValue.updateAndGet(existingInstant -> existingInstant.isBefore(pointInTime) ?
Expand Down

0 comments on commit 3e6b6c5

Please sign in to comment.