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