Skip to content

Commit

Permalink
dumpling/gcs: fix http client credential problem (#29414)
Browse files Browse the repository at this point in the history
  • Loading branch information
lichunzhu authored Nov 4, 2021
1 parent 8ae81b3 commit 3f7a933
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions dumpling/export/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -532,21 +531,9 @@ func (conf *Config) createExternalStorage(ctx context.Context) (storage.External
if err != nil {
return nil, errors.Trace(err)
}
httpClient := http.DefaultClient
httpClient.Timeout = 30 * time.Second
maxIdleConnsPerHost := http.DefaultMaxIdleConnsPerHost
if conf.Threads > maxIdleConnsPerHost {
maxIdleConnsPerHost = conf.Threads
}
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.MaxIdleConnsPerHost = maxIdleConnsPerHost
httpClient.Transport = transport

return storage.New(ctx, b, &storage.ExternalStorageOptions{
HTTPClient: httpClient,
SkipCheckPath: true,
SendCredentials: false,
})

// TODO: support setting httpClient with certification later
return storage.New(ctx, b, &storage.ExternalStorageOptions{})
}

const (
Expand Down

0 comments on commit 3f7a933

Please sign in to comment.