fix(ghttp): resolve the issue where the GetCertificate callback in TLS listener gets overwritten (#4789)

This commit is contained in:
Cheng Tang
2026-07-08 10:06:18 +08:00
committed by GitHub
parent fb89f8bdf8
commit 5c9f3b39ec

View File

@ -222,7 +222,7 @@ func (s *Server) CreateListenerTLS(certFile, keyFile string, tlsConfig ...*tls.C
config.NextProtos = []string{"http/1.1"}
}
var err error
if len(config.Certificates) == 0 {
if len(config.Certificates) == 0 && config.GetCertificate == nil {
config.Certificates = make([]tls.Certificate, 1)
if gres.Contains(certFile) {
config.Certificates[0], err = tls.X509KeyPair(