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