Disable TLS completely if there is no listener with tls enabled (#1456)

* Disable TLS completely if there is no listener with tls enabled

* Format code
This commit is contained in:
Mateusz Gajewski
2017-02-19 16:09:35 +01:00
committed by Matt Holt
parent 6083871088
commit 1262ae92e9
2 changed files with 25 additions and 5 deletions
+5 -3
View File
@@ -93,9 +93,11 @@ func NewServer(addr string, group []*SiteConfig) (*Server, error) {
s.tlsConfig = tlsConfigs
s.Server.TLSConfig = &tls.Config{
GetConfigForClient: s.tlsConfig.GetConfigForClient,
GetCertificate: s.tlsConfig.GetCertificate,
if caddytls.HasTLSEnabled(allConfigs) {
s.Server.TLSConfig = &tls.Config{
GetConfigForClient: s.tlsConfig.GetConfigForClient,
GetCertificate: s.tlsConfig.GetCertificate,
}
}
// As of Go 1.7, HTTP/2 is enabled only if NextProtos includes the string "h2"