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
This commit is contained in:
Mark Paluch 2016-11-09 13:36:32 +01:00 committed by Brian Clozel
parent 3a29daac45
commit 6261106a93
1 changed files with 2 additions and 2 deletions

View File

@ -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);