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: not using proxy for https get #2919

Closed
gopherbot opened this issue Feb 8, 2012 · 22 comments
Closed

net/http: not using proxy for https get #2919

gopherbot opened this issue Feb 8, 2012 · 22 comments
Milestone

Comments

@gopherbot
Copy link

by raul.san@sent.com:

"go get" faills at install a package through a proxy.
My proxy doesn't require authentication, although it is used for both HTTP/HTTPS
conections.


$ go get code.google.com/p/go.codereview/git85
code.google.com/p/go.codereview/git85: Get
https://code.google.com/p/go/source/checkout?repo=codereview: invalid
proxy address
@rsc
Copy link
Contributor

rsc commented Feb 8, 2012

Comment 1:

This is a bug in the http client.
What proxy environment variables do you have set?
env | grep proxy

Labels changed: added priority-go1, go1-must, removed priority-triage.

Status changed to WaitingForReply.

@gopherbot
Copy link
Author

Comment 2 by raul.san@sent.com:

http_proxy=127.0.0.1:8118

@rsc
Copy link
Contributor

rsc commented Feb 12, 2012

Comment 3:

I think the proxy code is just broken.  Thanks for the report.

Status changed to Started.

@bradfitz
Copy link
Contributor

Comment 4:

What's the issue, that the http_proxy requires an "http://" prefix?

@gopherbot
Copy link
Author

Comment 5 by raul.san@sent.com:

http_proxy doesn't require the "http://" prefix. Since I have always used with tools
like curl, wget, git in github.com, ...
$ go get -v github.com/dchest/uniuri
github.com/dchest/uniuri
But it only faills at getting code from code.google.com
$ go get code.google.com/p/leveldb-go/leveldb
code.google.com/p/leveldb-go/leveldb: Get
https://code.google.com/p/leveldb-go/source/checkout?repo=: invalid proxy address

@gopherbot
Copy link
Author

Comment 6 by raul.san@sent.com:

To use it in "code.google.com" I've to add the prefix.
I've no problem in add it but it's strange that it can be used in github.com without it.

@rsc
Copy link
Contributor

rsc commented Feb 13, 2012

Comment 7:

Started

@rsc
Copy link
Contributor

rsc commented Feb 13, 2012

Comment 8:

This issue was closed by revision fb2caa3.

Status changed to Fixed.

@gopherbot
Copy link
Author

Comment 9 by raul.san@sent.com:

I just test it using the lastest weekly, weekly.2012-02-22
$ export http_proxy=127.0.0.1:8118
$ go get -v github.com/nf/stat
github.com/nf/stat (download)
github.com/nf/stat
$ go get -v bitbucket.org/tebeka/selenium
bitbucket.org/tebeka/selenium: Get
https://api.bitbucket.org/1.0/repositories/tebeka/selenium: http: error connecting to
proxy 127.0.0.1:8118: dial tcp <nil>:0: connection refused
$ go get -v launchpad.net/gocheck
launchpad.net/gocheck (download)
# cd .; bzr branch https://launchpad.net/gocheck
/var/tmp/go-3pkg/src/launchpad.net/gocheck
bzr: ERROR: Invalid url supplied to transport: "127.0.0.1:8118": No host component
launchpad.net/gocheck: exit status 3
// * * *
$ export http_proxy=http://127.0.0.1:8118
$ go get -v bitbucket.org/tebeka/selenium
bitbucket.org/tebeka/selenium (download)
bitbucket.org/tebeka/selenium
$ go get -v launchpad.net/gocheck
launchpad.net/gocheck (download)
launchpad.net/gocheck

@rsc
Copy link
Contributor

rsc commented Feb 24, 2012

Comment 10:

Status changed to Accepted.

@robpike
Copy link
Contributor

robpike commented Feb 26, 2012

Comment 11:

Owner changed to builder@golang.org.

@bradfitz
Copy link
Contributor

Comment 12:

I can reproduce. Will investigate.

Owner changed to @bradfitz.

@bradfitz
Copy link
Contributor

Comment 13:

http://golang.org/cl/5708055

@gopherbot
Copy link
Author

Comment 14 by raul.san@sent.com:

I just test that path set:
--- FAIL: TestProxyFromEnvironment (0.00 seconds)
    transport_test.go:752: 0. got error = "invalid proxy address \"127.0.0.1:8080\": <nil>", want "<nil>"
FAIL
* * *
go version weekly.2012-02-22 +c8afb6fb97a0

@bradfitz
Copy link
Contributor

bradfitz commented Mar 1, 2012

Comment 15:

Re comment 14: I don't understand. Do the existing tests fail, or did you modify the
tests to make them fail? If the latter, which test did you add?

@gopherbot
Copy link
Author

Comment 16 by raul.san@sent.com:

Re 15: I used that tip version like base, and then, I added the lastest set patch (4)

@rsc
Copy link
Contributor

rsc commented Mar 1, 2012

Comment 17:

*** Submitted as http://code.google.com/p/go/source/detail?r=22a735929e40 ***
net/http: fix ProxyFromEnvironment bug, docs, add tests
Fixes issue #2919 I believe. (gets as far as sending a CONNECT
request to my little dummy logging proxy that doesn't actually
support CONNECT now.)  Untested with a real CONNECT-supporting
proxy, though.
R=golang-dev, rsc
CC=golang-dev
http://golang.org/cl/5708055

Status changed to Fixed.

@gopherbot
Copy link
Author

Comment 18 by raul.san@sent.com:

I've tested in tip release: go version weekly.2012-02-22 +9dd9374109a9
and it passes all tests but it faills with launchpad (it works now in bitbucket)
$ export http_proxy=127.0.0.1:8118
$ go get -v github.com/nf/stat
github.com/nf/stat (download)
github.com/nf/stat
$ go get -v bitbucket.org/tebeka/selenium
bitbucket.org/tebeka/selenium (download)
bitbucket.org/tebeka/selenium
$ go get -v launchpad.net/gocheck
launchpad.net/gocheck (download)
# cd .; bzr branch https://launchpad.net/gocheck
/var/tmp/go-3pkg/src/launchpad.net/gocheck
bzr: ERROR: Invalid url supplied to transport: "127.0.0.1:8118": No host component
package launchpad.net/gocheck: exit status 3

@adg
Copy link
Contributor

adg commented Mar 4, 2012

Comment 19:

Raul, that looks like an issue with 'bzr', not 'go'. Does bzr support the http_proxy
environment variable?

@gopherbot
Copy link
Author

Comment 20 by raul.san@sent.com:

Re 19: yes, it supports. Read at the end in
https://golang.org/issue/2919?c=9

@gopherbot
Copy link
Author

Comment 21 by raul.san@sent.com:

I've tested again with the last weekly, and I can confirm that it only fails with
"launchpad.net".
* I didn't test code.google.com but it's ok:
$ export http_proxy=127.0.0.1:8118
$ go get -v code.google.com/p/go.codereview/git85
code.google.com/p/go.codereview (download)
code.google.com/p/go.codereview/git85
$ go get -v launchpad.net/gocheck
launchpad.net/gocheck (download)
# cd .; bzr branch https://launchpad.net/gocheck
/var/tmp/go-3pkg/src/launchpad.net/gocheck
bzr: ERROR: Invalid url supplied to transport: "127.0.0.1:8118": No host component
package launchpad.net/gocheck: exit status 3
$ export http_proxy=http://127.0.0.1:8118
$ go get -v launchpad.net/gocheck
launchpad.net/gocheck (download)
launchpad.net/gocheck
When it's added "http://" to the variable then it's downloaded but it takes a long time,
a lot of more time than the another repositories.

@rsc
Copy link
Contributor

rsc commented Mar 5, 2012

Comment 22:

This is fixed.  The error you are seeing comes form bzr, not from the go command.
Your http_proxy really should be a URL.  We have allowed plain host:port in the 
go command and Go http libraries, but not all tools accept that.  In particular, bzr
does not:
$ http_proxy=127.0.0.1:8000 bzr branch https://launchpad.net/gocheck /tmp/gocheck
bzr: ERROR: Invalid url supplied to transport: "127.0.0.1:8000": No host component
$ 
This has nothing to do with the go command.  If you think this behavior is wrong,
please file a bug with the bzr authors.

@rsc rsc added this to the Go1 milestone Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants