Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy the fix (#38519) to the staging folder in release-1.5 #46811

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions staging/src/k8s.io/client-go/rest/url_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ func DefaultServerURL(host, apiPath string, groupVersion unversioned.GroupVersio
}
base := host
hostURL, err := url.Parse(base)
if err != nil {
return nil, "", err
}
if hostURL.Scheme == "" || hostURL.Host == "" {
if err != nil || hostURL.Scheme == "" || hostURL.Host == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is not an error but the host is missing, I'm not sure how pre-pending the scheme is going to help.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When parsing a url in the form of host:port but without the scheme, url.Parse will set the url.Scheme to host, while leave the url.Host to empty.

scheme := "http://"
if defaultTLS {
scheme = "https://"
Expand Down