Merge pull request #73046 from mikkeloscar/fix-e2e-websocket-https

Fix websocket e2e tests for https endpoints
pull/564/head
Kubernetes Prow Robot 2019-02-18 22:45:33 -08:00 committed by GitHub
commit f35b7a365e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 7 deletions

View File

@ -4226,16 +4226,10 @@ func OpenWebSocketForURL(url *url.URL, config *restclient.Config, protocols []st
if err != nil { if err != nil {
return nil, fmt.Errorf("Failed to create tls config: %v", err) return nil, fmt.Errorf("Failed to create tls config: %v", err)
} }
if tlsConfig != nil { if url.Scheme == "https" {
url.Scheme = "wss" url.Scheme = "wss"
if !strings.Contains(url.Host, ":") {
url.Host += ":443"
}
} else { } else {
url.Scheme = "ws" url.Scheme = "ws"
if !strings.Contains(url.Host, ":") {
url.Host += ":80"
}
} }
headers, err := headersForConfig(config, url) headers, err := headersForConfig(config, url)
if err != nil { if err != nil {