mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-21 19:48:12 +00:00
Disable compression when downloading, otherwise HTTP client may do "decompression" on its own. #33
This commit is contained in:
@@ -28,6 +28,7 @@ type downloaderImpl struct {
|
|||||||
unpause chan bool
|
unpause chan bool
|
||||||
progress aptly.Progress
|
progress aptly.Progress
|
||||||
threads int
|
threads int
|
||||||
|
client *http.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
// downloadTask represents single item in queue
|
// downloadTask represents single item in queue
|
||||||
@@ -50,6 +51,7 @@ func NewDownloader(threads int, progress aptly.Progress) aptly.Downloader {
|
|||||||
unpause: make(chan bool),
|
unpause: make(chan bool),
|
||||||
threads: threads,
|
threads: threads,
|
||||||
progress: progress,
|
progress: progress,
|
||||||
|
client: &http.Client{Transport: &http.Transport{DisableCompression: true}},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < downloader.threads; i++ {
|
for i := 0; i < downloader.threads; i++ {
|
||||||
@@ -105,7 +107,7 @@ func (downloader *downloaderImpl) DownloadWithChecksum(url string, destination s
|
|||||||
func (downloader *downloaderImpl) handleTask(task *downloadTask) {
|
func (downloader *downloaderImpl) handleTask(task *downloadTask) {
|
||||||
downloader.progress.Printf("Downloading %s...\n", task.url)
|
downloader.progress.Printf("Downloading %s...\n", task.url)
|
||||||
|
|
||||||
resp, err := http.Get(task.url)
|
resp, err := downloader.client.Get(task.url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
task.result <- err
|
task.result <- err
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user