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

cmd/go: http proxy failure #29809

Open
jtfogarty opened this Issue Jan 18, 2019 · 5 comments

Comments

Projects
None yet
4 participants
@jtfogarty
Copy link

jtfogarty commented Jan 18, 2019

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

$ go version go1.11 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/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-build200009662=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Doing a go get fails behind a corporate proxy if environment variables are set as below; HTTP_PROXY=http://proxyIp:proxyPort
it succeeds if set as
HTTP_PROXY=proxyIp:proxyPort
this is true for HTTP or HTTPS variables This is also true for any go project using net/http
I'm seeing this issue with Docker versions greater than 17.09, Jenkins-x, goBuffalo
Older versions of go (specifically 1.8.3 - the only version I tested) do not behave this way
Docker version 17.09 and lower do not behave this way.

What did you expect to see?

I expect it to pull through the proxy server with the below environment variables set;
HTTP_PROXY=http://proxyIp:proxyPort
HTTPS_PROXY=https://proxyIp:proxyPort

What did you see instead?

Process fails to get through the proxy.

@bradfitz bradfitz changed the title net/http Proxy Failure cmd/go: http proxy failure Jan 18, 2019

@bradfitz bradfitz added this to the Go1.13 milestone Jan 18, 2019

@bradfitz

This comment has been minimized.

Copy link
Member

bradfitz commented Jan 18, 2019

/cc @bcmills for cmd/go.

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Jan 22, 2019

What did you do?

Doing a go get fails […]

More detail, please.

  • Fails in what way? (Does the error message indicate what went wrong?)

  • You appear to be using an insecure (HTTP-only) proxy. Did you pass the -insecure flag to go get?

@jtfogarty

This comment has been minimized.

Copy link
Author

jtfogarty commented Jan 22, 2019

With variables as below;

http_proxy=http://proxyIp:proxyPort
https_proxy=https://proxyIp:proxyPort

The error is;

go get golang.org/x/blog/content
package golang.org/x/blog/content: unrecognized import path "golang.org/x/blog/content" (https fetch: Get https://golang.org/x/blog/content?go-get=1: proxyconnect tcp: EOF)

With variables as;

http_proxy=proxyIp:proxyPort
https_proxy=proxyIp:proxyPort

The below succeeds
go get golang.org/x/blog/content

Not sure about your point on HTTP only. The go get command does not specify either.

@bcmills bcmills removed the WaitingForInfo label Jan 22, 2019

@bcmills

This comment has been minimized.

Copy link
Member

bcmills commented Jan 22, 2019

What happens if you run curl https://golang.org/x/blog/content?go-get=1 in the same environment?

@jtfogarty

This comment has been minimized.

Copy link
Author

jtfogarty commented Jan 22, 2019

Works fine when variables are set to;

http_proxy=http://proxyIp:proxyPort
https_proxy=https://proxyIp:proxyPort
curl https://golang.org/x/blog/content?go-get=1
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="go-import" content="golang.org/x/blog git https://go.googlesource.com/blog">
<meta name="go-source" content="golang.org/x/blog https://github.com/golang/blog/ https://github.com/golang/blog/tree/master{/dir} https://github.com/golang/blog/blob/master{/dir}/{file}#L{line}">
<meta http-equiv="refresh" content="0; url=https://godoc.org/golang.org/x/blog/content">
</head>
<body>
Nothing to see here; <a href="https://godoc.org/golang.org/x/blog/content">move along</a>.
</body>
</html>

@bcmills bcmills self-assigned this Feb 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment