common: use HTTP proxy if available from env [GH-252]
This commit is contained in:
parent
b998e88b0a
commit
8bbed8656a
|
@ -1,6 +1,9 @@
|
|||
## 0.3.3 (unreleased)
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
* core: All HTTP downloads across Packer now support the standard
|
||||
proxy environmental variables (`HTTP_PROXY`, `NO_PROXY`, etc.) [GH-252]
|
||||
|
||||
## 0.3.2 (August 18, 2013)
|
||||
|
||||
|
|
|
@ -188,7 +188,18 @@ func (*HTTPDownloader) Cancel() {
|
|||
|
||||
func (d *HTTPDownloader) Download(dst io.Writer, src *url.URL) error {
|
||||
log.Printf("Starting download: %s", src.String())
|
||||
resp, err := http.Get(src.String())
|
||||
req, err := http.NewRequest("GET", src.String(), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
httpClient := &http.Client{
|
||||
Transport: &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
},
|
||||
}
|
||||
|
||||
resp, err := httpClient.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue