|
|
@@ -143,7 +143,9 @@ func (client *Client) InitWithOptions(regionId string, config *Config, credentia
|
|
|
client.config = config
|
|
|
client.httpClient = &http.Client{}
|
|
|
|
|
|
- if config.HttpTransport != nil {
|
|
|
+ if config.Transport != nil {
|
|
|
+ client.httpClient.Transport = config.Transport
|
|
|
+ } else if config.HttpTransport != nil {
|
|
|
client.httpClient.Transport = config.HttpTransport
|
|
|
}
|
|
|
|
|
|
@@ -486,7 +488,7 @@ func (client *Client) setTimeout(request requests.AcsRequest) {
|
|
|
if trans, ok := client.httpClient.Transport.(*http.Transport); ok && trans != nil {
|
|
|
trans.DialContext = Timeout(connectTimeout)
|
|
|
client.httpClient.Transport = trans
|
|
|
- } else {
|
|
|
+ } else if client.httpClient.Transport == nil {
|
|
|
client.httpClient.Transport = &http.Transport{
|
|
|
DialContext: Timeout(connectTimeout),
|
|
|
}
|
|
|
@@ -533,8 +535,12 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r
|
|
|
// Set whether to ignore certificate validation.
|
|
|
// Default InsecureSkipVerify is false.
|
|
|
if trans, ok := client.httpClient.Transport.(*http.Transport); ok && trans != nil {
|
|
|
- trans.TLSClientConfig = &tls.Config{
|
|
|
- InsecureSkipVerify: client.getHTTPSInsecure(request),
|
|
|
+ if trans.TLSClientConfig != nil {
|
|
|
+ trans.TLSClientConfig.InsecureSkipVerify = client.getHTTPSInsecure(request)
|
|
|
+ } else {
|
|
|
+ trans.TLSClientConfig = &tls.Config{
|
|
|
+ InsecureSkipVerify: client.getHTTPSInsecure(request),
|
|
|
+ }
|
|
|
}
|
|
|
if proxy != nil && !flag {
|
|
|
trans.Proxy = http.ProxyURL(proxy)
|