2016-09-10 20:17:43 +02:00
|
|
|
// HTTP parts pre go1.7
|
|
|
|
|
|
|
|
//+build !go1.7
|
|
|
|
|
|
|
|
package fs
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
// dial with timeouts
|
2017-07-23 17:10:23 +02:00
|
|
|
func (ci *ConfigInfo) dialTimeout(network, address string) (net.Conn, error) {
|
|
|
|
dialer := ci.NewDialer()
|
2016-09-10 20:17:43 +02:00
|
|
|
c, err := dialer.Dial(network, address)
|
|
|
|
if err != nil {
|
|
|
|
return c, err
|
|
|
|
}
|
2017-07-23 17:10:23 +02:00
|
|
|
return newTimeoutConn(c, ci.Timeout), nil
|
2016-09-10 20:17:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Initialise the http.Transport for pre go1.7
|
|
|
|
func (ci *ConfigInfo) initTransport(t *http.Transport) {
|
2017-07-23 23:36:32 +02:00
|
|
|
t.Dial = ci.dialTimeout
|
2016-09-10 20:17:43 +02:00
|
|
|
}
|