From 6261106a93099d714fd38f0b7007f0a40a662170 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 9 Nov 2016 13:36:32 +0100 Subject: [PATCH] Fix TLS detection in URLs for Netty Client RequestFactory Do not check on non-specified port when scheme is https. Enables SSL for https URIs with a specified port. Issue: SPR-14889 --- .../http/client/Netty4ClientHttpRequestFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-web/src/main/java/org/springframework/http/client/Netty4ClientHttpRequestFactory.java b/spring-web/src/main/java/org/springframework/http/client/Netty4ClientHttpRequestFactory.java index 9e3e2320a3..33456ef938 100644 --- a/spring-web/src/main/java/org/springframework/http/client/Netty4ClientHttpRequestFactory.java +++ b/spring-web/src/main/java/org/springframework/http/client/Netty4ClientHttpRequestFactory.java @@ -51,6 +51,7 @@ import org.springframework.util.Assert; * @author Arjen Poutsma * @author Rossen Stoyanchev * @author Brian Clozel + * @author Mark Paluch * @since 4.1.2 */ public class Netty4ClientHttpRequestFactory implements ClientHttpRequestFactory, @@ -174,8 +175,7 @@ public class Netty4ClientHttpRequestFactory implements ClientHttpRequestFactory, } private Bootstrap getBootstrap(URI uri) { - boolean isSecure = (uri.getPort() == 443 || - (uri.getPort() == -1 && "https".equalsIgnoreCase(uri.getScheme()))); + boolean isSecure = (uri.getPort() == 443 || "https".equalsIgnoreCase(uri.getScheme())); if (isSecure) { if (this.sslBootstrap == null) { this.sslBootstrap = buildBootstrap(true);