Commit b7a31ad2 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #25690 from fabianofranz/fixes_panic_on_roundtripper_when_tls_under_proxy

Automatic merge from submit-queue Fixes panic on round tripper when TLS under a proxy When under a proxy with a valid cert from a trusted authority, the `SpdyRoundTripper` will likely not have a `*tls.Config` (no cert verification nor `InsecureSkipVerify` happened), which will result in a panic. So we have to create a new `*tls.Config` to be able to create a TLS client right after. If `RootCAs` in that new config is nil, the system pool will be used. @ncdc PTAL [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
parents 27512dd0 5940040c
...@@ -125,6 +125,10 @@ func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) { ...@@ -125,6 +125,10 @@ func (s *SpdyRoundTripper) dial(req *http.Request) (net.Conn, error) {
return nil, err return nil, err
} }
if s.tlsConfig == nil {
s.tlsConfig = &tls.Config{}
}
if len(s.tlsConfig.ServerName) == 0 { if len(s.tlsConfig.ServerName) == 0 {
s.tlsConfig.ServerName = host s.tlsConfig.ServerName = host
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment