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

net/http: DefaultTransport documentation should describe HTTPS_PROXY #32649

Open
HouzuoGuo opened this issue Jun 17, 2019 · 3 comments

Comments

@HouzuoGuo
Copy link

@HouzuoGuo HouzuoGuo commented Jun 17, 2019

What version of Go are you using (go version)?

go version go1.12.4 linux/amd64

Does this issue reproduce with the latest release?

Affirmative.

What operating system and processor architecture are you using (go env)?

go env Output
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/howard/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/howard/gopath"
GOPROXY=""
GORACE=""
GOROOT="/home/howard/go"
GOTMPDIR=""
GOTOOLDIR="/home/howard/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build043222332=/tmp/go-build -gno-record-gcc-switches"

What did you do?

In https://golang.org/pkg/net/http/#RoundTripper, the online manual explains the following for RoundTripper:

DefaultTransport is the default implementation of Transport and is used by DefaultClient. It establishes network connections as needed and caches them for reuse by subsequent calls. It uses HTTP proxies as directed by the $HTTP_PROXY and $NO_PROXY (or $http_proxy and $no_proxy) environment variables.

Although DefaultTransport uses proxy settings from system environment via ProxyFromEnvironment, which not even recognises HTTP proxy, but HTTPS proxy also:

ProxyFromEnvironment returns the URL of the proxy to use for a given request, as indicated by the environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY (or the lowercase versions thereof). HTTPS_PROXY takes precedence over HTTP_PROXY for https requests.

DefaultTransport indeed behaves correctly and recognises both HTTPS and HTTP proxy settings from system environment. Therefore, please elaborate about the support of HTTPS proxy in the documentation for DefaultTransport.

Thanks!

@katiehockman katiehockman changed the title http: minor issue with documentation of DefaultTransport for HTTP client net/http: minor issue with documentation of DefaultTransport for HTTP client Jun 17, 2019
@katiehockman katiehockman changed the title net/http: minor issue with documentation of DefaultTransport for HTTP client net/http: DefaultTransport documentation should describe HTTPS_PROXY Jun 17, 2019
@katiehockman

This comment has been minimized.

Copy link
Member

@katiehockman katiehockman commented Jun 17, 2019

Please let me know if I am understanding this issue. To summarize:
The documentation for DefaultTransport says that it supports HTTP_PROXY and NO_PROXY, but does not mention that it supports HTTPS_PROXY, and your suggestion is that it should describe this additional environment variable. Correct?

@katiehockman

This comment has been minimized.

Copy link
Member

@katiehockman katiehockman commented Jun 17, 2019

/cc @rsc (since Brad is on leave)

@HouzuoGuo

This comment has been minimized.

Copy link
Author

@HouzuoGuo HouzuoGuo commented Jun 18, 2019

Thanks @katiehockman and yes indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.