File tree 2 files changed +4
-2
lines changed
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/netty/pipeline
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 41
41
import io .netty .channel .ChannelInboundHandlerAdapter ;
42
42
import io .netty .channel .ChannelOption ;
43
43
import io .netty .channel .ChannelPipeline ;
44
+ import io .netty .channel .FixedRecvByteBufAllocator ;
44
45
import io .netty .channel .RecvByteBufAllocator ;
45
46
import io .netty .channel .SimpleChannelInboundHandler ;
46
47
import io .netty .channel .ChannelHandler .Sharable ;
@@ -116,7 +117,7 @@ protected void initChannel(Channel channel) throws Exception {
116
117
channel .attr (NettyHttpConstants .IS_OUTBOUND_KEY ).set (false );
117
118
channel .attr (NettyHttpConstants .ENDPOINT_PID ).set (chain .getEndpointPID ());
118
119
119
- RecvByteBufAllocator channelAllocator = channel . config (). getRecvByteBufAllocator ( );
120
+ FixedRecvByteBufAllocator channelAllocator = new FixedRecvByteBufAllocator ( httpConfig . getIncomingBodyBufferSize () );
120
121
LoggingRecvByteBufAllocator loggingAllocator = new LoggingRecvByteBufAllocator (channelAllocator );
121
122
channel .config ().setRecvByteBufAllocator (loggingAllocator );
122
123
Original file line number Diff line number Diff line change @@ -172,7 +172,8 @@ public Collection<CharSequence> requiredUpgradeHeaders() {
172
172
173
173
HttpToHttp2ConnectionHandler buildHttp2ConnectionHandler (HttpChannelConfig httpConfig , Channel channel ) {
174
174
DefaultHttp2Connection connection = new DefaultHttp2Connection (true );
175
- int maxContentlength = (int ) httpConfig .getMessageSizeLimit ();
175
+ // Netty accepts integer for max length so we would need to adapt for this
176
+ int maxContentlength = httpConfig .getMessageSizeLimit () >= Integer .MAX_VALUE ? Integer .MAX_VALUE : (int ) httpConfig .getMessageSizeLimit ();
176
177
InboundHttp2ToHttpAdapterBuilder builder = new InboundHttp2ToHttpAdapterBuilder (connection ).propagateSettings (false ).validateHttpHeaders (false );
177
178
if (maxContentlength > 0 )
178
179
builder .maxContentLength (maxContentlength );
You can’t perform that action at this time.
0 commit comments