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