jmckaskill/gospdy

Incomplete use of tls.Config in gospdy.Transport

Closed this issue · 1 comments

In gospdy.Transport.RoundTrip(), on line 246, the TLS connection verifies the certificate's hostname, even if this has been disabled in the tls.Config.

My proposed fix replaces:

   if err := tlsSock.VerifyHostname(cfg.ServerName); err != nil {
       t.lk.Unlock()
       tlsSock.Close()
       proxySock.Close()
       return nil, err
   }

with:

   if !cfg.InsecureSkipVerify {
       if err := tlsSock.VerifyHostname(cfg.ServerName); err != nil {
       t.lk.Unlock()
       tlsSock.Close()
       proxySock.Close()
       return nil, err
       }
   }

Sounds good, can you generate a pull request?