Skip to content

Commit 6261106

Browse files
mp911debclozel
authored andcommitted
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
1 parent 3a29daa commit 6261106

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-web/src/main/java/org/springframework/http/client/Netty4ClientHttpRequestFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
* @author Arjen Poutsma
5252
* @author Rossen Stoyanchev
5353
* @author Brian Clozel
54+
* @author Mark Paluch
5455
* @since 4.1.2
5556
*/
5657
public class Netty4ClientHttpRequestFactory implements ClientHttpRequestFactory,
@@ -174,8 +175,7 @@ private Netty4ClientHttpRequest createRequestInternal(URI uri, HttpMethod httpMe
174175
}
175176

176177
private Bootstrap getBootstrap(URI uri) {
177-
boolean isSecure = (uri.getPort() == 443 ||
178-
(uri.getPort() == -1 && "https".equalsIgnoreCase(uri.getScheme())));
178+
boolean isSecure = (uri.getPort() == 443 || "https".equalsIgnoreCase(uri.getScheme()));
179179
if (isSecure) {
180180
if (this.sslBootstrap == null) {
181181
this.sslBootstrap = buildBootstrap(true);

0 commit comments

Comments
 (0)