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

x/net/proxy: Non-SOCKS ALL_PROXY results in proxy: unknown scheme: http #16715

Open
bbodenmiller opened this issue Aug 16, 2016 · 4 comments
Open
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@bbodenmiller
Copy link

bbodenmiller commented Aug 16, 2016

If the ALL_PROXY environment variable is set to a non-SOCKS address it results in the proxy: unknown scheme: http when it instead should ignore it.

  1. What version of Go are you using (go version)?
    go1.6.3 via docker
  2. What operating system and processor architecture are you using (go env)?
    windows/amd64
  3. What did you do?
    Have a http ALL_PROXY environment variable set and try to run Docker Toolbox, e.g. docker run hello-world
  4. What did you expect to see?
    Docker should work fine, Go should ignore non-SOCKS ALL_PROXY environment variable
  5. What did you see instead?
    Docker doesn't work because non-SOCKS ALL_PROXY environment variable is not ignored. The error can be traced back to https://github.com/golang/net/blob/master/proxy/proxy.go#L93.

Workaround: Run unset ALL_PROXY when you get error.

@bradfitz bradfitz changed the title Non-SOCKS ALL_PROXY results in proxy: unknown scheme: http x/net/proxy: Non-SOCKS ALL_PROXY results in proxy: unknown scheme: http Aug 16, 2016
@bradfitz bradfitz added this to the Unreleased milestone Aug 16, 2016
@nathanleclaire
Copy link

I'm not 100% sure, but are you sure setting ALL_PROXY to a http or https protocol makes sense? There might be traffic which is non-HTTP that wants to pass through the proxy.

@brandond
Copy link

I can't believe this is still open.

@mdsauce
Copy link

mdsauce commented Feb 3, 2019

@nathanleclaire I think you have to register the Dialer Type yourself: https://godoc.org/golang.org/x/net/proxy#RegisterDialerType

Read more here and here:
http://blog.ralch.com/articles/network-programming-and-proxies-in-golang/
https://gist.github.com/jim3ma/3750675f141669ac4702bc9deaf31c6b

But I am also not sure and in the process of trying to setup a proxy for TCP dialers. HTTP client modifications are crazy easy:
http.DefaultTransport = &http.Transport{Proxy: http.ProxyURL(proxyURL)}

But using net.Dial and net.DialTimeout is less straightforward with a non-SOCKS5 proxy scheme.

@luochen1990
Copy link

I'm not 100% sure, but are you sure setting ALL_PROXY to a http or https protocol makes sense? There might be traffic which is non-HTTP that wants to pass through the proxy.

I think non-HTTP traffic pass through a http proxy is very normal

@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

7 participants