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

Fix modify http.DefaultTransport #259

Closed
wants to merge 1 commit into from
Closed

Fix modify http.DefaultTransport #259

wants to merge 1 commit into from

Conversation

septs
Copy link

@septs septs commented Sep 27, 2023

Original logic modify http.DefualtTransport Proxy Settings.

Use the library, developer won't realize proxy settings, (runtime) global proxy settings is changed

Copy link
Member

@oschwald oschwald left a comment

Choose a reason for hiding this comment

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

You raise an excellent point. This code wasn't originally written to be part of a shared library, and so there is stuff like this that should be fixed.

@@ -48,10 +48,9 @@ func NewHTTPReader(
retryFor time.Duration,
verbose bool,
) Reader {
transport := http.DefaultTransport
transport := &http.Transport{Proxy: http.ProxyFromEnvironment}
Copy link
Member

Choose a reason for hiding this comment

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

This is missing all the other settings in http.DefaultTransport. It might be best to just clone the default transport instead.

@septs septs closed this Sep 28, 2023
@septs septs deleted the septs/fix-change-default-transport branch September 28, 2023 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants