aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2014-05-19 10:12:15 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2014-05-19 10:12:15 -0700
commitf0bdee171f2490b2f9638e46cc133644f01a2156 (patch)
treef6544e5c9d6e2ba99c0b1f0c9ec135f651eca75b
parent7b103c555f9200eed9329f433378e72c7909e398 (diff)
downloadgo-f0bdee171f2490b2f9638e46cc133644f01a2156.tar.gz
go-f0bdee171f2490b2f9638e46cc133644f01a2156.zip
net/http: document that ProxyFromEnvironment special-cases localhost
Fixes #7256 LGTM=r R=golang-codereviews, r CC=golang-codereviews, rsc https://golang.org/cl/97590043
-rw-r--r--src/pkg/net/http/transport.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/net/http/transport.go b/src/pkg/net/http/transport.go
index 2ffc404712..b1cc632a78 100644
--- a/src/pkg/net/http/transport.go
+++ b/src/pkg/net/http/transport.go
@@ -109,6 +109,9 @@ type Transport struct {
// An error is returned if the proxy environment is invalid.
// A nil URL and nil error are returned if no proxy is defined in the
// environment, or a proxy should not be used for the given request.
+//
+// As a special case, if req.URL.Host is "localhost" (with or without
+// a port number), then a nil URL and nil error will be returned.
func ProxyFromEnvironment(req *Request) (*url.URL, error) {
proxy := httpProxyEnv.Get()
if proxy == "" {