Reuse default HTTP transport options.

This commit is contained in:
Andrey Smirnov
2014-07-24 01:17:58 +04:00
parent 521c52f600
commit 2906369a3b
+4 -4
View File
@@ -45,6 +45,9 @@ type downloadTask struct {
// NewDownloader creates new instance of Downloader which specified number // NewDownloader creates new instance of Downloader which specified number
// of threads and download limit in bytes/sec // of threads and download limit in bytes/sec
func NewDownloader(threads int, downLimit int64, progress aptly.Progress) aptly.Downloader { func NewDownloader(threads int, downLimit int64, progress aptly.Progress) aptly.Downloader {
transport := *http.DefaultTransport.(*http.Transport)
transport.DisableCompression = true
downloader := &downloaderImpl{ downloader := &downloaderImpl{
queue: make(chan *downloadTask, 1000), queue: make(chan *downloadTask, 1000),
stop: make(chan bool), stop: make(chan bool),
@@ -54,10 +57,7 @@ func NewDownloader(threads int, downLimit int64, progress aptly.Progress) aptly.
threads: threads, threads: threads,
progress: progress, progress: progress,
client: &http.Client{ client: &http.Client{
Transport: &http.Transport{ Transport: &transport,
DisableCompression: true,
Proxy: http.ProxyFromEnvironment,
},
}, },
} }