Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Fix syncing cache behind HTTP proxy #326

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/kfconfig/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,9 @@ func (c *KfConfig) SyncCache() error {
return errors.WithStack(err)
}
} else {
t := &http.Transport{}
t := &http.Transport{
Proxy: http.ProxyFromEnvironment,
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way to provide a test for this?

Copy link
Contributor Author

@AlexanderEkdahl AlexanderEkdahl May 10, 2020

Choose a reason for hiding this comment

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

This can certainly be tested and the behavior is tested in detail here: https://github.com/golang/net/blob/master/http/httpproxy/proxy_test.go. However, I don't think it is valuable to test this in kfctl as it introduces undue maintenance burden on the kfctl developers.

Using http.ProxyFromEnvironment is the default behavior for all HTTP request in Go(link) and this PR simply ensures the same behavior as the transport happens to be overridden in kfctl.

}
t.RegisterProtocol("file", http.NewFileTransport(http.Dir("/")))
t.RegisterProtocol("", http.NewFileTransport(http.Dir("/")))
hclient := &http.Client{Transport: t}
Expand Down