Skip to content

Commit

Permalink
fix:fasthttp server with tlsConfig
Browse files Browse the repository at this point in the history
Signed-off-by: zhangweiyu <[email protected]>
  • Loading branch information
zxpdmw committed Jul 18, 2023
1 parent 2ee1a89 commit c5add28
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1678,8 +1678,7 @@ func (s *Server) ListenAndServeTLSEmbed(addr string, certData, keyData []byte) e
func (s *Server) ServeTLS(ln net.Listener, certFile, keyFile string) error {
s.mu.Lock()
s.configTLS()
config := s.TLSConfig.Clone()
configHasCert := len(config.Certificates) > 0 || config.GetCertificate != nil
configHasCert := len(s.TLSConfig.Certificates) > 0 || s.TLSConfig.GetCertificate != nil
if !configHasCert || certFile != "" || keyFile != "" {
if err := s.AppendCert(certFile, keyFile); err != nil {
s.mu.Unlock()
Expand Down Expand Up @@ -1707,8 +1706,7 @@ func (s *Server) ServeTLS(ln net.Listener, certFile, keyFile string) error {
func (s *Server) ServeTLSEmbed(ln net.Listener, certData, keyData []byte) error {
s.mu.Lock()
s.configTLS()
config := s.TLSConfig.Clone()
configHasCert := len(config.Certificates) > 0 || config.GetCertificate != nil
configHasCert := len(s.TLSConfig.Certificates) > 0 || s.TLSConfig.GetCertificate != nil
if !configHasCert || len(certData) != 0 || len(keyData) != 0 {
if err := s.AppendCertEmbed(certData, keyData); err != nil {
s.mu.Unlock()
Expand Down

0 comments on commit c5add28

Please sign in to comment.