Skip to content

Commit

Permalink
Merge pull request spring-projects#8829 from stefan-huettemann:spring…
Browse files Browse the repository at this point in the history
…-projectsgh-8508

* pr/8829:
  Allow to disable max http post size limit
  • Loading branch information
snicoll committed Apr 10, 2017
2 parents 492aee9 + 0294ad3 commit 3c28687
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -790,7 +790,7 @@ void customizeTomcat(ServerProperties serverProperties,
if (maxHttpHeaderSize > 0) {
customizeMaxHttpHeaderSize(factory, maxHttpHeaderSize);
}
if (serverProperties.getMaxHttpPostSize() > 0) {
if (serverProperties.getMaxHttpPostSize() != 0) {
customizeMaxHttpPostSize(factory, serverProperties.getMaxHttpPostSize());
}
if (this.accesslog.enabled) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -445,6 +445,25 @@ public void customTomcatRemoteIpValve() throws Exception {
assertThat(remoteIpValve.getInternalProxies()).isEqualTo("192.168.0.1");
}

@Test
public void customTomcatDisableMaxHttpPostSize() {
Map<String, String> map = new HashMap<String, String>();
map.put("server.max-http-post-size", "-1");
bindProperties(map);
TomcatEmbeddedServletContainerFactory container = new TomcatEmbeddedServletContainerFactory(0);
this.properties.customize(container);
TomcatEmbeddedServletContainer embeddedContainer =
(TomcatEmbeddedServletContainer) container.getEmbeddedServletContainer();
embeddedContainer.start();
try {
assertThat(embeddedContainer.getTomcat().getConnector().getMaxPostSize())
.isEqualTo(-1);
}
finally {
embeddedContainer.stop();
}
}

@Test
public void defaultUseForwardHeadersUndertow() throws Exception {
UndertowEmbeddedServletContainerFactory container = spy(
Expand Down

0 comments on commit 3c28687

Please sign in to comment.