diff --git a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/ReactorNettyClient.java b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/ReactorNettyClient.java index dd70ae57ea0e..700cb6cbe7d8 100644 --- a/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/ReactorNettyClient.java +++ b/sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/http/ReactorNettyClient.java @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.cosmos.implementation.http; +import com.azure.cosmos.implementation.Configs; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelOption; @@ -63,6 +64,7 @@ public static ReactorNettyClient createWithConnectionProvider(ConnectionProvider } private void configureChannelPipelineHandlers() { + Configs configs = this.httpClientConfig.getConfigs(); this.httpClient = this.httpClient.tcpConfiguration(tcpClient -> { if (this.httpClientConfig.getProxy() != null) { @@ -70,15 +72,21 @@ private void configureChannelPipelineHandlers() { tcpClient.proxy(typeSpec -> typeSpec.type(ProxyProvider.Proxy.HTTP).address(this.httpClientConfig.getProxy())); } tcpClient = - tcpClient.secure(sslContextSpec -> sslContextSpec.sslContext(this.httpClientConfig.getConfigs().getSslContext())); + tcpClient.secure(sslContextSpec -> sslContextSpec.sslContext(configs.getSslContext())); if (LoggerFactory.getLogger(REACTOR_NETWORK_LOG_CATEGORY).isTraceEnabled()) { tcpClient = tcpClient.wiretap(REACTOR_NETWORK_LOG_CATEGORY, LogLevel.INFO); } // By default, keep alive is enabled on http client tcpClient = tcpClient.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, - httpClientConfig.getConfigs().getConnectionAcquireTimeoutInMillis()); + configs.getConnectionAcquireTimeoutInMillis()); return tcpClient; + }).httpResponseDecoder(httpResponseDecoderSpec -> { + httpResponseDecoderSpec.maxInitialLineLength(configs.getMaxHttpInitialLineLength()); + httpResponseDecoderSpec.maxHeaderSize(configs.getMaxHttpHeaderSize()); + httpResponseDecoderSpec.maxChunkSize(configs.getMaxHttpChunkSize()); + httpResponseDecoderSpec.validateHeaders(true); + return httpResponseDecoderSpec; }); }