mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Polish "Default use-relative-redirects to true"
See gh-51173 Signed-off-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
This commit is contained in:
+1
-2
@@ -56,7 +56,6 @@ import org.springframework.util.unit.DataSize;
|
||||
* @author Florian Storz
|
||||
* @author Michael Weidmann
|
||||
* @author Lasse Wulff
|
||||
* @author Tiziano Basile
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@ConfigurationProperties("server.tomcat")
|
||||
@@ -104,7 +103,7 @@ public class TomcatServerProperties {
|
||||
|
||||
/**
|
||||
* Whether HTTP 1.1 and later location headers generated by a call to sendRedirect
|
||||
* will use relative or absolute redirects. Has no effect on a reactive web server.
|
||||
* will use relative or absolute redirects.
|
||||
*/
|
||||
private boolean useRelativeRedirects = true;
|
||||
|
||||
|
||||
-1
@@ -29,7 +29,6 @@ import org.springframework.util.ObjectUtils;
|
||||
*
|
||||
* @author Brian Clozel
|
||||
* @author Phillip Webb
|
||||
* @author Tiziano Basile
|
||||
*/
|
||||
class TomcatServletWebServerFactoryCustomizer
|
||||
implements WebServerFactoryCustomizer<TomcatServletWebServerFactory>, Ordered {
|
||||
|
||||
+7
-2
@@ -74,7 +74,7 @@ class TomcatServerPropertiesTests {
|
||||
map.put("server.tomcat.background-processor-delay", "10");
|
||||
map.put("server.tomcat.relaxed-path-chars", "|,<");
|
||||
map.put("server.tomcat.relaxed-query-chars", "^ , | ");
|
||||
map.put("server.tomcat.use-relative-redirects", "true");
|
||||
map.put("server.tomcat.use-relative-redirects", "false");
|
||||
bind(map);
|
||||
Accesslog accesslog = this.properties.getAccesslog();
|
||||
assertThat(accesslog.getConditionIf()).isEqualTo("foo");
|
||||
@@ -96,7 +96,7 @@ class TomcatServerPropertiesTests {
|
||||
assertThat(this.properties.getBackgroundProcessorDelay()).hasSeconds(10);
|
||||
assertThat(this.properties.getRelaxedPathChars()).containsExactly('|', '<');
|
||||
assertThat(this.properties.getRelaxedQueryChars()).containsExactly('^', '|');
|
||||
assertThat(this.properties.isUseRelativeRedirects()).isTrue();
|
||||
assertThat(this.properties.isUseRelativeRedirects()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -240,6 +240,11 @@ class TomcatServerPropertiesTests {
|
||||
assertThat(this.properties.isUseRelativeRedirects()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void tomcatUseRelativeRedirectsMatchesDefault() {
|
||||
assertThat(this.properties.isUseRelativeRedirects()).isEqualTo(new StandardContext().getUseRelativeRedirects());
|
||||
}
|
||||
|
||||
@Test
|
||||
void tomcatMaxKeepAliveRequestsDefault() throws Exception {
|
||||
AbstractEndpoint<?, ?> endpoint = (AbstractEndpoint<?, ?>) ReflectionTestUtils.getField(getDefaultProtocol(),
|
||||
|
||||
Reference in New Issue
Block a user