mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
Go 1.6 compatibility
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mxk/go-flowrate/flowrate"
|
||||
"github.com/smira/aptly/aptly"
|
||||
@@ -62,12 +63,11 @@ type downloadTask struct {
|
||||
func NewDownloader(threads int, downLimit int64, progress aptly.Progress) aptly.Downloader {
|
||||
transport := http.Transport{}
|
||||
transport.Proxy = http.DefaultTransport.(*http.Transport).Proxy
|
||||
transport.DialContext = http.DefaultTransport.(*http.Transport).DialContext
|
||||
transport.MaxIdleConns = http.DefaultTransport.(*http.Transport).MaxIdleConns
|
||||
transport.IdleConnTimeout = http.DefaultTransport.(*http.Transport).IdleConnTimeout
|
||||
transport.ResponseHeaderTimeout = 30 * time.Second
|
||||
transport.TLSHandshakeTimeout = http.DefaultTransport.(*http.Transport).TLSHandshakeTimeout
|
||||
transport.ExpectContinueTimeout = http.DefaultTransport.(*http.Transport).ExpectContinueTimeout
|
||||
transport.DisableCompression = true
|
||||
initTransport(&transport)
|
||||
transport.RegisterProtocol("ftp", &protocol.FTPRoundTripper{})
|
||||
|
||||
downloader := &downloaderImpl{
|
||||
|
||||
11
http/download_go16.go
Normal file
11
http/download_go16.go
Normal file
@@ -0,0 +1,11 @@
|
||||
// +build !go1.7
|
||||
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func initTransport(transport *http.Transport) {
|
||||
|
||||
}
|
||||
13
http/download_go17.go
Normal file
13
http/download_go17.go
Normal file
@@ -0,0 +1,13 @@
|
||||
// +build go1.7
|
||||
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func initTransport(transport *http.Transport) {
|
||||
transport.DialContext = http.DefaultTransport.(*http.Transport).DialContext
|
||||
transport.MaxIdleConns = http.DefaultTransport.(*http.Transport).MaxIdleConns
|
||||
transport.IdleConnTimeout = http.DefaultTransport.(*http.Transport).IdleConnTimeout
|
||||
}
|
||||
Reference in New Issue
Block a user