Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class TlsConfiguration extends Configuration
public static final LongPropertyDef TLS_AWAIT_SYNC_CLOSE_MILLIS;
public static final BooleanPropertyDef TLS_PROACTIVE_CLIENT_REPLY_BEGIN;
public static final BooleanPropertyDef TLS_CLIENT_HTTPS_IDENTIFICATION;
public static final BooleanPropertyDef TLS_CLIENT_SERVER_NAME_INDICATION;
public static final BooleanPropertyDef TLS_VERBOSE;
public static final BooleanPropertyDef TLS_DEBUG;

Expand All @@ -42,6 +43,7 @@ public class TlsConfiguration extends Configuration
TLS_AWAIT_SYNC_CLOSE_MILLIS = config.property("await.sync.close.millis", 3000L);
TLS_PROACTIVE_CLIENT_REPLY_BEGIN = config.property("proactive.client.reply.begin", false);
TLS_CLIENT_HTTPS_IDENTIFICATION = config.property("client.https.identification", true);
TLS_CLIENT_SERVER_NAME_INDICATION = config.property("client.server.name.indication", true);
TLS_VERBOSE = config.property("verbose", TlsConfiguration::verboseDefault);
TLS_DEBUG = config.property("debug", TlsConfiguration::debugDefault);
TLS_CONFIG = config;
Expand Down Expand Up @@ -83,6 +85,11 @@ public boolean clientHttpsIdentification()
return TLS_CLIENT_HTTPS_IDENTIFICATION.getAsBoolean(this);
}

public boolean clientServerNameIndication()
{
return TLS_CLIENT_SERVER_NAME_INDICATION.getAsBoolean(this);
}

public boolean verbose()
{
return TLS_VERBOSE.getAsBoolean(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public final class TlsBindingConfig
private SSLContext context;

private boolean clientHttpsIdentification;
private boolean clientServerNameIndication;

public TlsBindingConfig(
BindingConfig binding)
Expand Down Expand Up @@ -126,6 +127,7 @@ public void init(

this.context = context;
this.clientHttpsIdentification = config.clientHttpsIdentification();
this.clientServerNameIndication = config.clientServerNameIndication();
}
catch (Exception ex)
{
Expand Down Expand Up @@ -240,9 +242,10 @@ public SSLEngine newClientEngine(
parameters.setEndpointIdentificationAlgorithm("HTTPS");
}

if (sni != null)
if (clientServerNameIndication && sni != null)
{
List<SNIServerName> serverNames = sni.stream()
.map(TlsBindingConfig::trimHostnameTrailingDot)
.map(SNIHostName::new)
.collect(toList());
parameters.setServerNames(serverNames);
Expand Down Expand Up @@ -496,4 +499,10 @@ private List<String> ignoreEmptyNames(

return names;
}

private static String trimHostnameTrailingDot(
String hostname)
{
return hostname.endsWith(".") ? hostname.substring(0, hostname.length() - 1) : hostname;
}
}
Loading