Merge branch '2.1.x'

This commit is contained in:
Spencer Gibb
2020-01-14 13:55:26 -05:00
2 changed files with 23 additions and 1 deletions

View File

@@ -599,7 +599,14 @@ public class GatewayAutoConfiguration {
}
HttpClient httpClient = HttpClient.create(connectionProvider)
.tcpConfiguration(tcpClient -> {
.httpResponseDecoder(spec -> {
if (properties.getMaxHeaderSize() != null) {
// cast to int is ok, since @Max is Integer.MAX_VALUE
spec.maxHeaderSize(
(int) properties.getMaxHeaderSize().toBytes());
}
return spec;
}).tcpConfiguration(tcpClient -> {
if (properties.getConnectTimeout() != null) {
tcpClient = tcpClient.option(

View File

@@ -31,6 +31,7 @@ import java.util.Collection;
import java.util.List;
import javax.net.ssl.KeyManagerFactory;
import javax.validation.constraints.Max;
import reactor.netty.resources.ConnectionProvider;
import reactor.netty.tcp.SslProvider;
@@ -40,6 +41,7 @@ import org.springframework.boot.context.properties.DeprecatedConfigurationProper
import org.springframework.boot.web.server.WebServerException;
import org.springframework.core.style.ToStringCreator;
import org.springframework.util.ResourceUtils;
import org.springframework.util.unit.DataSize;
/**
* Configuration properties for the Netty {@link reactor.netty.http.client.HttpClient}.
@@ -53,6 +55,9 @@ public class HttpClientProperties {
/** The response timeout. */
private Duration responseTimeout;
/** The max response header size. */
private DataSize maxHeaderSize;
/** Pool configuration for Netty HttpClient. */
private Pool pool = new Pool();
@@ -84,6 +89,15 @@ public class HttpClientProperties {
this.responseTimeout = responseTimeout;
}
@Max(Integer.MAX_VALUE)
public DataSize getMaxHeaderSize() {
return maxHeaderSize;
}
public void setMaxHeaderSize(DataSize maxHeaderSize) {
this.maxHeaderSize = maxHeaderSize;
}
public Pool getPool() {
return pool;
}
@@ -130,6 +144,7 @@ public class HttpClientProperties {
return new ToStringCreator(this)
.append("connectTimeout", connectTimeout)
.append("responseTimeout", responseTimeout)
.append("maxHeaderSize", maxHeaderSize)
.append("pool", pool)
.append("proxy", proxy)
.append("ssl", ssl)