Skip to content

Commit

Permalink
make https protocol and provider as configuration, fix issue airlift#999
Browse files Browse the repository at this point in the history
  • Loading branch information
Heyuan Liu committed Jul 21, 2022
1 parent 5a9d0ee commit e06af7f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,10 @@ public HttpServer(

HttpsConfig httpsConfig = maybeHttpsConfig.orElseThrow();
this.sslContextFactory = Optional.of(this.sslContextFactory.orElseGet(() -> createReloadingSslContextFactory(httpsConfig, clientCertificate, nodeInfo.getEnvironment())));
SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(sslContextFactory.get(), "http/1.1");
this.sslContextFactory.get().setProtocol(httpsConfig.getHttpsProtocol());
this.sslContextFactory.get().setProvider(httpsConfig.getHttpsProvider());

SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(sslContextFactory.get(), "http/1.1");
Integer acceptors = config.getHttpsAcceptorThreads();
Integer selectors = config.getHttpsSelectorThreads();
httpsConnector = createServerConnector(
Expand Down Expand Up @@ -274,7 +276,11 @@ public HttpServer(

HttpsConfig httpsConfig = maybeHttpsConfig.orElseThrow();
this.sslContextFactory = Optional.of(this.sslContextFactory.orElseGet(() -> createReloadingSslContextFactory(httpsConfig, clientCertificate, nodeInfo.getEnvironment())));
this.sslContextFactory.get().setProtocol(httpsConfig.getHttpsProtocol());
this.sslContextFactory.get().setProvider(httpsConfig.getHttpsProvider());

SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(sslContextFactory.get(), "http/1.1");

adminConnector = createServerConnector(
httpServerInfo.getAdminChannel(),
server,
Expand Down
27 changes: 27 additions & 0 deletions http-server/src/main/java/io/airlift/http/server/HttpsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
public class HttpsConfig
{
private int httpsPort = 8443;

private String httpsProvider;
private String httpsProtocol = "TLS";
private String keystorePath;
private String keystorePassword;
private String keyManagerPassword;
Expand Down Expand Up @@ -48,6 +51,30 @@ public HttpsConfig setHttpsPort(int httpsPort)
return this;
}

public String getHttpsProvider()
{
return httpsProvider;
}

@Config("http-server.https.provider")
public HttpsConfig setHttpsProvider(String httpsProvider)
{
this.httpsProvider = httpsProvider;
return this;
}

public String getHttpsProtocol()
{
return httpsProtocol;
}

@Config("http-server.https.protocol")
public HttpsConfig setHttpsProtocol(String httpsProtocol)
{
this.httpsProtocol = httpsProtocol;
return this;
}

@MinDuration("1s")
public Duration getSslSessionTimeout()
{
Expand Down

0 comments on commit e06af7f

Please sign in to comment.