astaxie / bat

Go implement CLI, cURL-like tool for humans
Apache License 2.0
2.55k stars 220 forks source link

http proxy support #5

Closed zbindenren closed 9 years ago

zbindenren commented 9 years ago

Http Proxy support would be great.

/tmp ❯❯❯ echo $http_proxy http://localhost:9999 /tmp ❯❯❯ echo $https_proxy http://localhost:9999 /tmp ❯❯❯ bat beego.me 2015/04/10 13:20:51 can't get the url Get http://beego.me: dial tcp 106.187.97.110:80: connection refused

astaxie commented 9 years ago

yea, it's already in httplib, but I should add more flag. it will be next feature

zbindenren commented 9 years ago

It should probably not be a flag, but read env vars.

astaxie commented 9 years ago

no, I don't think we should read the env vars. because I should support all system, env vars is not a good solution for this.

I want to do like this:

-proxy=PROTOCOL:PROXY_URL

PROTOCOL: http or https

astaxie commented 9 years ago

But it looks I can support flag and env vars. first read from flag, if it's nil, then read from env vars. but that will always use the proxy if set the env vars.

zbindenren commented 9 years ago

As far as I know, windows also supports env variables. But if you support both, it is ok.

astaxie commented 9 years ago

@zbindenren it's support both now. you can try it now.