-
Notifications
You must be signed in to change notification settings - Fork 414
/
gorequest_transport_go1.7.go
34 lines (31 loc) · 1.23 KB
/
gorequest_transport_go1.7.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// +build go1.7
// +build !go1.8
package gorequest
import (
"net/http"
)
// does a shallow clone of the transport
func (s *SuperAgent) safeModifyTransport() {
if !s.isClone {
return
}
oldTransport := s.Transport
s.Transport = &http.Transport{
Proxy: oldTransport.Proxy,
Dial: oldTransport.Dial,
DialTLS: oldTransport.DialTLS,
TLSClientConfig: oldTransport.TLSClientConfig,
TLSHandshakeTimeout: oldTransport.TLSHandshakeTimeout,
DisableKeepAlives: oldTransport.DisableKeepAlives,
DisableCompression: oldTransport.DisableCompression,
MaxIdleConns: oldTransport.MaxIdleConns,
MaxIdleConnsPerHost: oldTransport.MaxIdleConnsPerHost,
ResponseHeaderTimeout: oldTransport.ResponseHeaderTimeout,
ExpectContinueTimeout: oldTransport.ExpectContinueTimeout,
TLSNextProto: oldTransport.TLSNextProto,
// new in go1.7
DialContext: oldTransport.DialContext,
IdleConnTimeout: oldTransport.IdleConnTimeout,
MaxResponseHeaderBytes: oldTransport.MaxResponseHeaderBytes,
}
}