-
Notifications
You must be signed in to change notification settings - Fork 414
/
gorequest_transport_go1.8.go
34 lines (31 loc) · 1.28 KB
/
gorequest_transport_go1.8.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.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,
DialContext: oldTransport.DialContext,
Dial: oldTransport.Dial,
DialTLS: oldTransport.DialTLS,
TLSClientConfig: oldTransport.TLSClientConfig,
TLSHandshakeTimeout: oldTransport.TLSHandshakeTimeout,
DisableKeepAlives: oldTransport.DisableKeepAlives,
DisableCompression: oldTransport.DisableCompression,
MaxIdleConns: oldTransport.MaxIdleConns,
MaxIdleConnsPerHost: oldTransport.MaxIdleConnsPerHost,
IdleConnTimeout: oldTransport.IdleConnTimeout,
ResponseHeaderTimeout: oldTransport.ResponseHeaderTimeout,
ExpectContinueTimeout: oldTransport.ExpectContinueTimeout,
TLSNextProto: oldTransport.TLSNextProto,
MaxResponseHeaderBytes: oldTransport.MaxResponseHeaderBytes,
// new in go1.8
ProxyConnectHeader: oldTransport.ProxyConnectHeader,
}
}