@@ -325,7 +325,7 @@ func (r *Request) getResponse() (*http.Response, error) {
325
325
trans = & http.Transport {
326
326
TLSClientConfig : r .setting .TLSClientConfig ,
327
327
Proxy : proxy ,
328
- Dial : TimeoutDialer (r .setting .ConnectTimeout , r . setting . ReadWriteTimeout ),
328
+ Dial : TimeoutDialer (r .setting .ConnectTimeout ),
329
329
}
330
330
} else if t , ok := trans .(* http.Transport ); ok {
331
331
if t .TLSClientConfig == nil {
@@ -335,7 +335,7 @@ func (r *Request) getResponse() (*http.Response, error) {
335
335
t .Proxy = r .setting .Proxy
336
336
}
337
337
if t .Dial == nil {
338
- t .Dial = TimeoutDialer (r .setting .ConnectTimeout , r . setting . ReadWriteTimeout )
338
+ t .Dial = TimeoutDialer (r .setting .ConnectTimeout )
339
339
}
340
340
}
341
341
@@ -352,6 +352,7 @@ func (r *Request) getResponse() (*http.Response, error) {
352
352
client := & http.Client {
353
353
Transport : trans ,
354
354
Jar : jar ,
355
+ Timeout : r .setting .ReadWriteTimeout ,
355
356
}
356
357
357
358
if len (r .setting .UserAgent ) > 0 && len (r .req .Header .Get ("User-Agent" )) == 0 {
@@ -457,12 +458,12 @@ func (r *Request) Response() (*http.Response, error) {
457
458
}
458
459
459
460
// TimeoutDialer returns functions of connection dialer with timeout settings for http.Transport Dial field.
460
- func TimeoutDialer (cTimeout time.Duration , rwTimeout time. Duration ) func (net , addr string ) (c net.Conn , err error ) {
461
+ func TimeoutDialer (cTimeout time.Duration ) func (net , addr string ) (c net.Conn , err error ) {
461
462
return func (netw , addr string ) (net.Conn , error ) {
462
463
conn , err := net .DialTimeout (netw , addr , cTimeout )
463
464
if err != nil {
464
465
return nil , err
465
466
}
466
- return conn , conn . SetDeadline ( time . Now (). Add ( rwTimeout ))
467
+ return conn , nil
467
468
}
468
469
}
0 commit comments