Wrap systemd-provided sockets in a TLS listener.

This fixes a bug introduced by the new socket activation/systemd-brokered listening whereby Red October speaks HTTP rather than HTTPS over that socket.
This commit is contained in:
Joshua Kroll
2015-11-02 13:20:53 -08:00
parent ca3a0c6b77
commit fe973169fa

View File

@@ -134,9 +134,9 @@ func NewServer(process chan<- userRequest, staticPath, addr, caPath string, cert
log.Fatal(err)
}
if len(listenFDs) != 1 {
log.Fatal("Unexpected number of socket activation FDs!")
log.Fatalf("Unexpected number of socket activation FDs! (%v)", len(listenFDs))
}
lstnr = listenFDs[0]
lstnr = tls.NewListener(listenFDs[0], &config)
} else {
conn, err := net.Listen("tcp", addr)
if err != nil {